Search in sources :

Example 1 with WhereClauseLexer

use of org.alfresco.rest.antlr.WhereClauseLexer in project alfresco-remote-api by Alfresco.

the class WhereCompiler method compileSelectClause.

public static CommonTree compileSelectClause(String selectParam) throws RecognitionException {
    // lexer splits input into tokens
    ANTLRStringStream input = new ANTLRStringStream(selectParam);
    TokenStream tokens = new CommonTokenStream(new WhereClauseLexer(input));
    // parser generates abstract syntax tree
    WhereClauseParser parser = new WhereClauseParser(tokens);
    WhereClauseParser.selectClause_return ret = parser.selectClause();
    // acquire parse result
    CommonTree ast = (CommonTree) ret.getTree();
    if (logger.isDebugEnabled())
        print(ast, 0);
    return ast;
}
Also used : ANTLRStringStream(org.antlr.runtime.ANTLRStringStream) CommonTokenStream(org.antlr.runtime.CommonTokenStream) CommonTokenStream(org.antlr.runtime.CommonTokenStream) TokenStream(org.antlr.runtime.TokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) WhereClauseParser(org.alfresco.rest.antlr.WhereClauseParser) WhereClauseLexer(org.alfresco.rest.antlr.WhereClauseLexer)

Example 2 with WhereClauseLexer

use of org.alfresco.rest.antlr.WhereClauseLexer in project alfresco-remote-api by Alfresco.

the class WhereCompiler method compileWhereClause.

public static CommonTree compileWhereClause(String expression) throws RecognitionException {
    // lexer splits input into tokens
    ANTLRStringStream input = new ANTLRStringStream(expression);
    TokenStream tokens = new CommonTokenStream(new WhereClauseLexer(input));
    // parser generates abstract syntax tree
    WhereClauseParser parser = new WhereClauseParser(tokens);
    WhereClauseParser.whereclause_return ret = parser.whereclause();
    // acquire parse result
    CommonTree ast = (CommonTree) ret.getTree();
    if (logger.isDebugEnabled())
        print(ast, 0);
    return ast;
}
Also used : ANTLRStringStream(org.antlr.runtime.ANTLRStringStream) CommonTokenStream(org.antlr.runtime.CommonTokenStream) CommonTokenStream(org.antlr.runtime.CommonTokenStream) TokenStream(org.antlr.runtime.TokenStream) CommonTree(org.antlr.runtime.tree.CommonTree) WhereClauseParser(org.alfresco.rest.antlr.WhereClauseParser) WhereClauseLexer(org.alfresco.rest.antlr.WhereClauseLexer)

Aggregations

WhereClauseLexer (org.alfresco.rest.antlr.WhereClauseLexer)2 WhereClauseParser (org.alfresco.rest.antlr.WhereClauseParser)2 ANTLRStringStream (org.antlr.runtime.ANTLRStringStream)2 CommonTokenStream (org.antlr.runtime.CommonTokenStream)2 TokenStream (org.antlr.runtime.TokenStream)2 CommonTree (org.antlr.runtime.tree.CommonTree)2