⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rstringliteral.java

📁 java 编译器java复杂编译器,可以编译java文件的类库
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
     ostr.println("   jjmatchedKind = kind;");     ostr.println("   jjmatchedPos = pos;");     if (Options.B("DEBUG_TOKEN_MANAGER"))     {        ostr.println("   debugStream.println(\"   No more string literal token matches are possible.\");");        ostr.println("   debugStream.println(\"   Currently matched the first \" + (jjmatchedPos + 1) + \" characters as a \" + tokenImage[jjmatchedKind] + \" token.\");");     }     ostr.println("   try { curChar = input_stream.readChar(); }");     ostr.println("   catch(java.io.IOException e) { return pos + 1; }");     if (Options.B("DEBUG_TOKEN_MANAGER"))        ostr.println("   debugStream.println(" + (LexGen.maxLexStates > 1 ? "\"<\" + lexStateNames[curLexState] + \">\" + " : "") + "\"Current character : \" + " +                 "TokenMgrError.addEscapes(String.valueOf(curChar)) + \" (\" + (int)curChar + \")\");");     ostr.println("   return jjMoveNfa" + LexGen.lexStateSuffix + "(state, pos + 1);");     ostr.println("}");  }  private static boolean boilerPlateDumped = false;  static void DumpBoilerPlate(java.io.PrintWriter ostr)  {     ostr.println((Options.B("STATIC") ? "static " : "") + "private final int " +                  "jjStopAtPos(int pos, int kind)");     ostr.println("{");     ostr.println("   jjmatchedKind = kind;");     ostr.println("   jjmatchedPos = pos;");     if (Options.B("DEBUG_TOKEN_MANAGER"))     {        ostr.println("   debugStream.println(\"   No more string literal token matches are possible.\");");        ostr.println("   debugStream.println(\"   Currently matched the first \" + (jjmatchedPos + 1) + \" characters as a \" + tokenImage[jjmatchedKind] + \" token.\");");     }     ostr.println("   return pos + 1;");     ostr.println("}");  }  static String[] ReArrange(Hashtable tab)  {     String[] ret = new String[tab.size()];     Enumeration e = tab.keys();     int cnt = 0;     while (e.hasMoreElements())     {        int i = 0, j;        String s;        char c = (s = (String)e.nextElement()).charAt(0);        while (i < cnt && ret[i].charAt(0) < c) i++;        if (i < cnt)           for (j = cnt - 1; j >= i; j--)             ret[j + 1] = ret[j];        ret[i] = s;        cnt++;     }     return ret;  }  static void DumpDfaCode(java.io.PrintWriter ostr)  {     Hashtable tab;     String key;     KindInfo info;     int maxLongsReqd = maxStrKind / 64 + 1;     int i, j, k;     boolean ifGenerated;     LexGen.maxLongsReqd[LexGen.lexStateIndex] = maxLongsReqd;     if (maxLen == 0)     {        ostr.println((Options.B("STATIC") ? "static " : "") + "private final int " +                       "jjMoveStringLiteralDfa0" + LexGen.lexStateSuffix + "()");        DumpNullStrLiterals(ostr);        return;     }     if (!boilerPlateDumped)     {        DumpBoilerPlate(ostr);        boilerPlateDumped = true;     }     if (!LexGen.mixed[LexGen.lexStateIndex] && NfaState.generatedStates != 0)        DumpStartWithStates(ostr);     boolean startNfaNeeded;     boolean returnLoopNeeded;     for (i = 0; i < maxLen; i++)     {        boolean atLeastOne = false;        startNfaNeeded = false;        returnLoopNeeded = false;        tab = (Hashtable)charPosKind.elementAt(i);        String[] keys = ReArrange(tab);        ostr.print((Options.B("STATIC") ? "static " : "") + "private final int " +                       "jjMoveStringLiteralDfa" + i + LexGen.lexStateSuffix + "(");        if (i != 0)        {           if (i == 1)           {              for (j = 0; j < maxLongsReqd - 1; j++)                 if (i <= maxLenForActive[j])                 {                    if (atLeastOne)                       ostr.print(", ");                    else                       atLeastOne = true;                    ostr.print("long active" + j);                 }              if (i <= maxLenForActive[j])              {                 if (atLeastOne)                    ostr.print(", ");                 ostr.print("long active" + j);              }           }           else           {              for (j = 0; j < maxLongsReqd - 1; j++)                 if (i <= maxLenForActive[j] + 1)                 {                    if (atLeastOne)                       ostr.print(", ");                    else                       atLeastOne = true;                    ostr.print("long old" + j + ", long active" + j);                 }              if (i <= maxLenForActive[j] + 1)              {                 if (atLeastOne)                    ostr.print(", ");                 ostr.print("long old" + j + ", long active" + j);              }           }        }        ostr.println(")");        ostr.println("{");        if (i != 0)        {           if (i > 1)           {              atLeastOne = false;              ostr.print("   if ((");              for (j = 0; j < maxLongsReqd - 1; j++)                 if (i <= maxLenForActive[j] + 1)                 {                    if (atLeastOne)                       ostr.print(" | ");                    else                       atLeastOne = true;                    ostr.print("(active" + j + " &= old" + j + ")");                 }              if (i <= maxLenForActive[j] + 1)              {                 if (atLeastOne)                    ostr.print(" | ");                 ostr.print("(active" + j + " &= old" + j + ")");              }              ostr.println(") == 0L)");              if (!LexGen.mixed[LexGen.lexStateIndex] && NfaState.generatedStates != 0)              {                 ostr.print("      return jjStartNfa" + LexGen.lexStateSuffix +                                 "(" + (i - 2) + ", ");                 for (j = 0; j < maxLongsReqd - 1; j++)                    if (i <= maxLenForActive[j] + 1)                       ostr.print("old" + j + ", ");                    else                       ostr.print("0L, ");                 if (i <= maxLenForActive[j] + 1)                    ostr.println("old" + j + "); ");                 else                    ostr.println("0L);");              }              else if (NfaState.generatedStates != 0)                 ostr.println("      return jjMoveNfa" + LexGen.lexStateSuffix + "(" + NfaState.InitStateName() + ", " + (i - 1) + ");");              else                 ostr.println("      return " + i + ";");           }           if (i != 0 && Options.B("DEBUG_TOKEN_MANAGER"))           {              ostr.println("   if (jjmatchedKind != 0 && jjmatchedKind != 0x" + Integer.toHexString(Integer.MAX_VALUE) + ")");              ostr.println("      debugStream.println(\"   Currently matched the first \" + (jjmatchedPos + 1) + \" characters as a \" + tokenImage[jjmatchedKind] + \" token.\");");              ostr.println("   debugStream.println(\"   Possible string literal matches : { \"");              for (int vecs = 0; vecs < maxStrKind / 64 + 1; vecs++)              {                 if (i <= maxLenForActive[vecs])                 {                    ostr.println(" + ");                    ostr.print("         jjKindsForBitVector(" + vecs + ", ");                    ostr.print("active" + vecs + ") ");                 }              }              ostr.println(" + \" } \");");           }           ostr.println("   try { curChar = input_stream.readChar(); }");           ostr.println("   catch(java.io.IOException e) {");           if (!LexGen.mixed[LexGen.lexStateIndex] && NfaState.generatedStates != 0)           {              ostr.print("      jjStopStringLiteralDfa" + LexGen.lexStateSuffix + "(" + (i - 1) + ", ");              for (k = 0; k < maxLongsReqd - 1; k++)                 if (i <= maxLenForActive[k])                    ostr.print("active" + k + ", ");                 else                    ostr.print("0L, ");              if (i <= maxLenForActive[k])                 ostr.println("active" + k + ");");              else                 ostr.println("0L);");              if (i != 0 && Options.B("DEBUG_TOKEN_MANAGER"))              {                 ostr.println("      if (jjmatchedKind != 0 && jjmatchedKind != 0x" + Integer.toHexString(Integer.MAX_VALUE) + ")");                 ostr.println("         debugStream.println(\"   Currently matched the first \" + (jjmatchedPos + 1) + \" characters as a \" + tokenImage[jjmatchedKind] + \" token.\");");              }              ostr.println("      return " + i + ";");           }           else if (NfaState.generatedStates != 0)              ostr.println("   return jjMoveNfa" + LexGen.lexStateSuffix + "(" + NfaState.InitStateName() + ", " + (i - 1) + ");");           else              ostr.println("      return " + i + ";");           ostr.println("   }");        }        if (i != 0 && Options.B("DEBUG_TOKEN_MANAGER"))           ostr.println("   debugStream.println(" + (LexGen.maxLexStates > 1 ? "\"<\" + lexStateNames[curLexState] + \">\" + " : "") + "\"Current character : \" + " +                    "TokenMgrError.addEscapes(String.valueOf(curChar)) + \" (\" + (int)curChar + \")\");");        ostr.println("   switch(curChar)");        ostr.println("   {");        CaseLoop:        for (int q = 0; q < keys.length; q++)        {           key = keys[q];           info = (KindInfo)tab.get(key);           ifGenerated = false;           char c = (char)(key.charAt(0));           if (i == 0 && c < 128 && info.finalKindCnt != 0 &&               (NfaState.generatedStates == 0 || !NfaState.CanStartNfaUsingAscii(c)))           {              int kind;              Outer:              for (j = 0; j < maxLongsReqd; j++)                 if (info.finalKinds[j] != 0L)                    break;              for (k = 0; k < 64; k++)                 if ((info.finalKinds[j] & (1L << k)) != 0L &&                     !subString[kind = (j * 64 + k)])                 {                   if ((intermediateKinds != null &&                        intermediateKinds[(j * 64 + k)] != null &&                        intermediateKinds[(j * 64 + k)][i] < (j * 64 + k) &&                        intermediateMatchedPos != null &&                        intermediateMatchedPos[(j * 64 + k)][i] == i) ||                       (LexGen.canMatchAnyChar[LexGen.lexStateIndex] >= 0 &&                        LexGen.canMatchAnyChar[LexGen.lexStateIndex] < (j * 64 + k)))                      break;                    else if ((LexGen.toSkip[kind / 64] & (1L << (kind % 64))) != 0L  &&                             (LexGen.toSpecial[kind / 64] & (1L << (kind % 64))) == 0L  &&                             LexGen.actions[kind] == null &&                             LexGen.newLexState[kind] == null)                    {                       LexGen.AddCharToSkip(c, kind);                       if (Options.B("IGNORE_CASE"))                       {                          if (c != Character.toUpperCase(c))                             LexGen.AddCharToSkip(Character.toUpperCase(c), kind);                          if (c != Character.toLowerCase(c))                             LexGen.AddCharToSkip(Character.toLowerCase(c), kind);                       }                       continue CaseLoop;                    }                 }           }           // Since we know key is a single character ...           if (Options.B("IGNORE_CASE"))           {              if (c != Character.toUpperCase(c))                 ostr.println("      case " + (int)Character.toUpperCase(c) + ":");              if (c != Character.toLowerCase(c))                 ostr.println("      case " + (int)Character.toLowerCase(c) + ":");           }           ostr.println("      case " + (int)c + ":");           long matchedKind;           String prefix = (i == 0) ? "         " : "            ";           if (info.finalKindCnt != 0)           {              for (j = 0; j < maxLongsReqd; j++)              {                 if ((matchedKind = info.finalKinds[j]) == 0L)                    continue;                 for (k = 0; k < 64; k++)                 {                    if ((matchedKind & (1L << k)) == 0L)                       continue;                    if (ifGenerated)                    {                       ostr.print("         else if ");                    }                    else if (i != 0)                       ostr.print("         if ");                    ifGenerated = true;                    int kindToPrint;                    if (i != 0)                    {                       ostr.println("((active" + j +                          " & 0x" + Long.toHexString(1L << k) + "L) != 0L)");                    }                    if (intermediateKinds != null &&                        intermediateKinds[(j * 64 + k)] != null &&                        intermediateKinds[(j * 64 + k)][i] < (j * 64 + k) &&                        intermediateMatchedPos != null &&                        intermediateMatchedPos[(j * 64 + k)][i] == i)                    {                       JavaCCErrors.warning(" \"" +                           JavaCCGlobals.add_escapes(allImages[j * 64 + k]) +                           "\" cannot be matched as a string literal token " +                           "at line " + GetLine(j * 64 + k) + ", column " + GetColumn(j * 64 + k) +                           ". It will be matched as " +                           GetLabel(intermediateKinds[(j * 64 + k)][i]) + ".");                       kindToPrint = intermediateKinds[(j * 64 + k)][i];                    }                    else if (i == 0 &&                         LexGen.canMatchAnyChar[LexGen.lexStateIndex] >= 0 &&                         LexGen.canMatchAnyChar[LexGen.lexStateIndex] < (j * 64 + k))                    {                       JavaCCErrors.warning(" \"" +                           JavaCCGlobals.add_escapes(allImages[j * 64 + k]) +                           "\" cannot be matched as a string literal token " +                           "at line " + GetLine(j * 64 + k) + ", column " + GetColumn(j * 64 + k) +                           ". It will be matched as " +                           GetLabel(LexGen.canMatchAnyChar[LexGen.lexStateIndex]) + ".");                       kindToPrint = LexGen.canMatchAnyChar[LexGen.lexStateIndex];                    }                    else                       kindToPrint = j * 64 + k;                    if (!subString[(j * 64 + k)])                    {                       int stateSetName = GetStateSetForKind(i, j * 64 + k);                       if (stateSetName != -1)                       {                          ostr.println(prefix + "return jjStartNfaWithStates" +                              LexGen.lexStateSuffix + "(" + i +                              ", " + kindToPrint + ", " + stateSetName + ");");                       }                       else                          ostr.println(prefix + "return jjStopAtPos" + "(" + i + ", " + kindToPrint + ");");                    }                    else                    {                       if ((LexGen.initMatch[LexGen.lexStateIndex] != 0 &&                            LexGen.initMatch[LexGen.lexStateIndex] != Integer.MAX_VALUE) ||                            i != 0)                       {                          ostr.println("         {");                          ostr.println(prefix + "jjmatchedKind = " +                                                     kindToPrint + ";");                          ostr.println(prefix + "jjmatchedPos = " + i + ";");                          ostr.println("         }");                       }                       else                          ostr.println(prefix + "jjmatchedKind = " +                                                     kindToPrint + ";");                    }                 }              }           }           if (info.validKindCnt != 0)           {              atLeastOne = false;              if (i == 0)              {                 ostr.print("         return ");                 ostr.print("jjMoveStringLiteralDfa" + (i + 1) +                                LexGen.lexStateSuffix + "(");                 for (j = 0; j < maxLongsReqd - 1; j++)                    if ((i + 1) <= maxLenForActive[j])                    {                       if (atLeastOne)                          ostr.print(", ");                       else                          atLeastOne = true;                       ostr.print("0x" + Long.toHexString(info.validKinds[j]) + "L");                    }                 if ((i + 1) <= maxLenForActive[j])                 {                    if (atLeastOne)                       ostr.print(", ");                    ostr.print("0x" + Long.toHexString(info.validKinds[j]) + "L");                 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -