Package antlr.collections.impl

Examples of antlr.collections.impl.Vector


            }
            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


    /** Parse a list such as "f1.g;f2.g;..." and return a Vector
     *  of the elements.
     */
    public static Vector parseSeparatedList(String list, char separator) {
        Vector v = new Vector(10);
        StringBuffer buf = new StringBuffer(100);
        int i = 0;
        while (i < list.length()) {
            while (i < list.length() && list.charAt(i) != separator) {
                buf.append(list.charAt(i));
                i++;
            }
            // add element to vector
            v.appendElement(buf.toString());
            buf.setLength(0);
            // must be a separator or finished.
            if (i < list.length()) {
                // not done?
                i++;    // skip separator
            }
        }
        if (v.size() == 0) return null;
        return v;
    }
View Full Code Here

    String access;  // access specifier for this rule
    String comment;  // A javadoc comment if any.

    public RuleSymbol(String r) {
        super(r);
        references = new Vector();
    }
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

        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

    Token t=null;
    Token t2=null;
   
      StringBuffer buf = new StringBuffer();
      int n=0;
      Vector terms = new Vector(10);
   
   
    _saveIndex=text.length();
    match('(');
    text.setLength(_saveIndex);
    {
    switch ( LA(1)) {
    case '\t'case '\n'case '\r'case ' ':
    {
      _saveIndex=text.length();
      mWS(false);
      text.setLength(_saveIndex);
      break;
    }
    case '"'case '#'case '('case 'A':
    case 'B'case 'C'case 'D'case 'E':
    case 'F'case 'G'case 'H'case 'I':
    case 'J'case 'K'case 'L'case 'M':
    case 'N'case 'O'case 'P'case 'Q':
    case 'R'case 'S'case 'T'case 'U':
    case 'V'case 'W'case 'X'case 'Y':
    case 'Z'case '['case '_'case 'a':
    case 'b'case 'c'case 'd'case 'e':
    case 'f'case 'g'case 'h'case 'i':
    case 'j'case 'k'case 'l'case 'm':
    case 'n'case 'o'case 'p'case 'q':
    case 'r'case 's'case 't'case 'u':
    case 'v'case 'w'case 'x'case 'y':
    case 'z':
    {
      break;
    }
    default:
    {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    }
    _saveIndex=text.length();
    mTREE_ELEMENT(true);
    text.setLength(_saveIndex);
    t=_returnToken;
   
          terms.appendElement(
            generator.processStringForASTConstructor(t.getText())
                       );
       
    {
    switch ( LA(1)) {
    case '\t'case '\n'case '\r'case ' ':
    {
      _saveIndex=text.length();
      mWS(false);
      text.setLength(_saveIndex);
      break;
    }
    case ')'case ',':
    {
      break;
    }
    default:
    {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    }
    {
    _loop642:
    do {
      if ((LA(1)==',')) {
        _saveIndex=text.length();
        match(',');
        text.setLength(_saveIndex);
        {
        switch ( LA(1)) {
        case '\t'case '\n'case '\r'case ' ':
        {
          _saveIndex=text.length();
          mWS(false);
          text.setLength(_saveIndex);
          break;
        }
        case '"'case '#'case '('case 'A':
        case 'B'case 'C'case 'D'case 'E':
        case 'F'case 'G'case 'H'case 'I':
        case 'J'case 'K'case 'L'case 'M':
        case 'N'case 'O'case 'P'case 'Q':
        case 'R'case 'S'case 'T'case 'U':
        case 'V'case 'W'case 'X'case 'Y':
        case 'Z'case '['case '_'case 'a':
        case 'b'case 'c'case 'd'case 'e':
        case 'f'case 'g'case 'h'case 'i':
        case 'j'case 'k'case 'l'case 'm':
        case 'n'case 'o'case 'p'case 'q':
        case 'r'case 's'case 't'case 'u':
        case 'v'case 'w'case 'x'case 'y':
        case 'z':
        {
          break;
        }
        default:
        {
          throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
        }
        }
        }
        _saveIndex=text.length();
        mTREE_ELEMENT(true);
        text.setLength(_saveIndex);
        t2=_returnToken;
       
                terms.appendElement(
                  generator.processStringForASTConstructor(t2.getText())
                              );
             
        {
        switch ( LA(1)) {
View Full Code Here

    Token t=null;
    Token t2=null;
   
      StringBuffer buf = new StringBuffer();
      int n=0;
      Vector terms = new Vector(10);
   
   
    _saveIndex=text.length();
    match('(');
    text.setLength(_saveIndex);
    {
    switch ( LA(1)) {
    case '\t'case '\n'case '\r'case ' ':
    {
      _saveIndex=text.length();
      mWS(false);
      text.setLength(_saveIndex);
      break;
    }
    case '"'case '#'case '('case 'A':
    case 'B'case 'C'case 'D'case 'E':
    case 'F'case 'G'case 'H'case 'I':
    case 'J'case 'K'case 'L'case 'M':
    case 'N'case 'O'case 'P'case 'Q':
    case 'R'case 'S'case 'T'case 'U':
    case 'V'case 'W'case 'X'case 'Y':
    case 'Z'case '['case '_'case 'a':
    case 'b'case 'c'case 'd'case 'e':
    case 'f'case 'g'case 'h'case 'i':
    case 'j'case 'k'case 'l'case 'm':
    case 'n'case 'o'case 'p'case 'q':
    case 'r'case 's'case 't'case 'u':
    case 'v'case 'w'case 'x'case 'y':
    case 'z':
    {
      break;
    }
    default:
    {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    }
    _saveIndex=text.length();
    mTREE_ELEMENT(true);
    text.setLength(_saveIndex);
    t=_returnToken;
    terms.appendElement(t.getText());
    {
    switch ( LA(1)) {
    case '\t'case '\n'case '\r'case ' ':
    {
      _saveIndex=text.length();
      mWS(false);
      text.setLength(_saveIndex);
      break;
    }
    case ')'case ',':
    {
      break;
    }
    default:
    {
      throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
    }
    }
    }
    {
    _loop141:
    do {
      if ((LA(1)==',')) {
        _saveIndex=text.length();
        match(',');
        text.setLength(_saveIndex);
        {
        switch ( LA(1)) {
        case '\t'case '\n'case '\r'case ' ':
        {
          _saveIndex=text.length();
          mWS(false);
          text.setLength(_saveIndex);
          break;
        }
        case '"'case '#'case '('case 'A':
        case 'B'case 'C'case 'D'case 'E':
        case 'F'case 'G'case 'H'case 'I':
        case 'J'case 'K'case 'L'case 'M':
        case 'N'case 'O'case 'P'case 'Q':
        case 'R'case 'S'case 'T'case 'U':
        case 'V'case 'W'case 'X'case 'Y':
        case 'Z'case '['case '_'case 'a':
        case 'b'case 'c'case 'd'case 'e':
        case 'f'case 'g'case 'h'case 'i':
        case 'j'case 'k'case 'l'case 'm':
        case 'n'case 'o'case 'p'case 'q':
        case 'r'case 's'case 't'case 'u':
        case 'v'case 'w'case 'x'case 'y':
        case 'z':
        {
          break;
        }
        default:
        {
          throw new NoViableAltForCharException((char)LA(1), getFilename(), getLine(), getColumn());
        }
        }
        }
        _saveIndex=text.length();
        mTREE_ELEMENT(true);
        text.setLength(_saveIndex);
        t2=_returnToken;
        terms.appendElement(t2.getText());
        {
        switch ( LA(1)) {
        case '\t'case '\n'case '\r'case ' ':
        {
          _saveIndex=text.length();
View Full Code Here

    /** Generate the lexer Java 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

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.