mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
improved sql parser.
This commit is contained in:
@@ -15,15 +15,13 @@
|
||||
*/
|
||||
package com.alibaba.druid.sql.dialect.postgresql.parser;
|
||||
|
||||
import static com.alibaba.druid.sql.parser.CharTypes.isIdentifierChar;
|
||||
import static com.alibaba.druid.sql.parser.Token.LITERAL_CHARS;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.alibaba.druid.sql.parser.Keywords;
|
||||
import com.alibaba.druid.sql.parser.Lexer;
|
||||
import com.alibaba.druid.sql.parser.SQLParserFeature;
|
||||
import com.alibaba.druid.sql.parser.Token;
|
||||
import com.alibaba.druid.sql.parser.*;
|
||||
import com.alibaba.druid.util.JdbcConstants;
|
||||
|
||||
public class PGLexer extends Lexer {
|
||||
@@ -187,4 +185,43 @@ public class PGLexer extends Lexer {
|
||||
token = Token.POUND;
|
||||
}
|
||||
}
|
||||
|
||||
protected void scanVariable_at() {
|
||||
if (ch != '@') {
|
||||
throw new ParserException("illegal variable. " + info());
|
||||
}
|
||||
|
||||
mark = pos;
|
||||
bufPos = 1;
|
||||
char ch;
|
||||
|
||||
final char c1 = charAt(pos + 1);
|
||||
if (c1 == '@') {
|
||||
pos += 2;
|
||||
token = Token.MONKEYS_AT_AT;
|
||||
this.ch = charAt(++pos);
|
||||
return;
|
||||
} else if (c1 == '>') {
|
||||
pos += 2;
|
||||
token = Token.MONKEYS_AT_GT;
|
||||
this.ch = charAt(++pos);
|
||||
return;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
ch = charAt(++pos);
|
||||
|
||||
if (!isIdentifierChar(ch)) {
|
||||
break;
|
||||
}
|
||||
|
||||
bufPos++;
|
||||
continue;
|
||||
}
|
||||
|
||||
this.ch = charAt(pos);
|
||||
|
||||
stringVal = addSymbol();
|
||||
token = Token.VARIANT;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user