forked from TrueCloudLab/frostfs-sdk-go
Airat Arifullin
4f48f6c9e0
* Add the rule for NOT operation to the policy parser grammar * Regenerate query parse * Implement NOT in filter * Add unit-tests Signed-off-by: Airat Arifullin a.arifullin@yadro.com
42 lines
1,020 B
ANTLR
42 lines
1,020 B
ANTLR
lexer grammar QueryLexer;
|
|
|
|
NOT_OP : 'NOT';
|
|
AND_OP : 'AND';
|
|
OR_OP : 'OR';
|
|
SIMPLE_OP : 'EQ' | 'NE' | 'GE' | 'GT' | 'LT' | 'LE';
|
|
|
|
REP : 'REP';
|
|
IN : 'IN';
|
|
AS : 'AS';
|
|
CBF : 'CBF';
|
|
SELECT : 'SELECT';
|
|
FROM : 'FROM';
|
|
FILTER : 'FILTER';
|
|
WILDCARD : '*';
|
|
|
|
CLAUSE_SAME : 'SAME';
|
|
CLAUSE_DISTINCT : 'DISTINCT';
|
|
|
|
L_PAREN : '(';
|
|
R_PAREN : ')';
|
|
AT : '@';
|
|
|
|
IDENT : Nondigit (Digit | Nondigit)* ;
|
|
fragment Digit : [0-9] ;
|
|
fragment Nondigit : [a-zA-Z_] ;
|
|
|
|
NUMBER1 : [1-9] Digit* ;
|
|
ZERO : '0' ;
|
|
|
|
// Taken from antlr4 json grammar with minor corrections.
|
|
// https://github.com/antlr/grammars-v4/blob/master/json/JSON.g4
|
|
STRING : '"' (ESC | SAFECODEPOINTDOUBLE)* '"'
|
|
| '\'' (ESC | SAFECODEPOINTSINGLE)* '\'' ;
|
|
|
|
fragment ESC : '\\' (['"\\/bfnrt] | UNICODE) ;
|
|
fragment UNICODE : 'u' HEX HEX HEX HEX ;
|
|
fragment HEX : [0-9a-fA-F] ;
|
|
fragment SAFECODEPOINTSINGLE : ~ ['\\\u0000-\u001F] ;
|
|
fragment SAFECODEPOINTDOUBLE : ~ ["\\\u0000-\u001F] ;
|
|
|
|
WS : [ \t\n\r] + -> skip ;
|