📄 wikipediatokenizerimpl.java
字号:
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; } /** * 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 int getNextToken() 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; yychar+= zzMarkedPosL-zzStartRead; 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 7: { /* ignore */ } case 44: break; case 3: { positionInc = 1; return CJ; } case 45: break; case 28: { numBalanced = 0;currentTokType = ALPHANUM; yybegin(YYINITIAL);/*end italics*/ } case 46: break; case 9: { numLinkToks = 0; positionInc = 0; yybegin(YYINITIAL); } case 47: break; case 4: { positionInc = 1; currentTokType = EXTERNAL_LINK_URL; yybegin(EXTERNAL_LINK_STATE); } case 48: break; case 39: { numBalanced = 0;currentTokType = ALPHANUM; yybegin(YYINITIAL);/*end bold italics*/ } case 49: break; case 11: { currentTokType = ITALICS; yybegin(STRING); return currentTokType;/*italics*/ } case 50: break; case 23: { positionInc = 1; currentTokType = INTERNAL_LINK; yybegin(INTERNAL_LINK_STATE); } case 51: break; case 5: { yybegin(CATEGORY_STATE); return currentTokType; } case 52: break; case 36: { numBalanced = 0;currentTokType = ALPHANUM; yybegin(YYINITIAL);/*end sub header*/ } case 53: break; case 8: { if (numLinkToks == 0){positionInc = 0;} else{positionInc = 1;} currentTokType = EXTERNAL_LINK; yybegin(EXTERNAL_LINK_STATE); numLinkToks++; return currentTokType; } case 54: break; case 24: { positionInc = 1; currentTokType = CITATION; yybegin(DOUBLE_BRACE_STATE); } case 55: break; case 22: { positionInc = 1; yybegin(DOUBLE_EQUALS_STATE); } case 56: break; case 41: { positionInc = 1; currentTokType = CATEGORY; yybegin(CATEGORY_STATE); } case 57: break; case 18: { yybegin(STRING); return currentTokType;/* STRING ALPHANUM*/ } case 58: break; case 21: { positionInc = 1; if (numBalanced == 0){numBalanced++;yybegin(TWO_SINGLE_QUOTES_STATE);} else{numBalanced = 0;} } case 59: break; case 1: { positionInc = 1; } case 60: break; case 43: { numBalanced = 0;currentTokType = CATEGORY;yybegin(CATEGORY_STATE); } case 61: break; case 25: { yybegin(YYINITIAL); } case 62: break; case 40: { positionInc = 1; yybegin(EXTERNAL_LINK_STATE); return currentTokType; } case 63: break; case 19: { numBalanced = 0;currentTokType = EXTERNAL_LINK;yybegin(EXTERNAL_LINK_STATE); } case 64: break; case 13: { yybegin(STRING);return currentTokType; } case 65: break; case 38: { positionInc = 1; return EMAIL; } case 66: break; case 37: { positionInc = 1; return ACRONYM; } case 67: break; case 17: { /* ignore STRING */ } case 68: break; case 42: { currentTokType = CATEGORY;yybegin(CATEGORY_STATE); } case 69: break; case 20: { yybegin(STRING); return currentTokType;/*pipe*/ } case 70: break; case 12: { currentTokType = EXTERNAL_LINK;yybegin(EXTERNAL_LINK_STATE); } case 71: break; case 29: { numBalanced = 0;currentTokType = INTERNAL_LINK;yybegin(INTERNAL_LINK_STATE); } case 72: break; case 35: { numBalanced = 0;currentTokType = ALPHANUM;yybegin(YYINITIAL);/*end bold*/ } case 73: break; case 16: { yybegin(DOUBLE_BRACE_STATE); return currentTokType; } case 74: break; case 31: { positionInc = 1; return HOST; } case 75: break; case 34: { currentTokType = BOLD_ITALICS; yybegin(FIVE_SINGLE_QUOTES_STATE); } case 76: break; case 27: { currentTokType = INTERNAL_LINK;yybegin(INTERNAL_LINK_STATE); } case 77: break; case 14: { currentTokType = SUB_HEADING; yybegin(STRING); } case 78: break; case 30: { positionInc = 1; return APOSTROPHE; } case 79: break; case 32: { positionInc = 1; return NUM; } case 80: break; case 15: { currentTokType = HEADING; yybegin(DOUBLE_EQUALS_STATE); return currentTokType; } case 81: break; case 6: { yybegin(INTERNAL_LINK_STATE); return currentTokType; } case 82: break; case 2: { positionInc = 1; return ALPHANUM; } case 83: break; case 33: { positionInc = 1; return COMPANY; } case 84: break; case 10: { currentTokType = BOLD; yybegin(THREE_SINGLE_QUOTES_STATE); } case 85: break; case 26: { numLinkToks = 0; yybegin(YYINITIAL); } case 86: break; default: if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { zzAtEOF = true; return YYEOF; } else { zzScanError(ZZ_NO_MATCH); } } } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -