📄 sqllexer.lex
字号:
SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {commentstart} { nextState = COMMENT; commentBuffer.setLength(0); commentBuffer.append(yytext()); commentNestCount = 1; commentStartLine = yyline; commentStartChar = yychar; yybegin(nextState);}<COMMENT> {commentstart} { nextState = COMMENT; commentBuffer.append(yytext()); commentNestCount++; yybegin(nextState);}<COMMENT> {commenttext} { nextState = COMMENT; commentBuffer.append(yytext()); yybegin(nextState);}<COMMENT> {commentend} { commentNestCount--; commentBuffer.append(yytext()); if (commentNestCount == 0){ nextState = YYINITIAL; lastToken = SQLToken.COMMENT_TRADITIONAL; SQLToken t = (new SQLToken(lastToken,commentBuffer.toString(),commentStartLine,commentStartChar,commentStartChar+commentBuffer.length(),nextState)); yybegin(nextState); return(t); } }<COMMENT> <<EOF>> { nextState = YYINITIAL; lastToken = SQLToken.ERROR_UNCLOSED_COMMENT; SQLToken t = (new SQLToken(lastToken,commentBuffer.toString(),commentStartLine,commentStartChar,commentStartChar+commentBuffer.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {keyword} { nextState = YYINITIAL; lastToken = SQLToken.RESERVED_WORD; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {separator} { nextState = YYINITIAL; lastToken = SQLToken.SEPARATOR; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {operator} { nextState = YYINITIAL; lastToken = SQLToken.OPERATOR; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {bitstring} { nextState = YYINITIAL; lastToken = SQLToken.LITERAL_BIT_STRING; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {bitstringerror1} { nextState = YYINITIAL; lastToken = SQLToken.ERROR_UNCLOSED_BIT_STRING; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {bitstringerror2} { nextState = YYINITIAL; lastToken = SQLToken.ERROR_BAD_BIT_STRING; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {identifier} { nextState = YYINITIAL; lastToken = SQLToken.IDENTIFIER; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {integer} { nextState = YYINITIAL; lastToken = SQLToken.LITERAL_INTEGER; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {string} { nextState = YYINITIAL; lastToken = SQLToken.LITERAL_STRING; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {stringerror} { nextState = YYINITIAL; lastToken = SQLToken.ERROR_UNCLOSED_STRING; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {floatpoint} { nextState = YYINITIAL; lastToken = SQLToken.LITERAL_FLOAT; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL> {whitespace}* { nextState = YYINITIAL; lastToken = SQLToken.WHITE_SPACE; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}<YYINITIAL, COMMENT> [^] { nextState = YYINITIAL; lastToken = SQLToken.ERROR; String text = yytext(); SQLToken t = (new SQLToken(lastToken,text,yyline,yychar,yychar+text.length(),nextState)); yybegin(nextState); return(t);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -