asnparsertokenmanager.java
来自「ASN.1工具源代码,包括编译源码生成工具和各种基本类型构造类型的编解码实现代码」· Java 代码 · 共 1,745 行 · 第 1/4 页
JAVA
1,745 行
if (curChar == 82 && kind > 8) kind = 8; break; case 3: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 2; break; case 4: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 3; break; case 5: if (curChar == 70) jjstateSet[jjnewStateCnt++] = 4; break; case 6: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 5; break; case 7: if (curChar == 84) jjstateSet[jjnewStateCnt++] = 6; break; case 8: if (curChar == 78) jjstateSet[jjnewStateCnt++] = 7; break; case 9: if (curChar == 69) jjstateSet[jjnewStateCnt++] = 8; break; case 10: if (curChar == 68) jjstateSet[jjnewStateCnt++] = 9; break; case 11: if (curChar == 73) jjstateSet[jjnewStateCnt++] = 10; break; case 18: jjAddStates(6, 7); break; case 22: if ((0x7fffffe00000000L & l) == 0L) break; if (kind > 81) kind = 81; jjCheckNAddTwoStates(23, 24); break; case 24: if ((0x7fffffe07fffffeL & l) == 0L) break; if (kind > 81) kind = 81; jjCheckNAddTwoStates(23, 24); break; case 25: if ((0x7fffffeL & l) == 0L) break; if (kind > 82) kind = 82; jjCheckNAddTwoStates(26, 27); break; case 30: if (curChar == 66 && kind > 9) kind = 9; break; case 32: if ((0x7e0000007eL & l) != 0L) jjAddStates(8, 9); break; case 33: if (curChar == 72 && kind > 10) kind = 10; break; default : break; } } while(i != startsAt); } else { int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); MatchLoop: do { switch(jjstateSet[--i]) { case 18: if ((jjbitVec0[i2] & l2) != 0L) jjAddStates(6, 7); break; default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 35 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } }}private final int jjMoveStringLiteralDfa0_1(){ return jjMoveNfa_1(1, 0);}private final int jjMoveNfa_1(int startState, int curPos){ int[] nextStates; int startsAt = 0; jjnewStateCnt = 5; int i = 1; jjstateSet[0] = startState; int j, kind = 0x7fffffff; for (;;) { if (++jjround == 0x7fffffff) ReInitRounds(); if (curChar < 64) { long l = 1L << curChar; MatchLoop: do { switch(jjstateSet[--i]) { case 1: if ((0x2400L & l) != 0L) { if (kind > 6) kind = 6; } else if (curChar == 45) jjstateSet[jjnewStateCnt++] = 0; if (curChar == 13) jjstateSet[jjnewStateCnt++] = 3; break; case 0: if (curChar == 45 && kind > 6) kind = 6; break; case 2: if ((0x2400L & l) != 0L && kind > 6) kind = 6; break; case 3: if (curChar == 10 && kind > 6) kind = 6; break; case 4: if (curChar == 13) jjstateSet[jjnewStateCnt++] = 3; break; default : break; } } while(i != startsAt); } else if (curChar < 128) { long l = 1L << (curChar & 077); MatchLoop: do { switch(jjstateSet[--i]) { default : break; } } while(i != startsAt); } else { int i2 = (curChar & 0xff) >> 6; long l2 = 1L << (curChar & 077); MatchLoop: do { switch(jjstateSet[--i]) { default : break; } } while(i != startsAt); } if (kind != 0x7fffffff) { jjmatchedKind = kind; jjmatchedPos = curPos; kind = 0x7fffffff; } ++curPos; if ((i = jjnewStateCnt) == (startsAt = 5 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } }}static final int[] jjnextStates = { 29, 31, 32, 34, 1, 11, 18, 19, 32, 34, };public static final String[] jjstrLiteralImages = {"", null, null, null, null, null, null, null, null, null, null, null, null, "\60", "\56", "\54", "\173", "\175", "\50", "\51", "\133", "\135", "\74", "\55", "\72\72\75", "\174", "\73", "\72", "\124\101\107\123", "\102\117\117\114\105\101\116", "\111\116\124\105\107\105\122", "\102\111\124", "\123\124\122\111\116\107", "\117\103\124\105\124", "\116\125\114\114", "\123\105\121\125\105\116\103\105", "\117\106", "\123\105\124", "\111\115\120\114\111\103\111\124", "\103\110\117\111\103\105", "\101\116\131", "\117\120\124\111\117\116\101\114", "\104\105\106\101\125\114\124", "\103\117\115\120\117\116\105\116\124\123", "\125\116\111\126\105\122\123\101\114", "\101\120\120\114\111\103\101\124\111\117\116", "\120\122\111\126\101\124\105", "\124\122\125\105", "\106\101\114\123\105", "\102\105\107\111\116", "\105\116\104", "\104\105\106\111\116\111\124\111\117\116\123", "\105\130\120\114\111\103\111\124", "\105\116\125\115\105\122\101\124\105\104", "\105\130\120\117\122\124\123", "\111\115\120\117\122\124\123", "\122\105\101\114", "\111\116\103\114\125\104\105\123", "\115\111\116", "\115\101\130", "\123\111\132\105", "\106\122\117\115", "\127\111\124\110", "\103\117\115\120\117\116\105\116\124", "\120\122\105\123\105\116\124", "\101\102\123\105\116\124", "\104\105\106\111\116\105\104", "\102\131", "\120\114\125\123\55\111\116\106\111\116\111\124\131", "\115\111\116\125\123\55\111\116\106\111\116\111\124\131", "\117\102\112\105\103\124\55\124\131\120\105", "\123\131\116\124\101\130", "\101\103\103\105\123\123", "\123\124\101\124\125\123", "\104\105\123\103\122\111\120\124\111\117\116", "\122\105\106\105\122\105\116\103\105", "\111\116\104\105\130", "\104\105\106\126\101\114", "\104\111\123\120\114\101\131\55\110\111\116\124", "\124\105\130\124\125\101\114\55\103\117\116\126\105\116\124\111\117\116", "\115\101\103\122\117", null, null, };public static final String[] lexStateNames = { "DEFAULT", "WithinASNComment", };public static final int[] jjnewLexState = { -1, -1, -1, -1, -1, 1, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, };static final long[] jjtoToken = { 0xffffffffffffff01L, 0x7ffffL, };static final long[] jjtoSkip = { 0x7eL, 0x0L, };static final long[] jjtoSpecial = { 0x60L, 0x0L, };static final long[] jjtoMore = { 0x80L, 0x0L, };private ASCII_CharStream input_stream;private final int[] jjrounds = new int[35];private final int[] jjstateSet = new int[70];StringBuffer image;int jjimageLen;int lengthOfMatch;protected char curChar;public AsnParserTokenManager(ASCII_CharStream stream){ if (ASCII_CharStream.staticFlag) throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer."); input_stream = stream;}public AsnParserTokenManager(ASCII_CharStream stream, int lexState){ this(stream); SwitchTo(lexState);}public void ReInit(ASCII_CharStream stream){ jjmatchedPos = jjnewStateCnt = 0; curLexState = defaultLexState; input_stream = stream; ReInitRounds();}private final void ReInitRounds(){ int i; jjround = 0x80000001; for (i = 35; i-- > 0;) jjrounds[i] = 0x80000000;}public void ReInit(ASCII_CharStream stream, int lexState){ ReInit(stream); SwitchTo(lexState);}public void SwitchTo(int lexState){ if (lexState >= 2 || lexState < 0) throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE); else curLexState = lexState;}private final Token jjFillToken(){ Token t = Token.newToken(jjmatchedKind); t.kind = jjmatchedKind; String im = jjstrLiteralImages[jjmatchedKind]; t.image = (im == null) ? input_stream.GetImage() : im; t.beginLine = input_stream.getBeginLine(); t.beginColumn = input_stream.getBeginColumn(); t.endLine = input_stream.getEndLine(); t.endColumn = input_stream.getEndColumn(); return t;}int curLexState = 0;int defaultLexState = 0;int jjnewStateCnt;int jjround;int jjmatchedPos;int jjmatchedKind;public final Token getNextToken() { int kind; Token specialToken = null; Token matchedToken; int curPos = 0; EOFLoop : for (;;) { try { curChar = input_stream.BeginToken(); } catch(java.io.IOException e) { jjmatchedKind = 0; matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; return matchedToken; } image = null; jjimageLen = 0; for (;;) { switch(curLexState) { case 0: try { input_stream.backup(0); while (curChar <= 32 && (0x100002600L & (1L << curChar)) != 0L) curChar = input_stream.BeginToken(); } catch (java.io.IOException e1) { continue EOFLoop; } jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_0(); break; case 1: jjmatchedKind = 0x7fffffff; jjmatchedPos = 0; curPos = jjMoveStringLiteralDfa0_1(); if (jjmatchedPos == 0 && jjmatchedKind > 7) { jjmatchedKind = 7; } break; } if (jjmatchedKind != 0x7fffffff) { if (jjmatchedPos + 1 < curPos) input_stream.backup(curPos - jjmatchedPos - 1); if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); matchedToken.specialToken = specialToken; if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; return matchedToken; } else if ((jjtoSkip[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { if ((jjtoSpecial[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L) { matchedToken = jjFillToken(); if (specialToken == null) specialToken = matchedToken; else { matchedToken.specialToken = specialToken; specialToken = (specialToken.next = matchedToken); } SkipLexicalActions(matchedToken); } else SkipLexicalActions(null); if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; continue EOFLoop; } jjimageLen += jjmatchedPos + 1; if (jjnewLexState[jjmatchedKind] != -1) curLexState = jjnewLexState[jjmatchedKind]; curPos = 0; jjmatchedKind = 0x7fffffff; try { curChar = input_stream.readChar(); continue; } catch (java.io.IOException e1) { } } int error_line = input_stream.getEndLine(); int error_column = input_stream.getEndColumn(); String error_after = null; boolean EOFSeen = false; try { input_stream.readChar(); input_stream.backup(1); } catch (java.io.IOException e1) { EOFSeen = true; error_after = curPos <= 1 ? "" : input_stream.GetImage(); if (curChar == '\n' || curChar == '\r') { error_line++; error_column = 0; } else error_column++; } if (!EOFSeen) { input_stream.backup(1); error_after = curPos <= 1 ? "" : input_stream.GetImage(); } throw new TokenMgrError(EOFSeen, curLexState, error_line, error_column, error_after, curChar, TokenMgrError.LEXICAL_ERROR); } }}final void SkipLexicalActions(Token matchedToken){ switch(jjmatchedKind) { default : break; }}}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?