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 [[email protected]]
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected char[]
protected int
protected char
protected int
protected Lexer.CommentHandler
protected DbType
protected boolean
protected int
protected long
protected long
protected boolean
protected boolean
protected Keywords
protected int
protected int
protected int
protected boolean
protected int
protected boolean
protected int
protected int
protected int
protected boolean
protected int
protected String
protected static SymbolTable
final String
protected TimeZone
protected Token
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addComment
(String comment) final String
void
arraycopy
(int srcPos, char[] dest, int destPos, int length) int
bp()
final char
charAt
(int index) void
void
config
(SQLParserFeature feature, boolean state) char
current()
int
final DbType
int
getLine()
int
int
boolean
final long
final boolean
identifierEquals
(long hash_lower) final boolean
identifierEquals
(String text) info()
protected void
initBuff
(int size) final Number
boolean
final boolean
isDigit
(char ch) protected static final boolean
isDigit2
(char ch) final boolean
isEnabled
(SQLParserFeature feature) boolean
boolean
isEOF()
boolean
final boolean
protected boolean
isSafeComment
(String comment) protected void
Report an error at the given position using the provided arguments.mark()
Deprecated.markOut()
final void
nextPath()
final void
final void
final void
final void
final void
final void
final void
final void
final void
final void
final void
int
numberExpr
(boolean negate) numberExpr
(SQLObject parent) final String
static String
parameterize
(String sql, DbType dbType) final int
pos()
Return the current token's position: a 0-based offset from beginning of the raw input stream (before unicode translation)protected final void
putChar
(char ch) Append a character to sbuf.void
reset()
Deprecated.void
reset
(int pos) void
Deprecated.void
reset
(Lexer.SavePoint savePoint) protected final void
protected final void
scanChar()
void
void
protected final void
void
protected void
void
void
final SQLType
final SQLType
protected void
protected final void
protected final void
void
protected void
void
setAllowComment
(boolean allowComment) void
setCommentHandler
(Lexer.CommentHandler commentHandler) void
setKeepComments
(boolean keepComments) void
setTimeZone
(TimeZone timeZone) void
void
final boolean
skipToNextLine
(int startPosition) final boolean
skipToNextLineOrParameter
(int startPosition) final String
The value of a literal token, recorded as a string.final char[]
sub_chars
(int offset, int count) final String
subString
(int offset, int count) final Token
token()
Return the current token, set by nextToken().protected void
unscan()
-
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
-
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() -
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
-