public class Parser extends Object implements Iterable<Cmd>
final Tokenizer lexer = new Tokenizer(reader);
try {
for (Cmd cmd : new Parser(lexer)) {
assert cmd != null;
}
} catch (ScanException e) {
System.out.printf("Error while lexing %s (%d:%d): %s%n", path, lexer.lineno(), lexer.column(), e.getMessage());
} catch (ParseException e) {
System.out.printf("Error while parsing %s (%d:%d): %s%n", path, lexer.lineno(), lexer.column(), e.getMessage());
}
Constructor | Description |
---|---|
Parser(org.sqlite.parser.Tokenizer lexer) |
Modifier and Type | Method | Description |
---|---|---|
Iterator<Cmd> |
iterator() |
|
static Cmd |
parse(String sql) |
|
static Cmd |
parse(org.sqlite.parser.Tokenizer lexer) |
Parse one command/statement at a time.
|
forEach, spliterator
public static Cmd parse(String sql) throws SQLSyntaxErrorException
null
if sql
is empty, otherwise first command/statement.SQLSyntaxErrorException
public static Cmd parse(org.sqlite.parser.Tokenizer lexer) throws ScanException, ParseException
null
at end of file/stream, otherwise one command/statement.ScanException
ParseException
Copyright © 2018. All rights reserved.