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

    /** Walk the tree looking for all exact subtree matches.  Return
     *  an ASTEnumerator that lets the caller walk the list
     *  of subtree roots found herein.
     */
    public ASTEnumeration findAll(AST target) {
        Vector roots = new Vector(10);
        AST sibling;

        // the empty tree cannot result in an enumeration
        if (target == null) {
            return null;
View Full Code Here

    /** Walk the tree looking for all subtrees.  Return
     *  an ASTEnumerator that lets the caller walk the list
     *  of subtree roots found herein.
     */
    public ASTEnumeration findAllPartial(AST sub) {
        Vector roots = new Vector(10);
        AST sibling;

        // the empty tree cannot result in an enumeration
        if (sub == null) {
            return null;
View Full Code Here

    protected Vector handlers;


    public ExceptionSpec(Token label_) {
        label = label_;
        handlers = new Vector();
    }
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

    /** Construct a named rule. */
    public RuleBlock(Grammar g, String r) {
        super(g);
        ruleName = r;
        labeledElements = new Vector();
        cache = new Lookahead[g.maxk + 1];
        exceptionSpecs = new Hashtable();
        setAutoGen(g instanceof ParserGrammar);
    }
View Full Code Here

            }
            else {
                if (r.access.equals("public")) {
          Alternative alt = new Alternative(); // create alt we'll add to ref rule
          RuleBlock targetRuleBlock = r.getBlock();
          Vector targetRuleAlts = targetRuleBlock.getAlternatives();
          // collect a sem pred if only one alt and it's at the start;
          // simple, but faster to implement until real hoisting
          if ( targetRuleAlts!=null && targetRuleAlts.size()==1 ) {
            Alternative onlyAlt = (Alternative)targetRuleAlts.elementAt(0);
            if ( onlyAlt.semPred!=null ) {
              // ok, has sem pred, make this rule ref alt have a pred
              alt.semPred = onlyAlt.semPred;
              // REMOVE predicate from target rule???  NOPE, another
              // rule other than nextToken() might invoke it.
View Full Code Here

     *  of the elements.
     */
    public static Vector parseSeparatedList(String list, char separator) {
        java.util.StringTokenizer st =
    new java.util.StringTokenizer(list, String.valueOf(separator));
        Vector v = new Vector(10);
        while ( st.hasMoreTokens() ) {
             v.appendElement(st.nextToken());
        }
        if (v.size() == 0) return null;
        return v;
    }
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

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.