use of org.jline.reader.EOFError in project flink by apache.
the class SqlMultiLineParser method parse.
@Override
public ParsedLine parse(String line, int cursor, ParseContext context) {
if (context != ParseContext.ACCEPT_LINE) {
return parseInternal(line, cursor, context);
}
if (!line.trim().endsWith(STATEMENT_DELIMITER)) {
throw new EOFError(-1, -1, "New line without EOF character.", NEW_LINE_PROMPT);
}
try {
command = line;
parseException = null;
// try to parse the line read
parsedOperation = parser.parseCommand(line).orElse(null);
} catch (SqlExecutionException e) {
if (e.getCause() instanceof SqlParserEOFException) {
throw new EOFError(-1, -1, "The statement is incomplete.", NEW_LINE_PROMPT);
}
// cache the exception so that we can print details in the terminal.
parseException = e;
throw new SyntaxError(-1, -1, e.getMessage());
}
return parseInternal(line, cursor, context);
}
Aggregations