Examples of CommonAST


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

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

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

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

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

Examples of antlr.CommonAST

  }

  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

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

Examples of org.jostraca.comp.antlr.CommonAST

    BooleanAntlrLexer  lexer  = new BooleanAntlrLexer( pReader );
    BooleanAntlrParser parser = new BooleanAntlrParser( lexer );

    parser.expr();

    CommonAST        ast  = (CommonAST) parser.getAST();
    BooleanAntlrTree tree = new BooleanAntlrTree();

    return tree.expr( ast );
  }
View Full Code Here

Examples of org.jostraca.comp.antlr.CommonAST

    BooleanAntlrLexer  lexer  = new BooleanAntlrLexer( pReader );
    BooleanAntlrParser parser = new BooleanAntlrParser( lexer );

    parser.expr();

    CommonAST ast = (CommonAST) parser.getAST();

    return ast;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.