mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-24 02:46:27 +00:00
feat: add antlr4, parser files and grammar
This commit is contained in:
parent
e8280dbea4
commit
ec54e5c0b2
@ -1,4 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
|
ignorePatterns: ['src/parser/*.ts'],
|
||||||
env: {
|
env: {
|
||||||
browser: true,
|
browser: true,
|
||||||
es2021: true,
|
es2021: true,
|
||||||
|
|||||||
@ -53,6 +53,7 @@
|
|||||||
"antd": "5.11.0",
|
"antd": "5.11.0",
|
||||||
"antd-table-saveas-excel": "2.2.1",
|
"antd-table-saveas-excel": "2.2.1",
|
||||||
"axios": "1.8.2",
|
"axios": "1.8.2",
|
||||||
|
"antlr4": "4.13.2",
|
||||||
"babel-eslint": "^10.1.0",
|
"babel-eslint": "^10.1.0",
|
||||||
"babel-jest": "^29.6.4",
|
"babel-jest": "^29.6.4",
|
||||||
"babel-loader": "9.1.3",
|
"babel-loader": "9.1.3",
|
||||||
|
|||||||
@ -0,0 +1,5 @@
|
|||||||
|
function QueryBuilderV2(): JSX.Element {
|
||||||
|
return <div className="query-builder-v2">QueryBuilderV2</div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default QueryBuilderV2;
|
||||||
104
frontend/src/parser/FilterQuery.interp
Normal file
104
frontend/src/parser/FilterQuery.interp
Normal file
File diff suppressed because one or more lines are too long
49
frontend/src/parser/FilterQuery.tokens
Normal file
49
frontend/src/parser/FilterQuery.tokens
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
LPAREN=1
|
||||||
|
RPAREN=2
|
||||||
|
LBRACK=3
|
||||||
|
RBRACK=4
|
||||||
|
COMMA=5
|
||||||
|
EQUALS=6
|
||||||
|
NOT_EQUALS=7
|
||||||
|
NEQ=8
|
||||||
|
LT=9
|
||||||
|
LE=10
|
||||||
|
GT=11
|
||||||
|
GE=12
|
||||||
|
LIKE=13
|
||||||
|
NOT_LIKE=14
|
||||||
|
ILIKE=15
|
||||||
|
NOT_ILIKE=16
|
||||||
|
BETWEEN=17
|
||||||
|
NOT_BETWEEN=18
|
||||||
|
EXISTS=19
|
||||||
|
NOT_EXISTS=20
|
||||||
|
REGEXP=21
|
||||||
|
NOT_REGEXP=22
|
||||||
|
CONTAINS=23
|
||||||
|
NOT_CONTAINS=24
|
||||||
|
IN=25
|
||||||
|
NOT_IN=26
|
||||||
|
NOT=27
|
||||||
|
AND=28
|
||||||
|
OR=29
|
||||||
|
HAS=30
|
||||||
|
HASANY=31
|
||||||
|
HASALL=32
|
||||||
|
HASNONE=33
|
||||||
|
BOOL=34
|
||||||
|
NUMBER=35
|
||||||
|
QUOTED_TEXT=36
|
||||||
|
KEY=37
|
||||||
|
WS=38
|
||||||
|
'('=1
|
||||||
|
')'=2
|
||||||
|
'['=3
|
||||||
|
']'=4
|
||||||
|
','=5
|
||||||
|
'!='=7
|
||||||
|
'<>'=8
|
||||||
|
'<'=9
|
||||||
|
'<='=10
|
||||||
|
'>'=11
|
||||||
|
'>='=12
|
||||||
132
frontend/src/parser/FilterQueryLexer.interp
Normal file
132
frontend/src/parser/FilterQueryLexer.interp
Normal file
File diff suppressed because one or more lines are too long
49
frontend/src/parser/FilterQueryLexer.tokens
Normal file
49
frontend/src/parser/FilterQueryLexer.tokens
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
LPAREN=1
|
||||||
|
RPAREN=2
|
||||||
|
LBRACK=3
|
||||||
|
RBRACK=4
|
||||||
|
COMMA=5
|
||||||
|
EQUALS=6
|
||||||
|
NOT_EQUALS=7
|
||||||
|
NEQ=8
|
||||||
|
LT=9
|
||||||
|
LE=10
|
||||||
|
GT=11
|
||||||
|
GE=12
|
||||||
|
LIKE=13
|
||||||
|
NOT_LIKE=14
|
||||||
|
ILIKE=15
|
||||||
|
NOT_ILIKE=16
|
||||||
|
BETWEEN=17
|
||||||
|
NOT_BETWEEN=18
|
||||||
|
EXISTS=19
|
||||||
|
NOT_EXISTS=20
|
||||||
|
REGEXP=21
|
||||||
|
NOT_REGEXP=22
|
||||||
|
CONTAINS=23
|
||||||
|
NOT_CONTAINS=24
|
||||||
|
IN=25
|
||||||
|
NOT_IN=26
|
||||||
|
NOT=27
|
||||||
|
AND=28
|
||||||
|
OR=29
|
||||||
|
HAS=30
|
||||||
|
HASANY=31
|
||||||
|
HASALL=32
|
||||||
|
HASNONE=33
|
||||||
|
BOOL=34
|
||||||
|
NUMBER=35
|
||||||
|
QUOTED_TEXT=36
|
||||||
|
KEY=37
|
||||||
|
WS=38
|
||||||
|
'('=1
|
||||||
|
')'=2
|
||||||
|
'['=3
|
||||||
|
']'=4
|
||||||
|
','=5
|
||||||
|
'!='=7
|
||||||
|
'<>'=8
|
||||||
|
'<'=9
|
||||||
|
'<='=10
|
||||||
|
'>'=11
|
||||||
|
'>='=12
|
||||||
249
frontend/src/parser/FilterQueryLexer.ts
Normal file
249
frontend/src/parser/FilterQueryLexer.ts
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
// Generated from src/query-grammar/FilterQuery.g4 by ANTLR 4.13.1
|
||||||
|
// noinspection ES6UnusedImports,JSUnusedGlobalSymbols,JSUnusedLocalSymbols
|
||||||
|
import {
|
||||||
|
ATN,
|
||||||
|
ATNDeserializer,
|
||||||
|
CharStream,
|
||||||
|
DecisionState, DFA,
|
||||||
|
Lexer,
|
||||||
|
LexerATNSimulator,
|
||||||
|
RuleContext,
|
||||||
|
PredictionContextCache,
|
||||||
|
Token
|
||||||
|
} from "antlr4";
|
||||||
|
export default class FilterQueryLexer extends Lexer {
|
||||||
|
public static readonly LPAREN = 1;
|
||||||
|
public static readonly RPAREN = 2;
|
||||||
|
public static readonly LBRACK = 3;
|
||||||
|
public static readonly RBRACK = 4;
|
||||||
|
public static readonly COMMA = 5;
|
||||||
|
public static readonly EQUALS = 6;
|
||||||
|
public static readonly NOT_EQUALS = 7;
|
||||||
|
public static readonly NEQ = 8;
|
||||||
|
public static readonly LT = 9;
|
||||||
|
public static readonly LE = 10;
|
||||||
|
public static readonly GT = 11;
|
||||||
|
public static readonly GE = 12;
|
||||||
|
public static readonly LIKE = 13;
|
||||||
|
public static readonly NOT_LIKE = 14;
|
||||||
|
public static readonly ILIKE = 15;
|
||||||
|
public static readonly NOT_ILIKE = 16;
|
||||||
|
public static readonly BETWEEN = 17;
|
||||||
|
public static readonly NOT_BETWEEN = 18;
|
||||||
|
public static readonly EXISTS = 19;
|
||||||
|
public static readonly NOT_EXISTS = 20;
|
||||||
|
public static readonly REGEXP = 21;
|
||||||
|
public static readonly NOT_REGEXP = 22;
|
||||||
|
public static readonly CONTAINS = 23;
|
||||||
|
public static readonly NOT_CONTAINS = 24;
|
||||||
|
public static readonly IN = 25;
|
||||||
|
public static readonly NOT_IN = 26;
|
||||||
|
public static readonly NOT = 27;
|
||||||
|
public static readonly AND = 28;
|
||||||
|
public static readonly OR = 29;
|
||||||
|
public static readonly HAS = 30;
|
||||||
|
public static readonly HASANY = 31;
|
||||||
|
public static readonly HASALL = 32;
|
||||||
|
public static readonly HASNONE = 33;
|
||||||
|
public static readonly BOOL = 34;
|
||||||
|
public static readonly NUMBER = 35;
|
||||||
|
public static readonly QUOTED_TEXT = 36;
|
||||||
|
public static readonly KEY = 37;
|
||||||
|
public static readonly WS = 38;
|
||||||
|
public static readonly EOF = Token.EOF;
|
||||||
|
|
||||||
|
public static readonly channelNames: string[] = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
|
||||||
|
public static readonly literalNames: (string | null)[] = [ null, "'('",
|
||||||
|
"')'", "'['",
|
||||||
|
"']'", "','",
|
||||||
|
null, "'!='",
|
||||||
|
"'<>'", "'<'",
|
||||||
|
"'<='", "'>'",
|
||||||
|
"'>='" ];
|
||||||
|
public static readonly symbolicNames: (string | null)[] = [ null, "LPAREN",
|
||||||
|
"RPAREN", "LBRACK",
|
||||||
|
"RBRACK", "COMMA",
|
||||||
|
"EQUALS", "NOT_EQUALS",
|
||||||
|
"NEQ", "LT",
|
||||||
|
"LE", "GT",
|
||||||
|
"GE", "LIKE",
|
||||||
|
"NOT_LIKE",
|
||||||
|
"ILIKE", "NOT_ILIKE",
|
||||||
|
"BETWEEN",
|
||||||
|
"NOT_BETWEEN",
|
||||||
|
"EXISTS", "NOT_EXISTS",
|
||||||
|
"REGEXP", "NOT_REGEXP",
|
||||||
|
"CONTAINS",
|
||||||
|
"NOT_CONTAINS",
|
||||||
|
"IN", "NOT_IN",
|
||||||
|
"NOT", "AND",
|
||||||
|
"OR", "HAS",
|
||||||
|
"HASANY", "HASALL",
|
||||||
|
"HASNONE",
|
||||||
|
"BOOL", "NUMBER",
|
||||||
|
"QUOTED_TEXT",
|
||||||
|
"KEY", "WS" ];
|
||||||
|
public static readonly modeNames: string[] = [ "DEFAULT_MODE", ];
|
||||||
|
|
||||||
|
public static readonly ruleNames: string[] = [
|
||||||
|
"LPAREN", "RPAREN", "LBRACK", "RBRACK", "COMMA", "EQUALS", "NOT_EQUALS",
|
||||||
|
"NEQ", "LT", "LE", "GT", "GE", "LIKE", "NOT_LIKE", "ILIKE", "NOT_ILIKE",
|
||||||
|
"BETWEEN", "NOT_BETWEEN", "EXISTS", "NOT_EXISTS", "REGEXP", "NOT_REGEXP",
|
||||||
|
"CONTAINS", "NOT_CONTAINS", "IN", "NOT_IN", "NOT", "AND", "OR", "HAS",
|
||||||
|
"HASANY", "HASALL", "HASNONE", "BOOL", "NUMBER", "QUOTED_TEXT", "KEY",
|
||||||
|
"WS", "DIGIT",
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
constructor(input: CharStream) {
|
||||||
|
super(input);
|
||||||
|
this._interp = new LexerATNSimulator(this, FilterQueryLexer._ATN, FilterQueryLexer.DecisionsToDFA, new PredictionContextCache());
|
||||||
|
}
|
||||||
|
|
||||||
|
public get grammarFileName(): string { return "FilterQuery.g4"; }
|
||||||
|
|
||||||
|
public get literalNames(): (string | null)[] { return FilterQueryLexer.literalNames; }
|
||||||
|
public get symbolicNames(): (string | null)[] { return FilterQueryLexer.symbolicNames; }
|
||||||
|
public get ruleNames(): string[] { return FilterQueryLexer.ruleNames; }
|
||||||
|
|
||||||
|
public get serializedATN(): number[] { return FilterQueryLexer._serializedATN; }
|
||||||
|
|
||||||
|
public get channelNames(): string[] { return FilterQueryLexer.channelNames; }
|
||||||
|
|
||||||
|
public get modeNames(): string[] { return FilterQueryLexer.modeNames; }
|
||||||
|
|
||||||
|
public static readonly _serializedATN: number[] = [4,0,38,359,6,-1,2,0,
|
||||||
|
7,0,2,1,7,1,2,2,7,2,2,3,7,3,2,4,7,4,2,5,7,5,2,6,7,6,2,7,7,7,2,8,7,8,2,9,
|
||||||
|
7,9,2,10,7,10,2,11,7,11,2,12,7,12,2,13,7,13,2,14,7,14,2,15,7,15,2,16,7,
|
||||||
|
16,2,17,7,17,2,18,7,18,2,19,7,19,2,20,7,20,2,21,7,21,2,22,7,22,2,23,7,23,
|
||||||
|
2,24,7,24,2,25,7,25,2,26,7,26,2,27,7,27,2,28,7,28,2,29,7,29,2,30,7,30,2,
|
||||||
|
31,7,31,2,32,7,32,2,33,7,33,2,34,7,34,2,35,7,35,2,36,7,36,2,37,7,37,2,38,
|
||||||
|
7,38,1,0,1,0,1,1,1,1,1,2,1,2,1,3,1,3,1,4,1,4,1,5,1,5,1,5,3,5,93,8,5,1,6,
|
||||||
|
1,6,1,6,1,7,1,7,1,7,1,8,1,8,1,9,1,9,1,9,1,10,1,10,1,11,1,11,1,11,1,12,1,
|
||||||
|
12,1,12,1,12,1,12,1,13,1,13,1,13,1,13,4,13,120,8,13,11,13,12,13,121,1,13,
|
||||||
|
1,13,1,13,1,13,1,13,1,14,1,14,1,14,1,14,1,14,1,14,1,15,1,15,1,15,1,15,4,
|
||||||
|
15,139,8,15,11,15,12,15,140,1,15,1,15,1,15,1,15,1,15,1,15,1,16,1,16,1,16,
|
||||||
|
1,16,1,16,1,16,1,16,1,16,1,17,1,17,1,17,1,17,4,17,161,8,17,11,17,12,17,
|
||||||
|
162,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,17,1,18,1,18,1,18,1,18,1,18,1,
|
||||||
|
18,3,18,179,8,18,1,19,1,19,1,19,1,19,4,19,185,8,19,11,19,12,19,186,1,19,
|
||||||
|
1,19,1,19,1,19,1,19,1,19,3,19,195,8,19,1,20,1,20,1,20,1,20,1,20,1,20,1,
|
||||||
|
20,1,21,1,21,1,21,1,21,4,21,208,8,21,11,21,12,21,209,1,21,1,21,1,21,1,21,
|
||||||
|
1,21,1,21,1,21,1,22,1,22,1,22,1,22,1,22,1,22,1,22,1,22,3,22,227,8,22,1,
|
||||||
|
23,1,23,1,23,1,23,4,23,233,8,23,11,23,12,23,234,1,23,1,23,1,23,1,23,1,23,
|
||||||
|
1,23,1,23,1,23,3,23,245,8,23,1,24,1,24,1,24,1,25,1,25,1,25,1,25,4,25,254,
|
||||||
|
8,25,11,25,12,25,255,1,25,1,25,1,25,1,26,1,26,1,26,1,26,1,27,1,27,1,27,
|
||||||
|
1,27,1,28,1,28,1,28,1,29,1,29,1,29,1,29,1,30,1,30,1,30,1,30,1,30,1,30,1,
|
||||||
|
30,1,31,1,31,1,31,1,31,1,31,1,31,1,31,1,32,1,32,1,32,1,32,1,32,1,32,1,32,
|
||||||
|
1,32,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,1,33,3,33,307,8,33,1,34,4,
|
||||||
|
34,310,8,34,11,34,12,34,311,1,34,1,34,4,34,316,8,34,11,34,12,34,317,3,34,
|
||||||
|
320,8,34,1,35,1,35,1,35,1,35,5,35,326,8,35,10,35,12,35,329,9,35,1,35,1,
|
||||||
|
35,1,35,1,35,1,35,5,35,336,8,35,10,35,12,35,339,9,35,1,35,3,35,342,8,35,
|
||||||
|
1,36,1,36,5,36,346,8,36,10,36,12,36,349,9,36,1,37,4,37,352,8,37,11,37,12,
|
||||||
|
37,353,1,37,1,37,1,38,1,38,0,0,39,1,1,3,2,5,3,7,4,9,5,11,6,13,7,15,8,17,
|
||||||
|
9,19,10,21,11,23,12,25,13,27,14,29,15,31,16,33,17,35,18,37,19,39,20,41,
|
||||||
|
21,43,22,45,23,47,24,49,25,51,26,53,27,55,28,57,29,59,30,61,31,63,32,65,
|
||||||
|
33,67,34,69,35,71,36,73,37,75,38,77,0,1,0,28,2,0,76,76,108,108,2,0,73,73,
|
||||||
|
105,105,2,0,75,75,107,107,2,0,69,69,101,101,2,0,78,78,110,110,2,0,79,79,
|
||||||
|
111,111,2,0,84,84,116,116,2,0,9,9,32,32,2,0,66,66,98,98,2,0,87,87,119,119,
|
||||||
|
2,0,88,88,120,120,2,0,83,83,115,115,2,0,82,82,114,114,2,0,71,71,103,103,
|
||||||
|
2,0,80,80,112,112,2,0,67,67,99,99,2,0,65,65,97,97,2,0,68,68,100,100,2,0,
|
||||||
|
72,72,104,104,2,0,89,89,121,121,2,0,85,85,117,117,2,0,70,70,102,102,2,0,
|
||||||
|
34,34,92,92,2,0,39,39,92,92,4,0,48,57,65,90,95,95,97,122,6,0,46,46,48,57,
|
||||||
|
65,91,93,93,95,95,97,122,3,0,9,10,13,13,32,32,1,0,48,57,380,0,1,1,0,0,0,
|
||||||
|
0,3,1,0,0,0,0,5,1,0,0,0,0,7,1,0,0,0,0,9,1,0,0,0,0,11,1,0,0,0,0,13,1,0,0,
|
||||||
|
0,0,15,1,0,0,0,0,17,1,0,0,0,0,19,1,0,0,0,0,21,1,0,0,0,0,23,1,0,0,0,0,25,
|
||||||
|
1,0,0,0,0,27,1,0,0,0,0,29,1,0,0,0,0,31,1,0,0,0,0,33,1,0,0,0,0,35,1,0,0,
|
||||||
|
0,0,37,1,0,0,0,0,39,1,0,0,0,0,41,1,0,0,0,0,43,1,0,0,0,0,45,1,0,0,0,0,47,
|
||||||
|
1,0,0,0,0,49,1,0,0,0,0,51,1,0,0,0,0,53,1,0,0,0,0,55,1,0,0,0,0,57,1,0,0,
|
||||||
|
0,0,59,1,0,0,0,0,61,1,0,0,0,0,63,1,0,0,0,0,65,1,0,0,0,0,67,1,0,0,0,0,69,
|
||||||
|
1,0,0,0,0,71,1,0,0,0,0,73,1,0,0,0,0,75,1,0,0,0,1,79,1,0,0,0,3,81,1,0,0,
|
||||||
|
0,5,83,1,0,0,0,7,85,1,0,0,0,9,87,1,0,0,0,11,92,1,0,0,0,13,94,1,0,0,0,15,
|
||||||
|
97,1,0,0,0,17,100,1,0,0,0,19,102,1,0,0,0,21,105,1,0,0,0,23,107,1,0,0,0,
|
||||||
|
25,110,1,0,0,0,27,115,1,0,0,0,29,128,1,0,0,0,31,134,1,0,0,0,33,148,1,0,
|
||||||
|
0,0,35,156,1,0,0,0,37,172,1,0,0,0,39,180,1,0,0,0,41,196,1,0,0,0,43,203,
|
||||||
|
1,0,0,0,45,218,1,0,0,0,47,228,1,0,0,0,49,246,1,0,0,0,51,249,1,0,0,0,53,
|
||||||
|
260,1,0,0,0,55,264,1,0,0,0,57,268,1,0,0,0,59,271,1,0,0,0,61,275,1,0,0,0,
|
||||||
|
63,282,1,0,0,0,65,289,1,0,0,0,67,306,1,0,0,0,69,309,1,0,0,0,71,341,1,0,
|
||||||
|
0,0,73,343,1,0,0,0,75,351,1,0,0,0,77,357,1,0,0,0,79,80,5,40,0,0,80,2,1,
|
||||||
|
0,0,0,81,82,5,41,0,0,82,4,1,0,0,0,83,84,5,91,0,0,84,6,1,0,0,0,85,86,5,93,
|
||||||
|
0,0,86,8,1,0,0,0,87,88,5,44,0,0,88,10,1,0,0,0,89,93,5,61,0,0,90,91,5,61,
|
||||||
|
0,0,91,93,5,61,0,0,92,89,1,0,0,0,92,90,1,0,0,0,93,12,1,0,0,0,94,95,5,33,
|
||||||
|
0,0,95,96,5,61,0,0,96,14,1,0,0,0,97,98,5,60,0,0,98,99,5,62,0,0,99,16,1,
|
||||||
|
0,0,0,100,101,5,60,0,0,101,18,1,0,0,0,102,103,5,60,0,0,103,104,5,61,0,0,
|
||||||
|
104,20,1,0,0,0,105,106,5,62,0,0,106,22,1,0,0,0,107,108,5,62,0,0,108,109,
|
||||||
|
5,61,0,0,109,24,1,0,0,0,110,111,7,0,0,0,111,112,7,1,0,0,112,113,7,2,0,0,
|
||||||
|
113,114,7,3,0,0,114,26,1,0,0,0,115,116,7,4,0,0,116,117,7,5,0,0,117,119,
|
||||||
|
7,6,0,0,118,120,7,7,0,0,119,118,1,0,0,0,120,121,1,0,0,0,121,119,1,0,0,0,
|
||||||
|
121,122,1,0,0,0,122,123,1,0,0,0,123,124,7,0,0,0,124,125,7,1,0,0,125,126,
|
||||||
|
7,2,0,0,126,127,7,3,0,0,127,28,1,0,0,0,128,129,7,1,0,0,129,130,7,0,0,0,
|
||||||
|
130,131,7,1,0,0,131,132,7,2,0,0,132,133,7,3,0,0,133,30,1,0,0,0,134,135,
|
||||||
|
7,4,0,0,135,136,7,5,0,0,136,138,7,6,0,0,137,139,7,7,0,0,138,137,1,0,0,0,
|
||||||
|
139,140,1,0,0,0,140,138,1,0,0,0,140,141,1,0,0,0,141,142,1,0,0,0,142,143,
|
||||||
|
7,1,0,0,143,144,7,0,0,0,144,145,7,1,0,0,145,146,7,2,0,0,146,147,7,3,0,0,
|
||||||
|
147,32,1,0,0,0,148,149,7,8,0,0,149,150,7,3,0,0,150,151,7,6,0,0,151,152,
|
||||||
|
7,9,0,0,152,153,7,3,0,0,153,154,7,3,0,0,154,155,7,4,0,0,155,34,1,0,0,0,
|
||||||
|
156,157,7,4,0,0,157,158,7,5,0,0,158,160,7,6,0,0,159,161,7,7,0,0,160,159,
|
||||||
|
1,0,0,0,161,162,1,0,0,0,162,160,1,0,0,0,162,163,1,0,0,0,163,164,1,0,0,0,
|
||||||
|
164,165,7,8,0,0,165,166,7,3,0,0,166,167,7,6,0,0,167,168,7,9,0,0,168,169,
|
||||||
|
7,3,0,0,169,170,7,3,0,0,170,171,7,4,0,0,171,36,1,0,0,0,172,173,7,3,0,0,
|
||||||
|
173,174,7,10,0,0,174,175,7,1,0,0,175,176,7,11,0,0,176,178,7,6,0,0,177,179,
|
||||||
|
7,11,0,0,178,177,1,0,0,0,178,179,1,0,0,0,179,38,1,0,0,0,180,181,7,4,0,0,
|
||||||
|
181,182,7,5,0,0,182,184,7,6,0,0,183,185,7,7,0,0,184,183,1,0,0,0,185,186,
|
||||||
|
1,0,0,0,186,184,1,0,0,0,186,187,1,0,0,0,187,188,1,0,0,0,188,189,7,3,0,0,
|
||||||
|
189,190,7,10,0,0,190,191,7,1,0,0,191,192,7,11,0,0,192,194,7,6,0,0,193,195,
|
||||||
|
7,11,0,0,194,193,1,0,0,0,194,195,1,0,0,0,195,40,1,0,0,0,196,197,7,12,0,
|
||||||
|
0,197,198,7,3,0,0,198,199,7,13,0,0,199,200,7,3,0,0,200,201,7,10,0,0,201,
|
||||||
|
202,7,14,0,0,202,42,1,0,0,0,203,204,7,4,0,0,204,205,7,5,0,0,205,207,7,6,
|
||||||
|
0,0,206,208,7,7,0,0,207,206,1,0,0,0,208,209,1,0,0,0,209,207,1,0,0,0,209,
|
||||||
|
210,1,0,0,0,210,211,1,0,0,0,211,212,7,12,0,0,212,213,7,3,0,0,213,214,7,
|
||||||
|
13,0,0,214,215,7,3,0,0,215,216,7,10,0,0,216,217,7,14,0,0,217,44,1,0,0,0,
|
||||||
|
218,219,7,15,0,0,219,220,7,5,0,0,220,221,7,4,0,0,221,222,7,6,0,0,222,223,
|
||||||
|
7,16,0,0,223,224,7,1,0,0,224,226,7,4,0,0,225,227,7,11,0,0,226,225,1,0,0,
|
||||||
|
0,226,227,1,0,0,0,227,46,1,0,0,0,228,229,7,4,0,0,229,230,7,5,0,0,230,232,
|
||||||
|
7,6,0,0,231,233,7,7,0,0,232,231,1,0,0,0,233,234,1,0,0,0,234,232,1,0,0,0,
|
||||||
|
234,235,1,0,0,0,235,236,1,0,0,0,236,237,7,15,0,0,237,238,7,5,0,0,238,239,
|
||||||
|
7,4,0,0,239,240,7,6,0,0,240,241,7,16,0,0,241,242,7,1,0,0,242,244,7,4,0,
|
||||||
|
0,243,245,7,11,0,0,244,243,1,0,0,0,244,245,1,0,0,0,245,48,1,0,0,0,246,247,
|
||||||
|
7,1,0,0,247,248,7,4,0,0,248,50,1,0,0,0,249,250,7,4,0,0,250,251,7,5,0,0,
|
||||||
|
251,253,7,6,0,0,252,254,7,7,0,0,253,252,1,0,0,0,254,255,1,0,0,0,255,253,
|
||||||
|
1,0,0,0,255,256,1,0,0,0,256,257,1,0,0,0,257,258,7,1,0,0,258,259,7,4,0,0,
|
||||||
|
259,52,1,0,0,0,260,261,7,4,0,0,261,262,7,5,0,0,262,263,7,6,0,0,263,54,1,
|
||||||
|
0,0,0,264,265,7,16,0,0,265,266,7,4,0,0,266,267,7,17,0,0,267,56,1,0,0,0,
|
||||||
|
268,269,7,5,0,0,269,270,7,12,0,0,270,58,1,0,0,0,271,272,7,18,0,0,272,273,
|
||||||
|
7,16,0,0,273,274,7,11,0,0,274,60,1,0,0,0,275,276,7,18,0,0,276,277,7,16,
|
||||||
|
0,0,277,278,7,11,0,0,278,279,7,16,0,0,279,280,7,4,0,0,280,281,7,19,0,0,
|
||||||
|
281,62,1,0,0,0,282,283,7,18,0,0,283,284,7,16,0,0,284,285,7,11,0,0,285,286,
|
||||||
|
7,16,0,0,286,287,7,0,0,0,287,288,7,0,0,0,288,64,1,0,0,0,289,290,7,18,0,
|
||||||
|
0,290,291,7,16,0,0,291,292,7,11,0,0,292,293,7,4,0,0,293,294,7,5,0,0,294,
|
||||||
|
295,7,4,0,0,295,296,7,3,0,0,296,66,1,0,0,0,297,298,7,6,0,0,298,299,7,12,
|
||||||
|
0,0,299,300,7,20,0,0,300,307,7,3,0,0,301,302,7,21,0,0,302,303,7,16,0,0,
|
||||||
|
303,304,7,0,0,0,304,305,7,11,0,0,305,307,7,3,0,0,306,297,1,0,0,0,306,301,
|
||||||
|
1,0,0,0,307,68,1,0,0,0,308,310,3,77,38,0,309,308,1,0,0,0,310,311,1,0,0,
|
||||||
|
0,311,309,1,0,0,0,311,312,1,0,0,0,312,319,1,0,0,0,313,315,5,46,0,0,314,
|
||||||
|
316,3,77,38,0,315,314,1,0,0,0,316,317,1,0,0,0,317,315,1,0,0,0,317,318,1,
|
||||||
|
0,0,0,318,320,1,0,0,0,319,313,1,0,0,0,319,320,1,0,0,0,320,70,1,0,0,0,321,
|
||||||
|
327,5,34,0,0,322,326,8,22,0,0,323,324,5,92,0,0,324,326,9,0,0,0,325,322,
|
||||||
|
1,0,0,0,325,323,1,0,0,0,326,329,1,0,0,0,327,325,1,0,0,0,327,328,1,0,0,0,
|
||||||
|
328,330,1,0,0,0,329,327,1,0,0,0,330,342,5,34,0,0,331,337,5,39,0,0,332,336,
|
||||||
|
8,23,0,0,333,334,5,92,0,0,334,336,9,0,0,0,335,332,1,0,0,0,335,333,1,0,0,
|
||||||
|
0,336,339,1,0,0,0,337,335,1,0,0,0,337,338,1,0,0,0,338,340,1,0,0,0,339,337,
|
||||||
|
1,0,0,0,340,342,5,39,0,0,341,321,1,0,0,0,341,331,1,0,0,0,342,72,1,0,0,0,
|
||||||
|
343,347,7,24,0,0,344,346,7,25,0,0,345,344,1,0,0,0,346,349,1,0,0,0,347,345,
|
||||||
|
1,0,0,0,347,348,1,0,0,0,348,74,1,0,0,0,349,347,1,0,0,0,350,352,7,26,0,0,
|
||||||
|
351,350,1,0,0,0,352,353,1,0,0,0,353,351,1,0,0,0,353,354,1,0,0,0,354,355,
|
||||||
|
1,0,0,0,355,356,6,37,0,0,356,76,1,0,0,0,357,358,7,27,0,0,358,78,1,0,0,0,
|
||||||
|
24,0,92,121,140,162,178,186,194,209,226,234,244,255,306,311,317,319,325,
|
||||||
|
327,335,337,341,347,353,1,6,0,0];
|
||||||
|
|
||||||
|
private static __ATN: ATN;
|
||||||
|
public static get _ATN(): ATN {
|
||||||
|
if (!FilterQueryLexer.__ATN) {
|
||||||
|
FilterQueryLexer.__ATN = new ATNDeserializer().deserialize(FilterQueryLexer._serializedATN);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FilterQueryLexer.__ATN;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static DecisionsToDFA = FilterQueryLexer._ATN.decisionToState.map( (ds: DecisionState, index: number) => new DFA(ds, index) );
|
||||||
|
}
|
||||||
233
frontend/src/parser/FilterQueryListener.ts
Normal file
233
frontend/src/parser/FilterQueryListener.ts
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
// Generated from src/query-grammar/FilterQuery.g4 by ANTLR 4.13.1
|
||||||
|
|
||||||
|
import { ParseTreeListener } from 'antlr4';
|
||||||
|
|
||||||
|
import {
|
||||||
|
AndExpressionContext,
|
||||||
|
ArrayContext,
|
||||||
|
ComparisonContext,
|
||||||
|
ExpressionContext,
|
||||||
|
FullTextContext,
|
||||||
|
FunctionCallContext,
|
||||||
|
FunctionParamContext,
|
||||||
|
FunctionParamListContext,
|
||||||
|
InClauseContext,
|
||||||
|
KeyContext,
|
||||||
|
NotInClauseContext,
|
||||||
|
OrExpressionContext,
|
||||||
|
PrimaryContext,
|
||||||
|
QueryContext,
|
||||||
|
UnaryExpressionContext,
|
||||||
|
ValueContext,
|
||||||
|
ValueListContext,
|
||||||
|
} from './FilterQueryParser';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface defines a complete listener for a parse tree produced by
|
||||||
|
* `FilterQueryParser`.
|
||||||
|
*/
|
||||||
|
export default class FilterQueryListener extends ParseTreeListener {
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.query`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterQuery?: (ctx: QueryContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.query`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitQuery?: (ctx: QueryContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.expression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterExpression?: (ctx: ExpressionContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.expression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitExpression?: (ctx: ExpressionContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.orExpression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterOrExpression?: (ctx: OrExpressionContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.orExpression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitOrExpression?: (ctx: OrExpressionContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.andExpression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterAndExpression?: (ctx: AndExpressionContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.andExpression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitAndExpression?: (ctx: AndExpressionContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.unaryExpression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterUnaryExpression?: (ctx: UnaryExpressionContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.unaryExpression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitUnaryExpression?: (ctx: UnaryExpressionContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.primary`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterPrimary?: (ctx: PrimaryContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.primary`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitPrimary?: (ctx: PrimaryContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.comparison`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterComparison?: (ctx: ComparisonContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.comparison`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitComparison?: (ctx: ComparisonContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.inClause`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterInClause?: (ctx: InClauseContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.inClause`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitInClause?: (ctx: InClauseContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.notInClause`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterNotInClause?: (ctx: NotInClauseContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.notInClause`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitNotInClause?: (ctx: NotInClauseContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.valueList`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterValueList?: (ctx: ValueListContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.valueList`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitValueList?: (ctx: ValueListContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.fullText`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterFullText?: (ctx: FullTextContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.fullText`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitFullText?: (ctx: FullTextContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.functionCall`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterFunctionCall?: (ctx: FunctionCallContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.functionCall`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitFunctionCall?: (ctx: FunctionCallContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.functionParamList`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterFunctionParamList?: (ctx: FunctionParamListContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.functionParamList`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitFunctionParamList?: (ctx: FunctionParamListContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.functionParam`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterFunctionParam?: (ctx: FunctionParamContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.functionParam`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitFunctionParam?: (ctx: FunctionParamContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.array`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterArray?: (ctx: ArrayContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.array`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitArray?: (ctx: ArrayContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.value`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterValue?: (ctx: ValueContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.value`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitValue?: (ctx: ValueContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FilterQueryParser.key`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterKey?: (ctx: KeyContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FilterQueryParser.key`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitKey?: (ctx: KeyContext) => void;
|
||||||
|
}
|
||||||
3868
frontend/src/parser/FilterQueryParser.ts
Normal file
3868
frontend/src/parser/FilterQueryParser.ts
Normal file
File diff suppressed because it is too large
Load Diff
153
frontend/src/parser/FilterQueryVisitor.ts
Normal file
153
frontend/src/parser/FilterQueryVisitor.ts
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
// Generated from src/query-grammar/FilterQuery.g4 by ANTLR 4.13.1
|
||||||
|
|
||||||
|
import { ParseTreeVisitor } from 'antlr4';
|
||||||
|
|
||||||
|
import {
|
||||||
|
AndExpressionContext,
|
||||||
|
ArrayContext,
|
||||||
|
ComparisonContext,
|
||||||
|
ExpressionContext,
|
||||||
|
FullTextContext,
|
||||||
|
FunctionCallContext,
|
||||||
|
FunctionParamContext,
|
||||||
|
FunctionParamListContext,
|
||||||
|
InClauseContext,
|
||||||
|
KeyContext,
|
||||||
|
NotInClauseContext,
|
||||||
|
OrExpressionContext,
|
||||||
|
PrimaryContext,
|
||||||
|
QueryContext,
|
||||||
|
UnaryExpressionContext,
|
||||||
|
ValueContext,
|
||||||
|
ValueListContext,
|
||||||
|
} from './FilterQueryParser';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This interface defines a complete generic visitor for a parse tree produced
|
||||||
|
* by `FilterQueryParser`.
|
||||||
|
*
|
||||||
|
* @param <Result> The return type of the visit operation. Use `void` for
|
||||||
|
* operations with no return type.
|
||||||
|
*/
|
||||||
|
export default class FilterQueryVisitor<
|
||||||
|
Result
|
||||||
|
> extends ParseTreeVisitor<Result> {
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.query`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitQuery?: (ctx: QueryContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.expression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitExpression?: (ctx: ExpressionContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.orExpression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitOrExpression?: (ctx: OrExpressionContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.andExpression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitAndExpression?: (ctx: AndExpressionContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.unaryExpression`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitUnaryExpression?: (ctx: UnaryExpressionContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.primary`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitPrimary?: (ctx: PrimaryContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.comparison`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitComparison?: (ctx: ComparisonContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.inClause`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitInClause?: (ctx: InClauseContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.notInClause`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitNotInClause?: (ctx: NotInClauseContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.valueList`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitValueList?: (ctx: ValueListContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.fullText`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitFullText?: (ctx: FullTextContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.functionCall`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitFunctionCall?: (ctx: FunctionCallContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.functionParamList`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitFunctionParamList?: (ctx: FunctionParamListContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.functionParam`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitFunctionParam?: (ctx: FunctionParamContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.array`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitArray?: (ctx: ArrayContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.value`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitValue?: (ctx: ValueContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FilterQueryParser.key`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitKey?: (ctx: KeyContext) => Result;
|
||||||
|
}
|
||||||
183
frontend/src/query-grammar/FilterQuery.g4
Normal file
183
frontend/src/query-grammar/FilterQuery.g4
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
grammar FilterQuery;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Parser Rules
|
||||||
|
*/
|
||||||
|
|
||||||
|
query
|
||||||
|
: expression ( (AND | OR) expression | expression )*
|
||||||
|
EOF
|
||||||
|
;
|
||||||
|
|
||||||
|
expression
|
||||||
|
: orExpression
|
||||||
|
;
|
||||||
|
|
||||||
|
orExpression
|
||||||
|
: andExpression ( OR andExpression )*
|
||||||
|
;
|
||||||
|
|
||||||
|
andExpression
|
||||||
|
: unaryExpression ( AND unaryExpression | unaryExpression )*
|
||||||
|
;
|
||||||
|
|
||||||
|
unaryExpression
|
||||||
|
: NOT? primary
|
||||||
|
;
|
||||||
|
|
||||||
|
primary
|
||||||
|
: LPAREN orExpression RPAREN
|
||||||
|
| comparison
|
||||||
|
| functionCall
|
||||||
|
| fullText
|
||||||
|
;
|
||||||
|
|
||||||
|
comparison
|
||||||
|
: key EQUALS value
|
||||||
|
| key (NOT_EQUALS | NEQ) value
|
||||||
|
| key LT value
|
||||||
|
| key LE value
|
||||||
|
| key GT value
|
||||||
|
| key GE value
|
||||||
|
| key (LIKE | ILIKE) value
|
||||||
|
| key (NOT_LIKE | NOT_ILIKE) value
|
||||||
|
| key BETWEEN value AND value
|
||||||
|
| key NOT_BETWEEN value AND value
|
||||||
|
| key inClause
|
||||||
|
| key notInClause
|
||||||
|
| key EXISTS
|
||||||
|
| key NOT_EXISTS
|
||||||
|
| key REGEXP value
|
||||||
|
| key NOT_REGEXP value
|
||||||
|
| key CONTAINS value
|
||||||
|
| key NOT_CONTAINS value
|
||||||
|
;
|
||||||
|
|
||||||
|
inClause
|
||||||
|
: IN LPAREN valueList RPAREN
|
||||||
|
| IN LBRACK valueList RBRACK
|
||||||
|
;
|
||||||
|
|
||||||
|
notInClause
|
||||||
|
: NOT_IN LPAREN valueList RPAREN
|
||||||
|
| NOT_IN LBRACK valueList RBRACK
|
||||||
|
;
|
||||||
|
|
||||||
|
valueList
|
||||||
|
: value ( COMMA value )*
|
||||||
|
;
|
||||||
|
|
||||||
|
fullText
|
||||||
|
: QUOTED_TEXT
|
||||||
|
;
|
||||||
|
|
||||||
|
functionCall
|
||||||
|
: (HAS | HASANY | HASALL | HASNONE) LPAREN functionParamList RPAREN
|
||||||
|
;
|
||||||
|
|
||||||
|
functionParamList
|
||||||
|
: functionParam ( COMMA functionParam )*
|
||||||
|
;
|
||||||
|
|
||||||
|
functionParam
|
||||||
|
: key
|
||||||
|
| value
|
||||||
|
| array
|
||||||
|
;
|
||||||
|
|
||||||
|
array
|
||||||
|
: LBRACK valueList RBRACK
|
||||||
|
;
|
||||||
|
|
||||||
|
value
|
||||||
|
: QUOTED_TEXT
|
||||||
|
| NUMBER
|
||||||
|
| BOOL
|
||||||
|
;
|
||||||
|
|
||||||
|
key
|
||||||
|
: KEY
|
||||||
|
;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Lexer Rules
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Common punctuation / symbols
|
||||||
|
LPAREN : '(' ;
|
||||||
|
RPAREN : ')' ;
|
||||||
|
LBRACK : '[' ;
|
||||||
|
RBRACK : ']' ;
|
||||||
|
COMMA : ',' ;
|
||||||
|
|
||||||
|
EQUALS : '=' | '==' ;
|
||||||
|
NOT_EQUALS : '!=' ;
|
||||||
|
NEQ : '<>' ;
|
||||||
|
LT : '<' ;
|
||||||
|
LE : '<=' ;
|
||||||
|
GT : '>' ;
|
||||||
|
GE : '>=' ;
|
||||||
|
|
||||||
|
// Multi-keyword operators
|
||||||
|
LIKE : [Ll][Ii][Kk][Ee] ;
|
||||||
|
NOT_LIKE : [Nn][Oo][Tt] [ \t]+ [Ll][Ii][Kk][Ee] ;
|
||||||
|
ILIKE : [Ii][Ll][Ii][Kk][Ee] ;
|
||||||
|
NOT_ILIKE : [Nn][Oo][Tt] [ \t]+ [Ii][Ll][Ii][Kk][Ee] ;
|
||||||
|
BETWEEN : [Bb][Ee][Tt][Ww][Ee][Ee][Nn] ;
|
||||||
|
NOT_BETWEEN : [Nn][Oo][Tt] [ \t]+ [Bb][Ee][Tt][Ww][Ee][Ee][Nn] ;
|
||||||
|
|
||||||
|
EXISTS : [Ee][Xx][Ii][Ss][Tt][Ss]? ;
|
||||||
|
NOT_EXISTS : [Nn][Oo][Tt] [ \t]+ [Ee][Xx][Ii][Ss][Tt][Ss]? ;
|
||||||
|
|
||||||
|
REGEXP : [Rr][Ee][Gg][Ee][Xx][Pp] ;
|
||||||
|
NOT_REGEXP : [Nn][Oo][Tt] [ \t]+ [Rr][Ee][Gg][Ee][Xx][Pp] ;
|
||||||
|
|
||||||
|
CONTAINS : [Cc][Oo][Nn][Tt][Aa][Ii][Nn][Ss]? ;
|
||||||
|
NOT_CONTAINS: [Nn][Oo][Tt] [ \t]+ [Cc][Oo][Nn][Tt][Aa][Ii][Nn][Ss]? ;
|
||||||
|
|
||||||
|
IN : [Ii][Nn] ;
|
||||||
|
NOT_IN : [Nn][Oo][Tt] [ \t]+ [Ii][Nn] ;
|
||||||
|
|
||||||
|
// Boolean logic
|
||||||
|
NOT : [Nn][Oo][Tt] ;
|
||||||
|
AND : [Aa][Nn][Dd] ;
|
||||||
|
OR : [Oo][Rr] ;
|
||||||
|
|
||||||
|
// Functions
|
||||||
|
HAS : [Hh][Aa][Ss] ;
|
||||||
|
HASANY : [Hh][Aa][Ss][Aa][Nn][Yy] ;
|
||||||
|
HASALL : [Hh][Aa][Ss][Aa][Ll][Ll] ;
|
||||||
|
HASNONE : [Hh][Aa][Ss][Nn][Oo][Nn][Ee] ;
|
||||||
|
|
||||||
|
// Boolean values
|
||||||
|
BOOL
|
||||||
|
: [Tt][Rr][Uu][Ee]
|
||||||
|
| [Ff][Aa][Ll][Ss][Ee]
|
||||||
|
;
|
||||||
|
|
||||||
|
// Numbers
|
||||||
|
NUMBER
|
||||||
|
: DIGIT+ ( '.' DIGIT+ )?
|
||||||
|
;
|
||||||
|
|
||||||
|
// Quoted text
|
||||||
|
QUOTED_TEXT
|
||||||
|
: ( '"' ( ~["\\] | '\\' . )* '"' // double-quoted
|
||||||
|
| '\'' ( ~['\\] | '\\' . )* '\'' // single-quoted
|
||||||
|
)
|
||||||
|
;
|
||||||
|
|
||||||
|
// Keys
|
||||||
|
KEY
|
||||||
|
: [a-zA-Z0-9_] [a-zA-Z0-9_.[\]]*
|
||||||
|
;
|
||||||
|
|
||||||
|
// Whitespace
|
||||||
|
WS
|
||||||
|
: [ \t\r\n]+ -> skip
|
||||||
|
;
|
||||||
|
|
||||||
|
// Digits fragment
|
||||||
|
fragment DIGIT
|
||||||
|
: [0-9]
|
||||||
|
;
|
||||||
@ -31,7 +31,7 @@
|
|||||||
],
|
],
|
||||||
"types": ["node", "jest"]
|
"types": ["node", "jest"]
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules"],
|
"exclude": ["node_modules", "src/parser/*.ts"],
|
||||||
"include": [
|
"include": [
|
||||||
"./src",
|
"./src",
|
||||||
"./src/**/*.ts",
|
"./src/**/*.ts",
|
||||||
|
|||||||
@ -5310,6 +5310,11 @@ antd@5.11.0:
|
|||||||
scroll-into-view-if-needed "^3.1.0"
|
scroll-into-view-if-needed "^3.1.0"
|
||||||
throttle-debounce "^5.0.0"
|
throttle-debounce "^5.0.0"
|
||||||
|
|
||||||
|
antlr4@4.13.2:
|
||||||
|
version "4.13.2"
|
||||||
|
resolved "https://registry.yarnpkg.com/antlr4/-/antlr4-4.13.2.tgz#0d084ad0e32620482a9c3a0e2470c02e72e4006d"
|
||||||
|
integrity sha512-QiVbZhyy4xAZ17UPEuG3YTOt8ZaoeOR1CvEAqrEsDBsOqINslaB147i9xqljZqoyf5S+EUlGStaj+t22LT9MOg==
|
||||||
|
|
||||||
anymatch@^3.0.3, anymatch@~3.1.2:
|
anymatch@^3.0.3, anymatch@~3.1.2:
|
||||||
version "3.1.3"
|
version "3.1.3"
|
||||||
resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz"
|
resolved "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user