public void CheckUnmatchability() {
    RegularExpression curRE;
    int numStrings = 0;

    for (int i = 0; i < getChoices().size(); i++) {
      if (!(curRE = (RegularExpression) getChoices().get(i)).private_rexp
          &&
          // curRE instanceof RJustName &&
          curRE.ordinal > 0
          && curRE.ordinal < ordinal
          && LexGen.lexStates[curRE.ordinal] == LexGen.lexStates[ordinal]) {
        if (label != null)
          JavaCCErrors.warning(
              this,
              "Regular Expression choice : " + curRE.label + " can never be matched as : " + label);
        else
          JavaCCErrors.warning(
              this,
              "Regular Expression choice : "
                  + curRE.label
                  + " can never be matched as token of kind : "
                  + ordinal);
      }

      if (!curRE.private_rexp && curRE instanceof RStringLiteral) numStrings++;
    }
  }
 protected static void addregexpr(final TokenProduction p) {
   Integer ii;
   rexprlist.add(p);
   if (Options.getUserTokenManager()) {
     if (p.lexStates == null || p.lexStates.length != 1 || !p.lexStates[0].equals("DEFAULT")) {
       JavaCCErrors.warning(
           p,
           "Ignoring lexical state specifications since option "
               + "USER_TOKEN_MANAGER has been set to true.");
     }
   }
   if (p.lexStates == null) {
     return;
   }
   for (int i = 0; i < p.lexStates.length; i++) {
     for (int j = 0; j < i; j++) {
       if (p.lexStates[i].equals(p.lexStates[j])) {
         JavaCCErrors.parse_error(
             p, "Multiple occurrence of \"" + p.lexStates[i] + "\" in lexical state list.");
       }
     }
     if (lexstate_S2I.get(p.lexStates[i]) == null) {
       ii = new Integer(nextFreeLexState++);
       lexstate_S2I.put(p.lexStates[i], ii);
       lexstate_I2S.put(ii, p.lexStates[i]);
       simple_tokens_table.put(p.lexStates[i], new java.util.Hashtable());
     }
   }
 }
 protected static void add_token_manager_decls(final Token t, final java.util.List decls) {
   if (token_mgr_decls != null) {
     JavaCCErrors.parse_error(t, "Multiple occurrence of \"TOKEN_MGR_DECLS\".");
   } else {
     token_mgr_decls = decls;
     if (Options.getUserTokenManager()) {
       JavaCCErrors.warning(
           t,
           "Ignoring declarations in \"TOKEN_MGR_DECLS\" since option "
               + "USER_TOKEN_MANAGER has been set to true.");
     }
   }
 }
Beispiel #4
0
  public static void createOutputDir(File outputDir) {
    if (!outputDir.exists()) {
      JavaCCErrors.warning(
          "Output directory \"" + outputDir + "\" does not exist. Creating the directory.");

      if (!outputDir.mkdirs()) {
        JavaCCErrors.semantic_error("Cannot create the output directory : " + outputDir);
        return;
      }
    }

    if (!outputDir.isDirectory()) {
      JavaCCErrors.semantic_error("\"" + outputDir + " is not a valid output directory.");
      return;
    }

    if (!outputDir.canWrite()) {
      JavaCCErrors.semantic_error(
          "Cannot write to the output output directory : \"" + outputDir + "\"");
      return;
    }
  }