sql parser refactor.

This commit is contained in:
wenshao
2017-06-10 15:58:52 +08:00
parent 5434b65260
commit a318ebae29
17 changed files with 394 additions and 99 deletions
@@ -103,6 +103,8 @@ public class SQLStatementParser extends SQLParser {
case EOF:
case END:
case UNTIL:
case ELSE:
case WHEN:
if (lexer.isKeepComments() && lexer.hasComment() && statementList.size() > 0) {
SQLStatement stmt = statementList.get(statementList.size() - 1);
stmt.addAfterComment(lexer.readAndResetComments());
@@ -289,6 +291,12 @@ public class SQLStatementParser extends SQLParser {
statementList.add(stmt);
continue;
}
case LEAVE: {
SQLStatement stmt = parseLeave();
stmt.setParent(parent);
statementList.add(stmt);
continue;
}
default:
break;
}
@@ -435,6 +443,10 @@ public class SQLStatementParser extends SQLParser {
throw new ParserException("not supported. " + lexer.info());
}
public SQLStatement parseLeave() {
throw new ParserException("not supported. " + lexer.info());
}
public SQLStatement parseReturn() {
if (lexer.token() == Token.RETURN
|| identifierEquals("RETURN")) {