- Convert unquoted idents to lowercase. - Recognize quoted idents. - Allow all unicode whitespace characters - Added UnexpectedSymbol token for unexpected input (otherwise it is just ignored) - Handle mixed case keywords in the lexer file instead of filtering the stream
24 lines
569 B
C++
24 lines
569 B
C++
#include "Parser.h"
|
|
#include "antlr4-runtime.h"
|
|
|
|
|
|
Parser::Parser(const std::string &input_string)
|
|
: Parser(std::make_unique<antlr4::ANTLRInputStream>(input_string))
|
|
{}
|
|
|
|
Parser::Parser(std::unique_ptr<antlr4::CharStream> stream)
|
|
: InputStream(std::move(stream))
|
|
, Lexer(InputStream.get())
|
|
, TokenStream(&Lexer)
|
|
, AParser(&TokenStream)
|
|
{
|
|
AParser.removeErrorListeners();
|
|
AParser.addErrorListener(&Errors);
|
|
}
|
|
|
|
std::unique_ptr<sqlast::StatementList> Parser::Parse()
|
|
{
|
|
auto context = AParser.main();
|
|
return std::move(context->program);
|
|
}
|
|
|