Package antlr.collections.impl

Examples of antlr.collections.impl.Vector


    try {
      defaultLine = NO_MAPPING;
          // if debugging, set up a new vector to keep track of sempred
          //   strings for this grammar
          if (g.debuggingOutput)
              semPreds = new Vector();
 
          setGrammar(g);
          if (!(grammar instanceof ParserGrammar)) {
              antlrTool.panic("Internal error generating parser");
          }
View Full Code Here


          println("public static final String[] _tokenNames = {");
          tabs++;
 
          // Walk the token vocabulary and generate a Vector of strings
          // from the tokens.
          Vector v = grammar.tokenManager.getVocabulary();
          for (int i = 0; i < v.size(); i++) {
              String s = (String)v.elementAt(i);
              if (s == null) {
                  s = "<" + String.valueOf(i) + ">";
              }
              if (!s.startsWith("\"") && !s.startsWith("<")) {
                  TokenSymbol ts = (TokenSymbol)grammar.tokenManager.getTokenSymbol(s);
                  if (ts != null && ts.getParaphrase() != null) {
                      s = StringUtils.stripFrontBack(ts.getParaphrase(), "\"", "\"");
                  }
              }
              print(charFormatter.literalString(s));
              if (i != v.size() - 1) {
                  _print(",");
              }
              _println("");
          }
 
View Full Code Here

      // if heterogeneous node known for that token T.
          tabs++;
      boolean generatedNewHashtable = false;
      int n = 0;
          // Walk the token vocabulary and generate puts.
      Vector v = grammar.tokenManager.getVocabulary();
      for (int i = 0; i < v.size(); i++) {
        String s = (String)v.elementAt(i);
        if (s != null) {
          TokenSymbol ts = grammar.tokenManager.getTokenSymbol(s);
          if (ts != null && ts.getASTNodeType() != null) {
            n++;
            if ( !generatedNewHashtable ) {
View Full Code Here

          // because they are all constants.
          println("public interface " + tm.getName() + TokenTypesFileSuffix + " {");
          tabs++;
 
          // Generate a definition for each token type
          Vector v = tm.getVocabulary();
 
          // Do special tokens manually
          println("int EOF = " + Token.EOF_TYPE + ";");
          println("int NULL_TREE_LOOKAHEAD = " + Token.NULL_TREE_LOOKAHEAD + ";");
 
          for (int i = Token.MIN_USER_TYPE; i < v.size(); i++) {
              String s = (String)v.elementAt(i);
              if (s != null) {
                  if (s.startsWith("\"")) {
                      // a string literal
                      StringLiteralSymbol sl = (StringLiteralSymbol)tm.getTokenSymbol(s);
                      if (sl == null) {
View Full Code Here

        println("token identifiers.  Some tokens are literals, and because of that");
        println("they have no identifiers.  Literals are double-quoted.");
        tabs++;

        // Enumerate all the valid token types
        Vector v = tm.getVocabulary();
        for (int i = Token.MIN_USER_TYPE; i < v.size(); i++) {
            String s = (String)v.elementAt(i);
            if (s != null) {
                println(s + " = " + i);
            }
        }
View Full Code Here

        println("token identifiers.  Some tokens are literals, and because of that");
        println("they have no identifiers.  Literals are double-quoted.");
        tabs++;

        // Enumerate all the valid token types
        Vector v = tm.getVocabulary();
        for (int i = Token.MIN_USER_TYPE; i < v.size(); i++) {
            String s = (String)v.elementAt(i);
            if (s != null) {
                println(s + " = " + i);
            }
        }
View Full Code Here

  }
  /** Generate the lexer C++ files */
  public  void gen(LexerGrammar g) throws IOException {
    // If debugging, create a new sempred vector for this grammar
    if (g.debuggingOutput)
      semPreds = new Vector();

    setGrammar(g);
    if (!(grammar instanceof LexerGrammar)) {
      antlrTool.panic("Internal error generating lexer");
    }
View Full Code Here

  public void gen(ParserGrammar g) throws IOException {

    // if debugging, set up a new vector to keep track of sempred
    //   strings for this grammar
    if (g.debuggingOutput)
      semPreds = new Vector();

    setGrammar(g);
    if (!(grammar instanceof ParserGrammar)) {
      antlrTool.panic("Internal error generating parser");
    }
View Full Code Here

    {
      println("// constructor creation turned of with 'noConstructor' option");
      println("#endif");
    }

    astTypes = new Vector();

    // Generate code for each rule in the grammar
    Enumeration ids = grammar.rules.elements();
    int ruleNum=0;
    while ( ids.hasMoreElements() ) {
View Full Code Here

      println("// constructor creation turned of with 'noConstructor' option");
      println("#endif");
    }
    println("");

    astTypes = new Vector();

    // Generate code for each rule in the grammar
    Enumeration ids = grammar.rules.elements();
    int ruleNum=0;
    String ruleNameInits = "";
View Full Code Here

TOP

Related Classes of antlr.collections.impl.Vector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.