Start of new ANTLR4 based parser.

Very simple tests pass.
This commit is contained in:
eelke 2022-04-03 12:27:35 +02:00
parent 03b4194193
commit fbbe832a05
44 changed files with 860 additions and 8 deletions

View file

@ -0,0 +1,21 @@
#include "Parser.h"
#include "antlr4-runtime.h"
Parser::Parser(const std::string &input_string)
: InputStream(std::make_unique<antlr4::ANTLRInputStream>(input_string))
, CaseFilter(InputStream.get(), true)
, Lexer(&CaseFilter)
, 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);
}