Examples of GqlExtParser


Examples of com.spoledge.audao.parser.gql.impl.GqlExtParser

     * @param gql the GQL query - the parameters to the GQL are referenced by :1, :2, ...
     */
    public PreparedGql prepare( String gql ) {
        try {
            GqlExtLexer lexer = new GqlExtLexer( new ANTLRStringStream( gql ));
            GqlExtParser parser = new GqlExtParser( new CommonTokenStream( lexer ));
            GqlExtParser.gqlext_return parserResult = parser.gqlext();

            if (parser.getNumberOfSyntaxErrors() != 0) {
                for (String err : parser.getErrors()) {
                    log.error("prepare(): " + err + " - in GQL: " + gql);
                }

                throw new RuntimeException( parser.getErrors().get(0));
            }

            CommonTree tree = (CommonTree) parserResult.getTree();

            if (log.isDebugEnabled()) {
                log.debug("prepare(): gql=" + gql + ", tree=" + tree.toStringTree());
            }

            PreparedGql.QueryType qt = PreparedGql.QueryType.valueOf( parser.getQueryType().name());

            return new PreparedGql( ds, gql, qt, tree, parser.getTokenStream());
        }
        catch (RecognitionException e) {
            log.error("prepare(): " + formatError( gql, e ), e);

            throw new RuntimeException( "Cannot parse GQL: " + e.getMessage() + " in GQL: " + gql, e );
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.