- Timestamp:
- 12/09/15 17:49:23 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
FCS-QL/trunk/src/main/antlr4/eu/clarin/sru/fcs/qlparser/FCSParser.g4
r6815 r6865 6 6 */ 7 7 query 8 : main_query within_part?8 : main_query (WITHIN within_part)? EOF 9 9 ; 10 10 … … 17 17 ; 18 18 19 //main_query20 // : simple_query21 // | main_query OR main_query /* or */22 // | main_query main_query /* sequence */23 // | main_query QUANTIFIER /* quatification */24 // ;25 19 26 20 main_query 27 : simple_query28 | simple_query OR main_query /* or*/29 | simple_query main_query /* sequence */30 | simple_query QUANTIFIER /* quatification */21 : query_simple /* #simpleQuery */ 22 | query_group /* #queryGroup */ 23 | query_sequence /* #querySequence */ 24 | query_disjunction /* #queryDisjunction */ 31 25 ; 32 26 33 /*34 simple_query35 : implicit_query36 | segment_query37 ;38 */39 27 40 simple_query 41 : LPAREN main_query RPAREN /* grouping */ 42 | implicit_query 43 | segment_query 28 query_disjunction 29 : (query_simple | query_sequence | query_group) 30 (OR (query_simple | query_sequence | query_group))+ 44 31 ; 45 32 46 implicit_query 33 34 query_sequence 35 : (query_simple | query_group)+ 36 ; 37 38 39 query_group 40 : L_PAREN (query_disjunction | query_sequence) R_PAREN quantifier? 41 ; 42 43 44 query_simple 45 : (query_implicit | query_segment) quantifier? 46 ; 47 48 49 quantifier 50 : (Q_ONE_OR_MORE | Q_ZERO_OR_MORE | Q_ZERO_OR_ONE | 51 ( L_CURLY_BRACKET 52 (INTEGER | 53 INTEGER? Q_COMMA INTEGER | 54 INTEGER Q_COMMA INTEGER?) R_CURLY_BRACKET)) 55 ; 56 57 58 query_implicit 47 59 : flagged_regexp 48 60 ; 49 61 50 segment_query 62 63 query_segment 51 64 : L_SQUARE_BRACKET expression? R_SQUARE_BRACKET /* [ expression? ] */ 52 65 ; 66 53 67 54 68 within_part … … 56 70 ; 57 71 72 58 73 simple_within_part 59 : WITHIN SIMPLE_WITHIN_SCOPE 60 ; 61 62 //expression 63 // : basic_expression # basicExpression 64 // | expression OR expression # orExpression /* or */ 65 // | expression AND expression # andExpression /* and */ 66 // | LPAREN expression RPAREN # groupedExpression /* grouping */ 67 // | NOT expression # notExpression /* not */ 68 // ; 69 70 expression 71 : basic_expression # basicExpression 72 | expression OR expression # orExpression /* or */ 73 | expression AND expression # andExpression /* and */ 74 ; 75 76 /* 77 basic_expression 78 : attribute OPERATOR flagged_regexp 79 ; 80 */ 81 82 basic_expression 83 : LPAREN expression RPAREN # groupedExpression /* grouping */ 84 | NOT expression # notExpression /* not */ 85 | attribute OPERATOR flagged_regexp #basicAttrOpFlaggedRegex 74 : SIMPLE_WITHIN_SCOPE 86 75 ; 87 76 88 77 78 expression 79 : expression_basic 80 | expression_not 81 | expression_group 82 | expression_or 83 | expression_and 84 ; 85 86 87 expression_or 88 : (expression_basic | expression_group | expression_not | expression_and) 89 (OR (expression_basic | expression_group | expression_not | expression_and))+ 90 ; 91 92 93 expression_and 94 : (expression_basic | expression_group | expression_not) 95 (AND (expression_basic | expression_group | expression_not))+ 96 ; 97 98 99 100 expression_group 101 : L_PAREN (expression_basic | expression_not | expression_or | expression_and) R_PAREN 102 ; 103 104 105 expression_not 106 : NOT (expression_basic | expression_not | expression_or | expression_and) 107 ; 108 109 110 expression_basic 111 : attribute (OPERATOR_EQ | OPERATOR_NE) flagged_regexp 112 ; 113 89 114 attribute 90 : SIMPLE_ATTRIBUTE # simpleAttribute 91 | QUALIFIED_ATTRIBUTE # qualifiedAttribute 115 : (qualifier COLON)? identifier 116 ; 117 118 qualifier 119 : (IDENTIFIER | WITHIN | SIMPLE_WITHIN_SCOPE | REGEXP_FLAGS) 120 ; 121 122 identifier 123 : (IDENTIFIER | WITHIN | SIMPLE_WITHIN_SCOPE | REGEXP_FLAGS) 92 124 ; 93 125 94 126 flagged_regexp 95 : REGEXP # regexp 96 | REGEXP FWD_SLASH REGEXP_FLAG+ # flaggedRegexp 127 : REGEXP (FWD_SLASH REGEXP_FLAGS)? 97 128 ;
Note: See TracChangeset
for help on using the changeset viewer.