Search in sources :

Example 1 with SoqlLexer

use of org.talend.components.salesforce.soql.parser.SoqlLexer in project components by Talend.

the class SoqlQuery method init.

/**
 * init method parses input <code>queryString</code> and stores is as tree.
 * Should be invoked right after
 * {@link org.talend.components.salesforce.soql.SoqlQuery#getInstance()} method
 *
 * @param queryString SOQL query
 */
public void init(String queryString) {
    ANTLRInputStream is = new ANTLRInputStream(queryString);
    SoqlLexer lexer = new SoqlLexer(is);
    CommonTokenStream tokenStream = new CommonTokenStream(lexer);
    SoqlParser parser = new SoqlParser(tokenStream);
    queryTree = parser.query();
    fieldDescriptions = new ArrayList<>();
    FieldRetrieverListener listener = new FieldRetrieverListener();
    ParseTreeWalker.DEFAULT.walk(listener, queryTree);
}
Also used : CommonTokenStream(org.antlr.v4.runtime.CommonTokenStream) SoqlParser(org.talend.components.salesforce.soql.parser.SoqlParser) SoqlLexer(org.talend.components.salesforce.soql.parser.SoqlLexer) ANTLRInputStream(org.antlr.v4.runtime.ANTLRInputStream)

Aggregations

ANTLRInputStream (org.antlr.v4.runtime.ANTLRInputStream)1 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1 SoqlLexer (org.talend.components.salesforce.soql.parser.SoqlLexer)1 SoqlParser (org.talend.components.salesforce.soql.parser.SoqlParser)1