Package antlr

Examples of antlr.CommonAST


      lexer.setFilename("<stdin>");
      CalcParser parser = new CalcParser(lexer);
      parser.setFilename("<stdin>");
      // Parse the input expression
      parser.expr();
      CommonAST t = (CommonAST)parser.getAST();
      // Print the resulting tree out in LISP notation
      System.out.println(t.toStringTree());
      CalcTreeWalker walker = new CalcTreeWalker();
      // Traverse the tree created by the parser
      float r = walker.expr(t);
      System.out.println("value is "+r);
    }
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 static void main(String[] paramArrayOfString)
  {
    ASTFactory localASTFactory = new ASTFactory();
    CommonAST localCommonAST = (CommonAST)localASTFactory.create(0, "ROOT");
    localCommonAST.addChild((CommonAST)localASTFactory.create(0, "C1"));
    localCommonAST.addChild((CommonAST)localASTFactory.create(0, "C2"));
    localCommonAST.addChild((CommonAST)localASTFactory.create(0, "C3"));
    ASTFrame localASTFrame = new ASTFrame("AST JTree Example", localCommonAST);
    localASTFrame.setVisible(true);
  }
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

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.