Package com.alibaba.druid.sql.parser
Class Lexer
java.lang.Object
com.alibaba.druid.sql.parser.Lexer
- Direct Known Subclasses:
AdsLexer,AntsparkLexer,BlinkLexer,ClickhouseLexer,DB2Lexer,H2Lexer,HiveLexer,MySqlLexer,OdpsLexer,OracleLexer,OscarLexer,PGLexer,PhoenixLexer,PrestoLexer,SQLServerLexer
- Author:
- wenshao [szujobs@hotmail.com]
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected char[]protected intprotected charprotected intprotected Lexer.CommentHandlerprotected DbTypeprotected booleanprotected intprotected longprotected longprotected booleanprotected booleanprotected Keywordsprotected intprotected intprotected intprotected booleanprotected intprotected booleanprotected intprotected intprotected intprotected booleanprotected intprotected Stringprotected static SymbolTablefinal Stringprotected TimeZoneprotected Token -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddComment(String comment) final Stringvoidarraycopy(int srcPos, char[] dest, int destPos, int length) intbp()final charcharAt(int index) voidvoidconfig(SQLParserFeature feature, boolean state) charcurrent()intfinal DbTypeintgetLine()intintbooleanfinal longfinal booleanidentifierEquals(long hash_lower) final booleanidentifierEquals(String text) info()protected voidinitBuff(int size) final Numberbooleanfinal booleanisDigit(char ch) protected static final booleanisDigit2(char ch) final booleanisEnabled(SQLParserFeature feature) booleanbooleanisEOF()booleanfinal booleanprotected booleanisSafeComment(String comment) protected voidReport an error at the given position using the provided arguments.mark()Deprecated.markOut()final voidnextPath()final voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidfinal voidintnumberExpr(boolean negate) numberExpr(SQLObject parent) final Stringstatic Stringparameterize(String sql, DbType dbType) final intpos()Return the current token's position: a 0-based offset from beginning of the raw input stream (before unicode translation)protected final voidputChar(char ch) Append a character to sbuf.voidreset()Deprecated.voidreset(int pos) voidDeprecated.voidreset(Lexer.SavePoint savePoint) protected final voidprotected final voidscanChar()voidvoidprotected final voidvoidprotected voidvoidvoidfinal SQLTypefinal SQLTypeprotected voidprotected final voidprotected final voidvoidprotected voidvoidsetAllowComment(boolean allowComment) voidsetCommentHandler(Lexer.CommentHandler commentHandler) voidsetKeepComments(boolean keepComments) voidsetTimeZone(TimeZone timeZone) voidvoidfinal booleanskipToNextLine(int startPosition) final booleanskipToNextLineOrParameter(int startPosition) final StringThe value of a literal token, recorded as a string.final char[]sub_chars(int offset, int count) final StringsubString(int offset) final StringsubString(int offset, int count) final Tokentoken()Return the current token, set by nextToken().protected voidunscan()
-
Field Details
-
symbols_l2
-
features
protected int features -
timeZone
-
text
-
pos
protected int pos -
mark
protected int mark -
numberSale
protected int numberSale -
numberExp
protected boolean numberExp -
ch
protected char ch -
buf
protected char[] buf -
bufPos
protected int bufPos -
token
-
keywords
-
stringVal
-
hashLCase
protected long hashLCase -
hash
protected long hash -
commentCount
protected int commentCount -
comments
-
skipComment
protected boolean skipComment -
commentHandler
-
endOfComment
protected boolean endOfComment -
keepComments
protected boolean keepComments -
line
protected int line -
lines
protected int lines -
dbType
-
optimizedForParameterized
protected boolean optimizedForParameterized -
keepSourceLocation
protected boolean keepSourceLocation -
startPos
protected int startPos -
posLine
protected int posLine -
posColumn
protected int posColumn
-
-
Constructor Details
-
Lexer
-
Lexer
-
Lexer
-
Lexer
-
Lexer
public Lexer(char[] input, int inputLength, boolean skipComment)
-
-
Method Details
-
isKeepComments
public boolean isKeepComments() -
setKeepComments
public void setKeepComments(boolean keepComments) -
getCommentHandler
-
setCommentHandler
-
charAt
public final char charAt(int index) -
addSymbol
-
subString
-
subString
-
sub_chars
public final char[] sub_chars(int offset, int count) -
initBuff
protected void initBuff(int size) -
arraycopy
public void arraycopy(int srcPos, char[] dest, int destPos, int length) -
isAllowComment
public boolean isAllowComment() -
setAllowComment
public void setAllowComment(boolean allowComment) -
nextVarIndex
public int nextVarIndex() -
getKeywords
-
mark
Deprecated. -
markOut
-
reset
-
reset
Deprecated. -
reset
public void reset(int pos) -
scanChar
protected final void scanChar() -
unscan
protected void unscan() -
isEOF
public boolean isEOF() -
lexError
Report an error at the given position using the provided arguments. -
token
Return the current token, set by nextToken(). -
setToken
-
getDbType
-
info
-
nextTokenComma
public final void nextTokenComma() -
nextTokenCommaValue
public final void nextTokenCommaValue() -
nextTokenEq
public final void nextTokenEq() -
nextTokenLParen
public final void nextTokenLParen() -
nextTokenValue
public final void nextTokenValue() -
nextTokenBy
public final void nextTokenBy() -
nextTokenNotOrNull
public final void nextTokenNotOrNull() -
nextTokenIdent
public final void nextTokenIdent() -
scanSQLType
-
scanSQLTypeV2
-
nextTokenAlias
public final void nextTokenAlias() -
nextPath
public final void nextPath() -
nextTokenForSet
public final void nextTokenForSet() -
skipToNextLine
public final boolean skipToNextLine(int startPosition) -
skipToNextLineOrParameter
public final boolean skipToNextLineOrParameter(int startPosition) -
nextToken
public final void nextToken() -
scanLBracket
protected void scanLBracket() -
scanString
protected void scanString() -
scanString2
protected final void scanString2() -
scanString2_d
protected final void scanString2_d() -
scanAlias
protected final void scanAlias() -
scanSharp
public void scanSharp() -
scanVariable
public void scanVariable() -
scanVariable_at
protected void scanVariable_at() -
scanComment
public void scanComment() -
scanHiveComment
protected final void scanHiveComment() -
scanLineArgument
-
scanIdentifier
public void scanIdentifier() -
scanNumber
public void scanNumber() -
scanHexaDecimal
public void scanHexaDecimal() -
hexString
-
isDigit
public final boolean isDigit(char ch) -
isDigit2
protected static final boolean isDigit2(char ch) -
putChar
protected final void putChar(char ch) Append a character to sbuf. -
pos
public final int pos()Return the current token's position: a 0-based offset from beginning of the raw input stream (before unicode translation) -
stringVal
The value of a literal token, recorded as a string. For integers, leading 0x and 'l' suffixes are suppressed. -
identifierEquals
-
identifierEquals
public final boolean identifierEquals(long hash_lower) -
hashLCase
public final long hashLCase() -
readAndResetComments
-
isNegativeIntegerValue
public final boolean isNegativeIntegerValue() -
integerValue
-
bp
public int bp() -
current
public char current() -
reset
Deprecated. -
numberString
-
decimalValue
-
numberExpr
-
numberExpr
-
numberExpr
-
hasComment
public boolean hasComment() -
getCommentCount
public int getCommentCount() -
skipToEOF
public void skipToEOF() -
isEndOfComment
public boolean isEndOfComment() -
isSafeComment
-
addComment
-
getComments
-
getLine
public int getLine() -
computeRowAndColumn
public void computeRowAndColumn() -
getPosLine
public int getPosLine() -
getPosColumn
public int getPosColumn() -
config
-
getTimeZone
-
setTimeZone
-
isEnabled
-
parameterize
-
getSource
-