Example usage for org.hibernate.hql.internal.ast HqlParser showAst

List of usage examples for org.hibernate.hql.internal.ast HqlParser showAst

Introduction

In this page you can find the example usage for org.hibernate.hql.internal.ast HqlParser showAst.

Prototype

private void showAst(AST ast, PrintWriter pw) 

Source Link

Usage

From source file:com.mysema.query.jpa.QueryHelper.java

License:Apache License

public void parse() throws RecognitionException, TokenStreamException {
    try {//from  w w  w.  j a va 2  s.com
        String input = toString();
        System.out.println("input: " + input.replace('\n', ' '));
        HqlParser parser = HqlParser.getInstance(input);
        parser.setFilter(false);
        parser.statement();
        AST ast = parser.getAST();
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        parser.showAst(ast, new PrintStream(baos));
        assertEquals("At least one error occurred during parsing " + input, 0,
                parser.getParseErrorHandler().getErrorCount());
    } finally {
        // clear();
        System.out.println();
    }
}

From source file:com.querydsl.jpa.QueryHelper.java

License:Apache License

public void parse() throws RecognitionException, TokenStreamException {
    String input = toString();//from  w w w  . j a v a  2 s .  c  om
    logger.debug("input: " + input.replace('\n', ' '));
    HqlParser parser = HqlParser.getInstance(input);
    parser.setFilter(false);
    parser.statement();
    AST ast = parser.getAST();
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    parser.showAst(ast, new PrintStream(baos));
    assertEquals("At least one error occurred during parsing " + input, 0,
            parser.getParseErrorHandler().getErrorCount());
}