@Test public void parseOneMore() throws Exception{ Query parsedQuery = new EventStoreQueryParser().parse("groupby( payloadType, count( aggregateSequenceNumber) as count, max( aggregateSequenceNumber) as max) | count > 2"); System.out.println( parsedQuery); }
public Query parse(String query) throws ParseException { EventStoreQueryLexer lexer = new EventStoreQueryLexer(new ANTLRInputStream(query)); lexer.removeErrorListeners(); List<ParseException> errors = new ArrayList<>(); ANTLRErrorListener errorListener = new BaseErrorListener() { @Override public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) { errors.add(new ParseException(msg, charPositionInLine)); } }; lexer.addErrorListener(errorListener); CommonTokenStream tokens = new CommonTokenStream(lexer); io.axoniq.EventStoreQueryParser parser = new io.axoniq.EventStoreQueryParser(tokens); parser.removeErrorListeners(); parser.addErrorListener(errorListener); io.axoniq.EventStoreQueryParser.QueryContext query1 = parser.query(); ParseTreeWalker walker = new ParseTreeWalker(); EventStoreQueryListener baseListener = new EventStoreQueryListener(parser); walker.walk(baseListener, query1); if( ! errors.isEmpty()) { throw errors.get(0); } return baseListener.query(); }
EventStoreQueryParser { public Query parse(String query) throws ParseException { EventStoreQueryLexer lexer = new EventStoreQueryLexer(new ANTLRInputStream(query)); lexer.removeErrorListeners(); List<ParseException> errors = new ArrayList<>(); ANTLRErrorListener errorListener = new BaseErrorListener() { @Override public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) { errors.add(new ParseException(msg, charPositionInLine)); } }; lexer.addErrorListener(errorListener); CommonTokenStream tokens = new CommonTokenStream(lexer); io.axoniq.EventStoreQueryParser parser = new io.axoniq.EventStoreQueryParser(tokens); parser.removeErrorListeners(); parser.addErrorListener(errorListener); io.axoniq.EventStoreQueryParser.QueryContext query1 = parser.query(); ParseTreeWalker walker = new ParseTreeWalker(); EventStoreQueryListener baseListener = new EventStoreQueryListener(parser); walker.walk(baseListener, query1); if( ! errors.isEmpty()) { throw errors.get(0); } return baseListener.query(); } }
EventStoreQueryParser { public Query parse(String query) throws ParseException { EventStoreQueryLexer lexer = new EventStoreQueryLexer(new ANTLRInputStream(query)); lexer.removeErrorListeners(); List<ParseException> errors = new ArrayList<>(); ANTLRErrorListener errorListener = new BaseErrorListener() { @Override public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) { errors.add(new ParseException(msg, charPositionInLine)); } }; lexer.addErrorListener(errorListener); CommonTokenStream tokens = new CommonTokenStream(lexer); io.axoniq.EventStoreQueryParser parser = new io.axoniq.EventStoreQueryParser(tokens); parser.removeErrorListeners(); parser.addErrorListener(errorListener); io.axoniq.EventStoreQueryParser.QueryContext query1 = parser.query(); ParseTreeWalker walker = new ParseTreeWalker(); EventStoreQueryListener baseListener = new EventStoreQueryListener(parser); walker.walk(baseListener, query1); if( ! errors.isEmpty()) { throw errors.get(0); } return baseListener.query(); }  }
EventStoreQueryParser { public Query parse(String query) throws ParseException { EventStoreQueryLexer lexer = new EventStoreQueryLexer(new ANTLRInputStream(query)); lexer.removeErrorListeners(); List<ParseException> errors = new ArrayList<>(); ANTLRErrorListener errorListener = new BaseErrorListener() { @Override public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) { errors.add(new ParseException(msg, charPositionInLine)); } }; lexer.addErrorListener(errorListener); CommonTokenStream tokens = new CommonTokenStream(lexer); io.axoniq.EventStoreQueryParser parser = new io.axoniq.EventStoreQueryParser(tokens); parser.removeErrorListeners(); parser.addErrorListener(errorListener); io.axoniq.EventStoreQueryParser.QueryContext query1 = parser.query(); ParseTreeWalker walker = new ParseTreeWalker(); EventStoreQueryListener baseListener = new EventStoreQueryListener(parser); walker.walk(baseListener, query1); if( ! errors.isEmpty()) { throw errors.get(0); } return baseListener.query(); }  Query parse(String query); }
EventStoreQueryParser { public Query parse(String query) throws ParseException { EventStoreQueryLexer lexer = new EventStoreQueryLexer(new ANTLRInputStream(query)); lexer.removeErrorListeners(); List<ParseException> errors = new ArrayList<>(); ANTLRErrorListener errorListener = new BaseErrorListener() { @Override public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) { errors.add(new ParseException(msg, charPositionInLine)); } }; lexer.addErrorListener(errorListener); CommonTokenStream tokens = new CommonTokenStream(lexer); io.axoniq.EventStoreQueryParser parser = new io.axoniq.EventStoreQueryParser(tokens); parser.removeErrorListeners(); parser.addErrorListener(errorListener); io.axoniq.EventStoreQueryParser.QueryContext query1 = parser.query(); ParseTreeWalker walker = new ParseTreeWalker(); EventStoreQueryListener baseListener = new EventStoreQueryListener(parser); walker.walk(baseListener, query1); if( ! errors.isEmpty()) { throw errors.get(0); } return baseListener.query(); }  Query parse(String query);  }