📄 sql92scanner.java
字号:
return true; } else { zzEndRead+= numRead; return false; } } /** * Closes the input stream. */ public final void yyclose() throws java.io.IOException { zzAtEOF = true; /* indicate end of file */ zzEndRead = zzStartRead; /* invalidate buffer */ if (zzReader != null) zzReader.close(); } /** * Resets the scanner to read from a new input stream. * Does not close the old reader. * * All internal variables are reset, the old input stream * <b>cannot</b> be reused (internal buffer is discarded and lost). * Lexical state is set to <tt>ZZ_INITIAL</tt>. * * @param reader the new input stream */ public final void yyreset(java.io.Reader reader) { zzReader = reader; zzAtBOL = true; zzAtEOF = false; zzEndRead = zzStartRead = 0; zzCurrentPos = zzMarkedPos = zzPushbackPos = 0; yyline = yychar = yycolumn = 0; zzLexicalState = YYINITIAL; } /** * Returns the current lexical state. */ public final int yystate() { return zzLexicalState; } /** * Enters a new lexical state * * @param newState the new lexical state */ public final void yybegin(int newState) { zzLexicalState = newState; } /** * Returns the text matched by the current regular expression. */ public final String yytext() { return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead ); } /** * Returns the character at position <tt>pos</tt> from the * matched text. * * It is equivalent to yytext().charAt(pos), but faster * * @param pos the position of the character to fetch. * A value from 0 to yylength()-1. * * @return the character at position pos */ public final char yycharat(int pos) { return zzBuffer[zzStartRead+pos]; } /** * Returns the length of the matched text region. */ public final int yylength() { return zzMarkedPos-zzStartRead; } /** * Reports an error that occured while scanning. * * In a wellformed scanner (no or only correct usage of * yypushback(int) and a match-all fallback rule) this method * will only be called with things that "Can't Possibly Happen". * If this method is called, something is seriously wrong * (e.g. a JFlex bug producing a faulty scanner etc.). * * Usual syntax/scanner level error handling should be done * in error fallback rules. * * @param errorCode the code of the errormessage to display */ private void zzScanError(int errorCode) { String message; try { message = ZZ_ERROR_MSG[errorCode]; } catch (ArrayIndexOutOfBoundsException e) { message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; } throw new Error(message); } /** * Pushes the specified amount of characters back into the input stream. * * They will be read again by then next call of the scanning method * * @param number the number of characters to be read again. * This number must not be greater than yylength()! */ public void yypushback(int number) { if ( number > yylength() ) zzScanError(ZZ_PUSHBACK_2BIG); zzMarkedPos -= number; } /** * Contains user EOF-code, which will be executed exactly once, * when the end of file is reached */ private void zzDoEOF() throws java.io.IOException { if (!zzEOFDone) { zzEOFDone = true; yyclose(); } } /** * Resumes scanning until the next regular expression is matched, * the end of input is encountered or an I/O-Error occurs. * * @return the next token * @exception java.io.IOException if any I/O-Error occurs */ public java_cup.runtime.Symbol next_token() throws java.io.IOException { int zzInput; int zzAction; // cached fields: int zzCurrentPosL; int zzMarkedPosL; int zzEndReadL = zzEndRead; char [] zzBufferL = zzBuffer; char [] zzCMapL = ZZ_CMAP; int [] zzTransL = ZZ_TRANS; int [] zzRowMapL = ZZ_ROWMAP; int [] zzAttrL = ZZ_ATTRIBUTE; while (true) { zzMarkedPosL = zzMarkedPos; boolean zzR = false; for (zzCurrentPosL = zzStartRead; zzCurrentPosL < zzMarkedPosL; zzCurrentPosL++) { switch (zzBufferL[zzCurrentPosL]) { case '\u000B': case '\u000C': case '\u0085': case '\u2028': case '\u2029': yyline++; yycolumn = 0; zzR = false; break; case '\r': yyline++; yycolumn = 0; zzR = true; break; case '\n': if (zzR) zzR = false; else { yyline++; yycolumn = 0; } break; default: zzR = false; yycolumn++; } } if (zzR) { // peek one character ahead if it is \n (if we have counted one line too much) boolean zzPeek; if (zzMarkedPosL < zzEndReadL) zzPeek = zzBufferL[zzMarkedPosL] == '\n'; else if (zzAtEOF) zzPeek = false; else { boolean eof = zzRefill(); zzMarkedPosL = zzMarkedPos; zzBufferL = zzBuffer; if (eof) zzPeek = false; else zzPeek = zzBufferL[zzMarkedPosL] == '\n'; } if (zzPeek) yyline--; } zzAction = -1; zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; zzState = zzLexicalState; zzForAction: { while (true) { if (zzCurrentPosL < zzEndReadL) zzInput = zzBufferL[zzCurrentPosL++]; else if (zzAtEOF) { zzInput = YYEOF; break zzForAction; } else { // store back cached positions zzCurrentPos = zzCurrentPosL; zzMarkedPos = zzMarkedPosL; boolean eof = zzRefill(); // get translated positions and possibly new buffer zzCurrentPosL = zzCurrentPos; zzMarkedPosL = zzMarkedPos; zzBufferL = zzBuffer; zzEndReadL = zzEndRead; if (eof) { zzInput = YYEOF; break zzForAction; } else { zzInput = zzBufferL[zzCurrentPosL++]; } } int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; if (zzNext == -1) break zzForAction; zzState = zzNext; int zzAttributes = zzAttrL[zzState]; if ( (zzAttributes & 1) == 1 ) { zzAction = zzState; zzMarkedPosL = zzCurrentPosL; if ( (zzAttributes & 8) == 8 ) break zzForAction; } } } // store back cached position zzMarkedPos = zzMarkedPosL; switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { case 8: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" * "); return symbol(Sql92Symbols.TIMES); } case 32: break; case 28: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" LIKE "); return symbol(Sql92Symbols.LIKE); } case 33: break; case 1: { throw new Error(this.logBuffer.toString() + " Illegal character <"+yytext()+">"); } case 34: break; case 22: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" != "); return symbol(Sql92Symbols.DIFF); } case 35: break; case 31: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" BETWEEN "); return symbol(Sql92Symbols.BETWEEN); } case 36: break; case 17: { this.stringBf.append( yytext() ); } case 37: break; case 30: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" ESCAPE "); return symbol(Sql92Symbols.ESCAPE); } case 38: break; case 20: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" => "); return symbol(Sql92Symbols.GET); } case 39: break; case 2: { /* just skip what was found, do nothing */ } case 40: break; case 14: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" < "); return symbol(Sql92Symbols.LT); } case 41: break; case 13: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" = "); return symbol(Sql92Symbols.EQUAL); } case 42: break; case 26: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" ! "); return symbol(Sql92Symbols.NOT); } case 43: break; case 19: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" || "); return symbol(Sql92Symbols.OR); } case 44: break; case 12: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" , "); return symbol(Sql92Symbols.COMMA); } case 45: break; case 5: { yybegin(CONST_STRING); this.stringBf.setLength(0); } case 46: break; case 29: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" NULL "); return symbol(Sql92Symbols.REGEX); } case 47: break; case 23: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" IN "); return symbol(Sql92Symbols.IN); } case 48: break; case 21: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" <= "); return symbol(Sql92Symbols.LET); } case 49: break; case 11: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" ) "); return symbol(Sql92Symbols.R_BRACKET); } case 50: break; case 27: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" NULL "); return symbol(Sql92Symbols.NULL); } case 51: break; case 25: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" && "); return symbol(Sql92Symbols.AND); } case 52: break; case 24: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" IS "); return symbol(Sql92Symbols.IS); } case 53: break; case 4: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(yytext()); return symbol(Sql92Symbols.NUMBER, new Double(yytext())); } case 54: break; case 6: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" - "); return symbol(Sql92Symbols.MINUS); } case 55: break; case 9: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" / "); return symbol(Sql92Symbols.DIV); } case 56: break; case 15: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" > "); return symbol(Sql92Symbols.GT); } case 57: break; case 3: { return symbolFromProperty(yytext()); } case 58: break; case 10: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" ( "); return symbol(Sql92Symbols.L_BRACKET); } case 59: break; case 7: { if (log.isLoggable(Level.FINE)) this.logBuffer.append(" + "); return symbol(Sql92Symbols.PLUS); } case 60: break; case 18: { yybegin(YYINITIAL); String tmp = this.stringBf.toString(); if (log.isLoggable(Level.FINE)) this.logBuffer.append(tmp).append("(string litteral)"); return symbol(Sql92Symbols.STRING, tmp); } case 61: break; case 16: { } case 62: break; default: if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { zzAtEOF = true; zzDoEOF(); { return new java_cup.runtime.Symbol(sym.EOF); } } else { zzScanError(ZZ_NO_MATCH); } } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -