-
Notifications
You must be signed in to change notification settings - Fork 1
/
ScimFilter.g4
75 lines (57 loc) · 1.42 KB
/
ScimFilter.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
64
65
66
67
68
69
70
71
72
73
74
75
/*
* antlr-scim-filter is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text.
*
* Copyright (c) 2016, Gluu
*
* Author: Val Pecaoco
*/
grammar ScimFilter;
options
{
language = Java;
}
start
: expression* EOF
;
expression
: NOT WS+? expression # NOT_EXPR
| expression WS+? AND WS+? expression # EXPR_AND_EXPR
| expression WS+? OR WS+ expression # EXPR_OR_EXPR
| expression WS+? operator WS+? expression # EXPR_OPER_EXPR
| ATTRNAME WS+? PR # ATTR_PR
| ATTRNAME WS+? operator WS+? expression # ATTR_OPER_EXPR
| ATTRNAME WS+? operator WS+? criteria # ATTR_OPER_CRITERIA
| ATTRNAME WS+? operator WS+? criteriaValue # ATTR_OPER_VALUE
| LPAREN WS*? expression WS*? RPAREN # LPAREN_EXPR_RPAREN
| ATTRNAME LBRAC WS*? expression WS*? RBRAC # LBRAC_EXPR_RBRAC
;
criteria : '"' .+? '"';
criteriaValue :
NUMBERS | BOOLEAN
;
operator
: EQ | NE | CO | SW | EW | GT | LT | GE | LE
;
EQ : [eE][qQ];
NE : [nN][eE];
CO : [cC][oO];
SW : [sS][wW];
EW : [eE][wW];
GT : [gG][tT];
LT : [lL][tT];
GE : [gG][eE];
LE : [lL][eE];
NOT : [nN][oO][tT];
AND : [aA][nN][dD];
OR : [oO][rR];
PR : [pP][rR];
LPAREN : '(';
RPAREN : ')';
LBRAC : '[';
RBRAC : ']';
WS : ' ';
NUMBERS: [-.0-9]+;
BOOLEAN: 'true'|'false';
ATTRNAME : '$'? [-_.:a-zA-Z0-9]+;
ANY : ~('"' | '(' | ')' | '[' | ']');
EOL : [\t\r\n\u000C]+ -> skip;