Package antlr

Examples of antlr.CommonAST


    SortSpecification sortSpecification = ( SortSpecification ) sortSpec;
    AST sortKey = sortSpecification.getSortKey();
    if ( IDENT_LIST == sortKey.getFirstChild().getType() ) {
      AST identList = sortKey.getFirstChild();
      AST ident = identList.getFirstChild();
      AST holder = new CommonAST();
      do {
        holder.addChild(
            createSortSpecification(
                ident,
                sortSpecification.getCollation(),
                sortSpecification.getOrdering()
            )
        );
        ident = ident.getNextSibling();
      } while ( ident != null );
      sortSpec = holder.getFirstChild();
    }
    return sortSpec;
  }
View Full Code Here


                         + ":" + lexer.getColumn() + ": "
                         + ex.getMessage());
     
    }

    CommonAST ast = (CommonAST)parser.getAST();
    if (ast != null)
      System.out.println(ast.toStringTree());
    else
      System.out.println("nothing returned");
   
  }
View Full Code Here

    SortSpecification sortSpecification = ( SortSpecification ) sortSpec;
    AST sortKey = sortSpecification.getSortKey();
    if ( IDENT_LIST == sortKey.getFirstChild().getType() ) {
      AST identList = sortKey.getFirstChild();
      AST ident = identList.getFirstChild();
      AST holder = new CommonAST();
      do {
        holder.addChild(
            createSortSpecification(
                ident,
                sortSpecification.getCollation(),
                sortSpecification.getOrdering()
            )
        );
        ident = ident.getNextSibling();
      } while ( ident != null );
      sortSpec = holder.getFirstChild();
    }
    return sortSpec;
  }
View Full Code Here

    SortSpecification sortSpecification = ( SortSpecification ) sortSpec;
    AST sortKey = sortSpecification.getSortKey();
    if ( IDENT_LIST == sortKey.getFirstChild().getType() ) {
      AST identList = sortKey.getFirstChild();
      AST ident = identList.getFirstChild();
      AST holder = new CommonAST();
      do {
        holder.addChild(
            createSortSpecification(
                ident,
                sortSpecification.getCollation(),
                sortSpecification.getOrdering()
            )
        );
        ident = ident.getNextSibling();
      } while ( ident != null );
      sortSpec = holder.getFirstChild();
    }
    return sortSpec;
  }
View Full Code Here

    SortSpecification sortSpecification = ( SortSpecification ) sortSpec;
    AST sortKey = sortSpecification.getSortKey();
    if ( IDENT_LIST == sortKey.getFirstChild().getType() ) {
      AST identList = sortKey.getFirstChild();
      AST ident = identList.getFirstChild();
      AST holder = new CommonAST();
      do {
        holder.addChild(
            createSortSpecification(
                ident,
                sortSpecification.getCollation(),
                sortSpecification.getOrdering()
            )
        );
        ident = ident.getNextSibling();
      } while ( ident != null );
      sortSpec = holder.getFirstChild();
    }
    return sortSpec;
  }
View Full Code Here

    SortSpecification sortSpecification = ( SortSpecification ) sortSpec;
    AST sortKey = sortSpecification.getSortKey();
    if ( IDENT_LIST == sortKey.getFirstChild().getType() ) {
      AST identList = sortKey.getFirstChild();
      AST ident = identList.getFirstChild();
      AST holder = new CommonAST();
      do {
        holder.addChild(
            createSortSpecification(
                ident,
                sortSpecification.getCollation(),
                sortSpecification.getOrdering()
            )
        );
        ident = ident.getNextSibling();
      } while ( ident != null );
      sortSpec = holder.getFirstChild();
    }
    return sortSpec;
  }
View Full Code Here

    SortSpecification sortSpecification = ( SortSpecification ) sortSpec;
    AST sortKey = sortSpecification.getSortKey();
    if ( IDENT_LIST == sortKey.getFirstChild().getType() ) {
      AST identList = sortKey.getFirstChild();
      AST ident = identList.getFirstChild();
      AST holder = new CommonAST();
      do {
        holder.addChild(
            createSortSpecification(
                ident,
                sortSpecification.getCollation(),
                sortSpecification.getOrdering()
            )
        );
        ident = ident.getNextSibling();
      } while ( ident != null );
      sortSpec = holder.getFirstChild();
    }
    return sortSpec;
  }
View Full Code Here

  **/
  public CommonAST updateRegExTree() {
    StringReader sr = new StringReader("("+this.getRegularExpression()+")");
    ExpressionLexer lexer = new  ExpressionLexer(sr);
    ExpressionParser parser = new ExpressionParser(lexer);
    CommonAST newTree = null;
   
    try {
      parser.regular_expression();
      newTree = (CommonAST)parser.getAST();
    } catch (Exception e) {
View Full Code Here

  private static FIS createFromLexer(FCLLexer lexer, boolean verbose) {
    FIS fis = new FIS();
    try {
      FCLParser parser = new FCLParser(lexer);
      parser.fcl();
      CommonAST parseTree = (CommonAST) parser.getAST();

      // Error loading file?
      if( parseTree == null ) {
        System.err.println("Can't create FIS");
        return null;
      }
      Gpr.debug(verbose, "Tree: " + parseTree.toStringTree());

      // Add every FuzzyRuleSet (there may be more than one in each FCL file)
      for( AST child = parseTree; child != null; child = child.getNextSibling() ) {
        // Create a new ruleset
        FuzzyRuleSet ruleSet = new FuzzyRuleSet();
View Full Code Here

    try {
      CalcLexer lexer = new CalcLexer(new DataInputStream(System.in));
      CalcParser parser = new CalcParser(lexer);
      // Parse the input expression
      parser.expr();
      CommonAST t = (CommonAST)parser.getAST();
      // Print the resulting tree out in LISP notation
      System.out.println(t.toStringList());
      CalcTreeWalker walker = new CalcTreeWalker();
      // Traverse the tree created by the parser
      walker.expr(t);
      t = (CommonAST)walker.getAST();
      System.out.println(t.toStringList());
    } catch(Exception e) {
      System.err.println("exception: "+e);
    }
  }
View Full Code Here

TOP

Related Classes of antlr.CommonAST

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.