Lexer improvements:

- 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
This commit is contained in:
eelke 2022-04-03 20:09:58 +02:00
parent 81f27a6a18
commit 0da32b916c
6 changed files with 132 additions and 104 deletions

View file

@ -8,8 +8,7 @@ Parser::Parser(const std::string &input_string)
Parser::Parser(std::unique_ptr<antlr4::CharStream> stream)
: InputStream(std::move(stream))
, CaseFilter(InputStream.get(), true)
, Lexer(&CaseFilter)
, Lexer(InputStream.get())
, TokenStream(&Lexer)
, AParser(&TokenStream)
{

View file

@ -2,7 +2,6 @@
#include ".generated/PgsqlLexer.h"
#include ".generated/PgsqlParser.h"
#include "CaseChangingCharStream.h"
#include "ErrorListener.h"
class Parser
@ -19,7 +18,6 @@ public:
}
private:
std::unique_ptr<antlr4::CharStream> InputStream;
CaseChangingCharStream CaseFilter;
PgsqlLexer Lexer;
antlr4::CommonTokenStream TokenStream;
PgsqlParser AParser;