2022-04-03 12:27:35 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include ".generated/PgsqlLexer.h"
|
|
|
|
|
#include ".generated/PgsqlParser.h"
|
|
|
|
|
#include "ErrorListener.h"
|
|
|
|
|
|
|
|
|
|
class Parser
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Parser(const std::string &input_string);
|
2022-04-03 12:30:23 +02:00
|
|
|
Parser(std::unique_ptr<antlr4::CharStream> stream);
|
2022-04-03 12:27:35 +02:00
|
|
|
|
|
|
|
|
std::unique_ptr<sqlast::StatementList> Parse();
|
|
|
|
|
|
|
|
|
|
int errorCount() const
|
|
|
|
|
{
|
|
|
|
|
return Errors.errorCount();
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
std::unique_ptr<antlr4::CharStream> InputStream;
|
|
|
|
|
PgsqlLexer Lexer;
|
|
|
|
|
antlr4::CommonTokenStream TokenStream;
|
|
|
|
|
PgsqlParser AParser;
|
|
|
|
|
ErrorListener Errors;
|
|
|
|
|
};
|
|
|
|
|
|