Examples of ASTPrinter


Examples of org.adjective.syntactic.parser.util.ASTPrinter

public class Main
{

    public static void main(String[] args)
    {
        ASTPrinter printer = new ASTPrinter();
        if (args.length == 0)
        {
            printer.print("<stdin>", JavaParser.processStdin());
            return;
        }

        List<String> errors = new ArrayList<String>();
        for (String arg : args)
        {
            if (arg.startsWith("-"))
            {
                switch (arg.charAt(1))
                {
                    case 's':
                        printer.setShowSource(true);
                        break;
                    case 't':
                        printer.setShowTree(true);
                        break;
                }
                continue;
            }
            Node node = parse(arg);
            if (node == null)
            {
                errors.add(arg);
            }
            else
            {
                printer.print(arg, node);
            }
        }

        for (String error : errors)
        {
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTPrinter

  private ParseErrorHandler parseErrorHandler;
  private ASTPrinter printer = getASTPrinter();

  private static ASTPrinter getASTPrinter() {
    return new ASTPrinter( org.hibernate.hql.antlr.HqlTokenTypes.class );
  }
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTPrinter

      }
      else {
        Type type = expr.getDataType();
        if ( type == null ) {
          throw new IllegalStateException( "No data type for node: " + expr.getClass().getName() + " "
              + new ASTPrinter( SqlTokenTypes.class ).showAsString( ( AST ) expr, "" ) );
        }
        //sqlResultTypeList.add( type );

        // If the data type is not an association type, it could not have been in the FROM clause.
        if ( expr.isScalar() ) {
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTPrinter

    // Transform the tree.
    w.statement( hqlAst );

    if ( AST_LOG.isDebugEnabled() ) {
      ASTPrinter printer = new ASTPrinter( SqlTokenTypes.class );
      AST_LOG.debug( printer.showAsString( w.getAST(), "--- SQL AST ---" ) );
    }

    w.getParseErrorHandler().throwQueryException();

    return w;
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTPrinter

    return parser;
  }

  void showHqlAst(AST hqlAst) {
    if ( AST_LOG.isDebugEnabled() ) {
      ASTPrinter printer = new ASTPrinter( HqlTokenTypes.class );
      printer.setShowClassNames( false ); // The class names aren't interesting in the first tree.
      AST_LOG.debug( printer.showAsString( hqlAst, "--- HQL AST ---" ) );
    }
  }
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTPrinter

    this.sessionFactoryHelper = new SessionFactoryHelper( sfi );
    this.literalProcessor = new LiteralProcessor( this );
    this.tokenReplacements = tokenReplacements;
    this.collectionFilterRole = collectionRole;
    this.hqlParser = parser;
    this.printer = new ASTPrinter( SqlTokenTypes.class );
  }
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTPrinter

    this.sessionFactoryHelper = new SessionFactoryHelper( sfi );
    this.literalProcessor = new LiteralProcessor( this );
    this.tokenReplacements = tokenReplacements;
    this.collectionFilterRole = collectionRole;
    this.hqlParser = parser;
    this.printer = new ASTPrinter( SqlTokenTypes.class );
  }
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTPrinter

    // Transform the tree.
    w.statement( hqlAst );

    if ( AST_LOG.isDebugEnabled() ) {
      ASTPrinter printer = new ASTPrinter( SqlTokenTypes.class );
      AST_LOG.debug( printer.showAsString( w.getAST(), "--- SQL AST ---" ) );
    }

    w.getParseErrorHandler().throwQueryException();

    return w;
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTPrinter

    return parser;
  }

  void showHqlAst(AST hqlAst) {
    if ( AST_LOG.isDebugEnabled() ) {
      ASTPrinter printer = new ASTPrinter( HqlTokenTypes.class, false );
      AST_LOG.debug( printer.showAsString( hqlAst, "--- HQL AST ---" ) );
    }
  }
View Full Code Here

Examples of org.hibernate.hql.ast.util.ASTPrinter

      }
      else {
        Type type = expr.getDataType();
        if ( type == null ) {
          throw new IllegalStateException( "No data type for node: " + expr.getClass().getName() + " "
              + new ASTPrinter( SqlTokenTypes.class ).showAsString( ( AST ) expr, "" ) );
        }
        //sqlResultTypeList.add( type );

        // If the data type is not an association type, it could not have been in the FROM clause.
        if ( expr.isScalar() ) {
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.