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

public class Lexer extends Object
Author:
wenshao [[email protected]]
  • Field Details

    • symbols_l2

      protected static SymbolTable symbols_l2
    • features

      protected int features
    • timeZone

      protected TimeZone timeZone
    • text

      public final String 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

      protected Token token
    • keywords

      protected Keywords keywords
    • stringVal

      protected String stringVal
    • hashLCase

      protected long hashLCase
    • hash

      protected long hash
    • commentCount

      protected int commentCount
    • comments

      protected List<String> comments
    • skipComment

      protected boolean skipComment
    • commentHandler

      protected Lexer.CommentHandler commentHandler
    • endOfComment

      protected boolean endOfComment
    • keepComments

      protected boolean keepComments
    • line

      protected int line
    • lines

      protected int lines
    • dbType

      protected DbType dbType
    • optimizedForParameterized

      protected boolean optimizedForParameterized
    • keepSourceLocation

      protected boolean keepSourceLocation
    • startPos

      protected int startPos
    • posLine

      protected int posLine
    • posColumn

      protected int posColumn
  • Constructor Details

  • Method Details

    • isKeepComments

      public boolean isKeepComments()
    • setKeepComments

      public void setKeepComments(boolean keepComments)
    • getCommentHandler

      public Lexer.CommentHandler getCommentHandler()
    • setCommentHandler

      public void setCommentHandler(Lexer.CommentHandler commentHandler)
    • charAt

      public final char charAt(int index)
    • addSymbol

      public final String addSymbol()
    • subString

      public final String subString(int offset, int count)
    • 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

      public Keywords getKeywords()
    • mark

      Deprecated.
    • markOut

      public Lexer.SavePoint markOut()
    • reset

      public void reset(Lexer.SavePoint savePoint)
    • reset

      @Deprecated public void reset()
      Deprecated.
    • reset

      public void reset(int pos)
    • scanChar

      protected final void scanChar()
    • unscan

      protected void unscan()
    • isEOF

      public boolean isEOF()
    • lexError

      protected void lexError(String key, Object... args)
      Report an error at the given position using the provided arguments.
    • token

      public final Token token()
      Return the current token, set by nextToken().
    • setToken

      public void setToken(Token token)
    • getDbType

      public final DbType getDbType()
    • info

      public String 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

      public final SQLType scanSQLType()
    • scanSQLTypeV2

      public final SQLType 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

      public String 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

      public final String stringVal()
      The value of a literal token, recorded as a string. For integers, leading 0x and 'l' suffixes are suppressed.
    • identifierEquals

      public final boolean identifierEquals(String text)
    • identifierEquals

      public final boolean identifierEquals(long hash_lower)
    • hashLCase

      public final long hashLCase()
    • readAndResetComments

      public final List<String> readAndResetComments()
    • isNegativeIntegerValue

      public final boolean isNegativeIntegerValue()
    • integerValue

      public final Number integerValue()
    • bp

      public int bp()
    • current

      public char current()
    • reset

      @Deprecated public void reset(int mark, char markChar, Token token)
      Deprecated.
    • numberString

      public final String numberString()
    • decimalValue

      public BigDecimal decimalValue()
    • numberExpr

      public SQLNumberExpr numberExpr()
    • numberExpr

      public SQLNumberExpr numberExpr(SQLObject parent)
    • numberExpr

      public SQLNumberExpr numberExpr(boolean negate)
    • hasComment

      public boolean hasComment()
    • getCommentCount

      public int getCommentCount()
    • skipToEOF

      public void skipToEOF()
    • isEndOfComment

      public boolean isEndOfComment()
    • isSafeComment

      protected boolean isSafeComment(String comment)
    • addComment

      protected void addComment(String comment)
    • getComments

      public List<String> getComments()
    • getLine

      public int getLine()
    • computeRowAndColumn

      public void computeRowAndColumn()
    • getPosLine

      public int getPosLine()
    • getPosColumn

      public int getPosColumn()
    • config

      public void config(SQLParserFeature feature, boolean state)
    • getTimeZone

      public TimeZone getTimeZone()
    • setTimeZone

      public void setTimeZone(TimeZone timeZone)
    • isEnabled

      public final boolean isEnabled(SQLParserFeature feature)
    • parameterize

      public static String parameterize(String sql, DbType dbType)
    • getSource

      public String getSource()