File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ grammar BooleanExpression;
2+
3+ parse
4+ : expression EOF
5+ ;
6+
7+ expression
8+ : LPAREN expression RPAREN #parentExpression
9+ | NOT expression #notExpression
10+ | left=expression op=comparator right=expression #comparatorExpression
11+ | left=expression op=binary right=expression #binaryExpression
12+ | types #typesExpression
13+ | field=WORD lower=numericTypes TO upper=numericTypes #toExpression
14+ | field=WORD IN data=wordlist #inExpression
15+ ;
16+
17+ comparator
18+ : GT | GE | LT | LE | EQ | NE
19+ ;
20+
21+
22+ wordlist
23+ : LPAREN WS * first=types WS * (' ,' WS * rest=types WS *)* RPAREN
24+ ;
25+
26+
27+ numericTypes
28+ : INTEGER | DECIMAL
29+ ;
30+
31+ types
32+ : APP_VERSION | bool | WORD | INTEGER | DECIMAL
33+ ;
34+
35+
36+ binary
37+ : AND | OR
38+ ;
39+
40+ bool
41+ : TRUE | FALSE
42+ ;
43+
44+
45+ IN : ' IN' | ' in' ;
46+ TO : ' TO' | ' to' ;
47+ AND : ' AND' | ' and' | ' &&' ;
48+ OR : ' OR' | ' or' | ' ||' ;
49+ NOT : ' NOT' | ' not' ;
50+ TRUE : ' TRUE' | ' true' ;
51+ FALSE : ' FALSE' | ' false' ;
52+ NE : ' !=' ;
53+ GT : ' >' ;
54+ GE : ' >=' ;
55+ LT : ' <' ;
56+ LE : ' <=' ;
57+ EQ : ' =' ;
58+ LPAREN : ' (' ;
59+ RPAREN : ' )' ;
60+ DECIMAL : [0-9]+ ' .' [0-9]+;
61+ APP_VERSION : [0-9] (' .' INTEGER )*;
62+ INTEGER : [0-9]+;
63+ WS : [ \r\t\u000C\n]+ -> skip;
64+ WORD : (ALPHANUMERIC | ' _' | ' -' | ' .' | SQ | DQ )+;
65+ ALPHANUMERIC : [a-zA-Z0 -9];
66+ SQ : ' \' ' .*? ' \' ' ;
67+ DQ : ' "' .*? ' "' ;
You can’t perform that action at this time.
0 commit comments