Package antlr.collections.impl

Examples of antlr.collections.impl.Vector


    println("const char* " + prefix + "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("<") ) {
View Full Code Here


    tabs++;
    println("enum {");
    tabs++;

    // Generate a definition for each token type
    Vector v = tm.getVocabulary();

    // Do special tokens manually
    println("EOF_ = " + Token.EOF_TYPE + ",");

    // Move the other special token to the end, so we can solve
    // the superfluous comma problem easily

    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

    public Grammar(String className_, Tool tool_, String superClass) {
        className = className_;
        antlrTool = tool_;
        symbols = new Hashtable();
        options = new Hashtable();
        rules = new Vector(100);
        this.superClass = superClass;
    }
View Full Code Here

            }
            else {
                // Must be the grammar file
                grammarFileName = incomingArgs[i];
                if (grammars == null) {
                    grammars = new Vector(10);
                }
                grammars.appendElement(grammarFileName)// process it too
                if ((i + 1) < incomingArgs.length) {
                    antlrTool.warning("grammar file must be last; ignoring other arguments...");
                    break;
View Full Code Here

     */
    public boolean deterministicImpliedPath(BlockWithImpliedExitPath blk) {
        /** The lookahead depth for this decision considering implied exit path */
        int k;
        boolean det = true;
        Vector alts = blk.getAlternatives();
        int nalts = alts.size();
        currentBlock.altj = -1// comparing against implicit optional/exit alt

        if (DEBUG_ANALYZER) System.out.println("deterministicImpliedPath");
        for (int i = 0; i < nalts; i++) {    // check follow against all alts
            Alternative alt = blk.getAlternativeAt(i);
View Full Code Here

    /**
     * IndexedVector constructor comment.
     */
    public IndexedVector() {
        elements = new Vector(10);
        index = new Hashtable(10);
    }
View Full Code Here

    /**
     * IndexedVector constructor comment.
     * @param size int
     */
    public IndexedVector(int size) {
        elements = new Vector(size);
        index = new Hashtable(size);
    }
View Full Code Here

  }
  /** Generate the lexer CSharp file */
  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("factory.setMaxNodeType("+g.tokenManager.maxTokenType()+");");

          // Walk the token vocabulary and generate code to register every TokenID->ASTNodeType
          // mapping specified in the  tokens {...} section with the ASTFactory.
      Vector v = g.tokenManager.getVocabulary();
      for (int i = 0; i < v.size(); i++) {
        String s = (String)v.elementAt(i);
        if (s != null) {
          TokenSymbol ts = g.tokenManager.getTokenSymbol(s);
          if (ts != null && ts.getASTNodeType() != null) {
            println("factory.setTokenTypeASTNodeType(" + s + ", \"" + ts.getASTNodeType() + "\");");
          }
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.