if (lexer.token() == Token.VARIANT) {
SQLExpr variant = this.exprParser.primary();
if (variant instanceof SQLBinaryOpExpr) {
SQLBinaryOpExpr binaryOpExpr = (SQLBinaryOpExpr) variant;
if (binaryOpExpr.getOperator() == SQLBinaryOperator.Assignment) {
SQLSetStatement stmt = new SQLSetStatement(binaryOpExpr.getLeft(), binaryOpExpr.getRight(), getDbType());
statementList.add(stmt);
continue;
}
}
accept(Token.COLONEQ);
SQLExpr value = this.exprParser.expr();
SQLSetStatement stmt = new SQLSetStatement(variant, value, getDbType());
statementList.add(stmt);
continue;
}
if (lexer.token() == Token.EXCEPTION) {
statementList.add(this.parseException());
continue;
}
if (identifierEquals("EXIT")) {
lexer.nextToken();
OracleExitStatement stmt = new OracleExitStatement();
if (lexer.token() == Token.WHEN) {
lexer.nextToken();
stmt.setWhen(this.exprParser.expr());
}
statementList.add(stmt);
continue;
}
if (identifierEquals("FETCH")) {
lexer.nextToken();
OracleFetchStatement stmt = new OracleFetchStatement();
stmt.setCursorName(this.exprParser.name());
accept(Token.INTO);
for (;;) {
stmt.getInto().add(this.exprParser.name());
if (lexer.token() == Token.COMMA) {
lexer.nextToken();
continue;
}
break;
}
statementList.add(stmt);
continue;
}
if (identifierEquals("ROLLBACK")) {
SQLRollbackStatement stmt = parseRollback();
statementList.add(stmt);
continue;
}
if (lexer.token() == Token.EXPLAIN) {
statementList.add(this.parseExplain());
continue;
}
if (lexer.token() == Token.IDENTIFIER) {
SQLExpr expr = exprParser.expr();
OracleExprStatement stmt = new OracleExprStatement(expr);
statementList.add(stmt);
continue;
}
if (lexer.token() == Token.LPAREN) {
char ch = lexer.current();
int bp = lexer.bp();
lexer.nextToken();
if (lexer.token() == Token.SELECT) {
lexer.reset(bp, ch, Token.LPAREN);
statementList.add(this.parseSelect());
continue;
} else {
throw new ParserException("TODO : " + lexer.token() + " " + lexer.stringVal());
}
}
if (lexer.token() == Token.SET) {
statementList.add(this.parseSet());
continue;
}
if (lexer.token() == Token.GRANT) {
statementList.add(this.parseGrant());
continue;
}
if (lexer.token() == Token.COMMENT) {
statementList.add(this.parseComment());
continue;
}
if (lexer.token() == Token.FOR) {
statementList.add(this.parseFor());
continue;
}
if (lexer.token() == Token.LOOP) {
statementList.add(this.parseLoop());
continue;
}
if (lexer.token() == Token.IF) {
statementList.add(this.parseIf());
continue;
}
if (lexer.token() == Token.GOTO) {
lexer.nextToken();
SQLName label = this.exprParser.name();
OracleGotoStatement stmt = new OracleGotoStatement(label);
statementList.add(stmt);
continue;
}
if (lexer.token() == Token.COMMIT) {
lexer.nextToken();
if (identifierEquals("WORK")) {
lexer.nextToken();
}
OracleCommitStatement stmt = new OracleCommitStatement();
if (identifierEquals("WRITE")) {
stmt.setWrite(true);
lexer.nextToken();
for (;;) {
if (lexer.token() == Token.WAIT) {
lexer.nextToken();
stmt.setWait(Boolean.TRUE);
continue;
} else if (lexer.token() == Token.NOWAIT) {
lexer.nextToken();
stmt.setWait(Boolean.FALSE);
continue;
} else if (lexer.token() == Token.IMMEDIATE) {
lexer.nextToken();
stmt.setImmediate(Boolean.TRUE);
continue;
} else if (identifierEquals("BATCH")) {
lexer.nextToken();
stmt.setImmediate(Boolean.FALSE);
continue;
}
break;
}
}
statementList.add(stmt);
continue;
}
if (lexer.token() == Token.SAVEPOINT) {
lexer.nextToken();
OracleSavePointStatement stmt = new OracleSavePointStatement();
if (lexer.token() == Token.TO) {
lexer.nextToken();
stmt.setTo(this.exprParser.name());
}
statementList.add(stmt);
continue;
}
if (lexer.token() == Token.LTLT) {
lexer.nextToken();
SQLName label = this.exprParser.name();
OracleLabelStatement stmt = new OracleLabelStatement(label);
accept(Token.GTGT);
statementList.add(stmt);
continue;
}
if (lexer.token() == Token.DROP) {
lexer.nextToken();
if (lexer.token() == Token.TABLE) {
SQLDropTableStatement stmt = parseDropTable(false);
statementList.add(stmt);
continue;
}
boolean isPublic = false;
if (identifierEquals("PUBLIC")) {
lexer.nextToken();
isPublic = true;
}
if (lexer.token() == Token.DATABASE) {
lexer.nextToken();
if (identifierEquals("LINK")) {
lexer.nextToken();
OracleDropDbLinkStatement stmt = new OracleDropDbLinkStatement();
if (isPublic) {
stmt.setPublic(isPublic);
}
stmt.setName(this.exprParser.name());
statementList.add(stmt);
continue;
}
}