arungopalan commented on issue #18078:
URL:
https://github.com/apache/shardingsphere/issues/18078#issuecomment-1141545395
See code below that can reproduce this. This produces no error but it should.
```
package com.somepackage;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.ParseTreeListener;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import org.antlr.v4.runtime.tree.TerminalNode;
import
org.apache.shardingsphere.sql.parser.postgresql.parser.PostgreSQLLexer;
import
org.apache.shardingsphere.sql.parser.postgresql.parser.PostgreSQLParser;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
String query = "select * as ab from some_table";
PostgreSQLLexer postgreSQLLexer = new
PostgreSQLLexer(CharStreams.fromString(query));
PostgreSQLParser postgreSQLParser = new PostgreSQLParser(new
CommonTokenStream(postgreSQLLexer));
ParseTreeWalker parseTreeWalker = new ParseTreeWalker();
parseTreeWalker.walk(new ParseTreeListener() {
@Override
public void visitTerminal(TerminalNode node) {
System.out.println("Terminal [" + node.getText() + "]");
}
@Override
public void visitErrorNode(ErrorNode node) {
System.out.println("Error [" + node + "]");
}
@Override
public void enterEveryRule(ParserRuleContext ctx) {
// System.out.println("Entering [" + ctx + "]");
}
@Override
public void exitEveryRule(ParserRuleContext ctx) {
// System.out.println("Exiting [" + ctx.getText() + "]");
}
}, postgreSQLParser.execute());
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]