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

31
pglablib/PgsqlLexer.g4 Normal file
View file

@ -0,0 +1,31 @@
lexer grammar PgsqlLexer;
@lexer::preinclude {
#include <memory>
}
SemiColon: ';';
Comma: ',';
Dot: '.';
OpenParen: '(';
CloseParen: ')';
As: 'AS';
By: 'BY';
From: 'FROM';
Full: 'FULL';
Group: 'GROUP';
Having: 'HAVING';
Join: 'JOIN';
Left : 'LEFT';
Order : 'ORDER';
Right : 'RIGHT';
Select: 'SELECT';
Where: 'WHERE';
Ident: [A-Za-z_][A-Za-z_0-9]* ; // match lower-case identifiers
IntegerLiteral: [1-9][0-9]*;
StringLiteral: '\'' ('\'\'' | ~ ('\''))* '\'' { setText(getText().substr(1, getText().length()-2)); };
Whitespace : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines