Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 476f54187f753251e9a3eec12439b2319ae025b5 (plain) (blame)
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
condition
	: orExpression ( '?' orExpression ':' orExpression )?
	;

orExpression : andExpression ( '||' andExpression )* ;

andExpression : binaryExpression ( '&&' binaryExpression )* ;

binaryExpression : notExpression ( op notExpression )?;

op : '=' | '!=' | '>' | '>=' | '<' | '<=' | '~=' ;

notExpression
	: '!' notExpression
	| collectionExpression
	;

collectionExpression
	: memberExpression ( '.' collectionFunction )*
	;

memberExpression : constructor ( ( '.' ID ) | ( '[' memberExpression ']' ) )* ;

constructor
	: ( filter | version | range | class ) '(' unaryExpression ')'
	| set '(' ( collectionExpression ( ',' collectionExpression )* )? ')'
	| unaryExpression
	;

collectionFunction
	: ( select | reject | exists | all | traverse ) '(' lambdaDefinition ')'
	| limit '(' memberExpression ')'
	| unique '(' memberExpression? ')'
	| latest '(' lambdaDefinition? ')'
	;

lambdaDefinition
	: initializer ( ',' initializer )* ( ',' '{' lambda '}' )?
	| '{' lambda '}'
	| lambda
	;

initializer
	: '_'
	| condition
	;

lambda
	: ( ID ( ',' ID )* )? '|' condition
	;

unaryExpression
	: '(' condition ')'
	| '[' condition ( ',' condition )* ']' // #array construct
	| '/' regexpPattern '/'
	| STRING
	| INT
	| parameter
	| 'null'
	| 'true'
	| 'false'
	| ID
	;

parameter
	: '$' INT | ID
	;

Back to the top