-
Notifications
You must be signed in to change notification settings - Fork 11
/
equelParser.g4
63 lines (46 loc) · 1.33 KB
/
equelParser.g4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
parser grammar equelParser ;
options { tokenVocab=equelLexer; }
equel:
firstExpr ( Separator searchExpr )* ( Separator AGG aggregationExpr ( Separator aggregationExpr )* )? ( Separator POSTPROC postprocExpr ( Separator postprocExpr )* )? ( Separator OUTPUT outputExpr ( Separator outputExpr )* )? ;
verb: Identifier ;
genericExpr:
verb ( parameter )* # generic |
shortcutExpr # shortcut;
searchExpr:
genericExpr ;
queryString:
QueryStringChar+ ;
firstExpr:
searchExpr # firstSearchExpr |
queryString # queryStringExpr ;
/*
orSearchExpr:
andSearchExpr ( '||' andSearchExpr )*;
andSearchExpr:
notSearchExpr ( '&&' notSearchExpr )* ;
notSearchExpr:
'!'? searchExpr ;
*/
filterExpr:
searchExpr ;
aggregationExpr:
(AGG targetId=Identifier)? genericExpr ( AS aggId=Identifier )? ;
postprocExpr:
genericExpr ;
outputExpr:
genericExpr ( AS outId=Identifier )? ;
shortcutExpr:
PrefixChar value ;
parameter:
name Equals value # KVParam |
value # UnnamedValue |
LParL value ( LSep value )* RParL # UnnamedList |
Identifier # SingleParam ;
name:
Identifier ;
value:
UnquotedValue # SimpleUQValue |
SingleQuotedValue # SimpleSQValue |
DoubleQuotedValue # SimpleDQValue |
LParS searchExpr RParS # NestedSearch |
LParL value ( LSep value )* RParL # ValueList;