Package antlr.collections.impl

Examples of antlr.collections.impl.Vector


    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


    /**
     * 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

     */
    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

  /** 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

    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("_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

    // genHeader();
    // Do not use printAction because we assume tabs==0
    // println(behavior.getHeaderAction(""));

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

    // Do special tokens manually
    println("SKIP                = antlr.SKIP");
    println("INVALID_TYPE        = antlr.INVALID_TYPE");
    println("EOF_TYPE            = antlr.EOF_TYPE");
    println("EOF                 = antlr.EOF");
    println("NULL_TREE_LOOKAHEAD = antlr.NULL_TREE_LOOKAHEAD");
    println("MIN_USER_TYPE       = antlr.MIN_USER_TYPE");

    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
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

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.