Last change
on this file since 213 was
213,
checked in by oschonef, 14 years ago
|
- implement basic search feature
|
-
Property svn:eol-style set to
native
|
File size:
1.5 KB
|
Line | |
---|
1 | grammar VCRQL; |
---|
2 | |
---|
3 | options { |
---|
4 | output = AST; |
---|
5 | ASTLabelType = CommonTree; |
---|
6 | } |
---|
7 | |
---|
8 | tokens { |
---|
9 | EQ = '='; |
---|
10 | NE = '!='; |
---|
11 | OR = 'or'; |
---|
12 | AND = 'and'; |
---|
13 | OPEN = '('; |
---|
14 | CLOSE = ')'; |
---|
15 | QUERY; |
---|
16 | EXPRESSION; |
---|
17 | ENTITY; |
---|
18 | } |
---|
19 | |
---|
20 | @header { |
---|
21 | package eu.clarin.cmdi.virtualcollectionregistry.query; |
---|
22 | } |
---|
23 | |
---|
24 | @lexer::header { |
---|
25 | package eu.clarin.cmdi.virtualcollectionregistry.query; |
---|
26 | } |
---|
27 | |
---|
28 | query |
---|
29 | : expression -> ^(QUERY<QueryNode> expression) |
---|
30 | ; |
---|
31 | |
---|
32 | expression |
---|
33 | : logicalOrExpression |
---|
34 | ; |
---|
35 | |
---|
36 | logicalOrExpression |
---|
37 | : logicalAndExpression (OR<BooleanNode>^ logicalAndExpression)* |
---|
38 | ; |
---|
39 | |
---|
40 | logicalAndExpression |
---|
41 | : primaryExpression (AND<BooleanNode>^ primaryExpression)* |
---|
42 | ; |
---|
43 | |
---|
44 | primaryExpression |
---|
45 | : atom |
---|
46 | | OPEN expression CLOSE -> expression |
---|
47 | ; |
---|
48 | |
---|
49 | atom |
---|
50 | : component EQ<RelationNode>^ STRING<ValueNode> |
---|
51 | | component NE<RelationNode>^ STRING<ValueNode> |
---|
52 | ; |
---|
53 | |
---|
54 | component |
---|
55 | : ENTITY_NAME '.' PROPERTY_NAME |
---|
56 | -> ENTITY<EntityNode>[$ENTITY_NAME,$PROPERTY_NAME] |
---|
57 | ; |
---|
58 | |
---|
59 | ENTITY_NAME |
---|
60 | : 'vc' | 'creator' |
---|
61 | ; |
---|
62 | |
---|
63 | PROPERTY_NAME |
---|
64 | : ('a'..'z' | 'A' .. 'Z' | '0'..'9')+ |
---|
65 | ; |
---|
66 | |
---|
67 | STRING |
---|
68 | : '"' ( ESCAPE_SEQUENCE | ~( '\u0000'..'\u001f' | '\\' | '\"' ) )* '"' |
---|
69 | ; |
---|
70 | |
---|
71 | fragment |
---|
72 | ESCAPE_SEQUENCE |
---|
73 | : '\\' (UNICODE_ESCAPE | 'b' | 't' | 'n' | 'f' | 'r' | '\"' | '\'' | '\\') |
---|
74 | ; |
---|
75 | |
---|
76 | fragment |
---|
77 | UNICODE_ESCAPE |
---|
78 | : 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT |
---|
79 | ; |
---|
80 | |
---|
81 | fragment |
---|
82 | HEX_DIGIT |
---|
83 | : '0'..'9' | 'A'..'F' | 'a'..'f' |
---|
84 | ; |
---|
85 | |
---|
86 | fragment |
---|
87 | DIGIT |
---|
88 | : '0'..'9' |
---|
89 | ; |
---|
90 | |
---|
91 | WS |
---|
92 | : ( ' ' | '\t' | '\r' | '\n' )+ { $channel=HIDDEN; } |
---|
93 | ; |
---|
Note: See
TracBrowser
for help on using the repository browser.