Project

General

Profile

1
// $ANTLR 3.0.1 Cql.g3 2013-07-19 13:56:26
2

    
3
	package eu.dnetlib.utils.cql;
4

    
5

    
6
import org.antlr.runtime.*;
7

    
8

    
9
import org.antlr.runtime.tree.*;
10

    
11
public class CqlParser extends Parser {
12
    public static final String[] tokenNames = new String[] {
13
        "<invalid>", "<EOR>", "<DOWN>", "<UP>", "AND", "OR", "NOT", "PROX", "WITHIN", "EXACT", "ALL", "ANY", "IDENTIFIER", "STRING", "QUOTE", "WHITESPACE", "'>'", "'='", "'/'", "'('", "')'", "'<'", "'>='", "'<='", "'<>'"
14
    };
15
    public static final int QUOTE=14;
16
    public static final int ANY=11;
17
    public static final int IDENTIFIER=12;
18
    public static final int ALL=10;
19
    public static final int OR=5;
20
    public static final int WITHIN=8;
21
    public static final int PROX=7;
22
    public static final int WHITESPACE=15;
23
    public static final int EXACT=9;
24
    public static final int NOT=6;
25
    public static final int AND=4;
26
    public static final int EOF=-1;
27
    public static final int STRING=13;
28

    
29
        public CqlParser(TokenStream input) {
30
            super(input);
31
        }
32
        
33
    protected TreeAdaptor adaptor = new CommonTreeAdaptor();
34

    
35
    public void setTreeAdaptor(TreeAdaptor adaptor) {
36
        this.adaptor = adaptor;
37
    }
38
    public TreeAdaptor getTreeAdaptor() {
39
        return adaptor;
40
    }
41

    
42
    public String[] getTokenNames() { return tokenNames; }
43
    public String getGrammarFileName() { return "Cql.g3"; }
44

    
45

    
46
      @Override
47
      public void reportError(RecognitionException e) {
48
        throw new CqlRuntimeException("Parser Error", e);
49
      }
50

    
51

    
52
    public static class cql_return extends ParserRuleReturnScope {
53
        public CqlQuery query;
54
        CommonTree tree;
55
        public Object getTree() { return tree; }
56
    };
57

    
58
    // $ANTLR start cql
59
    // Cql.g3:33:1: cql returns [CqlQuery query] : q= cqlquery ;
60
    public final cql_return cql() throws RecognitionException {
61
        cql_return retval = new cql_return();
62
        retval.start = input.LT(1);
63

    
64
        CommonTree root_0 = null;
65

    
66
        cqlquery_return q = null;
67

    
68

    
69

    
70
        try {
71
            // Cql.g3:33:30: (q= cqlquery )
72
            // Cql.g3:33:32: q= cqlquery
73
            {
74
            root_0 = (CommonTree)adaptor.nil();
75

    
76
            pushFollow(FOLLOW_cqlquery_in_cql78);
77
            q=cqlquery();
78
            _fsp--;
79

    
80
            adaptor.addChild(root_0, q.getTree());
81

    
82
            						//System.out.println("query tree: " +
83
            						//		((CommonTree)q.tree).toStringTree() );
84
            						retval.query = q.query;
85
            					
86

    
87
            }
88

    
89
            retval.stop = input.LT(-1);
90

    
91
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
92
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
93

    
94
        }
95
        catch (RecognitionException re) {
96
            reportError(re);
97
            recover(input,re);
98
        }
99
        finally {
100
        }
101
        return retval;
102
    }
103
    // $ANTLR end cql
104

    
105
    public static class cqlquery_return extends ParserRuleReturnScope {
106
        public CqlQuery query;
107
        CommonTree tree;
108
        public Object getTree() { return tree; }
109
    };
110

    
111
    // $ANTLR start cqlquery
112
    // Cql.g3:41:1: cqlquery returns [CqlQuery query] : ( qscope q= cqlquery | c= scopedClause );
113
    public final cqlquery_return cqlquery() throws RecognitionException {
114
        cqlquery_return retval = new cqlquery_return();
115
        retval.start = input.LT(1);
116

    
117
        CommonTree root_0 = null;
118

    
119
        cqlquery_return q = null;
120

    
121
        scopedClause_return c = null;
122

    
123
        qscope_return qscope1 = null;
124

    
125

    
126

    
127
        try {
128
            // Cql.g3:42:5: ( qscope q= cqlquery | c= scopedClause )
129
            int alt1=2;
130
            int LA1_0 = input.LA(1);
131

    
132
            if ( (LA1_0==16) ) {
133
                alt1=1;
134
            }
135
            else if ( ((LA1_0>=AND && LA1_0<=PROX)||(LA1_0>=IDENTIFIER && LA1_0<=STRING)||LA1_0==19) ) {
136
                alt1=2;
137
            }
138
            else {
139
                NoViableAltException nvae =
140
                    new NoViableAltException("41:1: cqlquery returns [CqlQuery query] : ( qscope q= cqlquery | c= scopedClause );", 1, 0, input);
141

    
142
                throw nvae;
143
            }
144
            switch (alt1) {
145
                case 1 :
146
                    // Cql.g3:42:7: qscope q= cqlquery
147
                    {
148
                    root_0 = (CommonTree)adaptor.nil();
149

    
150
                    pushFollow(FOLLOW_qscope_in_cqlquery104);
151
                    qscope1=qscope();
152
                    _fsp--;
153

    
154
                    pushFollow(FOLLOW_cqlquery_in_cqlquery109);
155
                    q=cqlquery();
156
                    _fsp--;
157

    
158
                    adaptor.addChild(root_0, q.getTree());
159
                     retval.query = q.query; 
160

    
161
                    }
162
                    break;
163
                case 2 :
164
                    // Cql.g3:43:7: c= scopedClause
165
                    {
166
                    root_0 = (CommonTree)adaptor.nil();
167

    
168
                    pushFollow(FOLLOW_scopedClause_in_cqlquery121);
169
                    c=scopedClause();
170
                    _fsp--;
171

    
172
                    adaptor.addChild(root_0, c.getTree());
173
                     retval.query = new CqlQuery(c.clause); 
174

    
175
                    }
176
                    break;
177

    
178
            }
179
            retval.stop = input.LT(-1);
180

    
181
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
182
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
183

    
184
        }
185
        catch (RecognitionException re) {
186
            reportError(re);
187
            recover(input,re);
188
        }
189
        finally {
190
        }
191
        return retval;
192
    }
193
    // $ANTLR end cqlquery
194

    
195
    public static class qscope_return extends ParserRuleReturnScope {
196
        CommonTree tree;
197
        public Object getTree() { return tree; }
198
    };
199

    
200
    // $ANTLR start qscope
201
    // Cql.g3:45:1: qscope : ( '>' prefix '=' uri | '>' uri );
202
    public final qscope_return qscope() throws RecognitionException {
203
        qscope_return retval = new qscope_return();
204
        retval.start = input.LT(1);
205

    
206
        CommonTree root_0 = null;
207

    
208
        Token char_literal2=null;
209
        Token char_literal4=null;
210
        Token char_literal6=null;
211
        prefix_return prefix3 = null;
212

    
213
        uri_return uri5 = null;
214

    
215
        uri_return uri7 = null;
216

    
217

    
218
        CommonTree char_literal2_tree=null;
219
        CommonTree char_literal4_tree=null;
220
        CommonTree char_literal6_tree=null;
221

    
222
        try {
223
            // Cql.g3:47:9: ( '>' prefix '=' uri | '>' uri )
224
            int alt2=2;
225
            int LA2_0 = input.LA(1);
226

    
227
            if ( (LA2_0==16) ) {
228
                switch ( input.LA(2) ) {
229
                case IDENTIFIER:
230
                    {
231
                    int LA2_2 = input.LA(3);
232

    
233
                    if ( ((LA2_2>=AND && LA2_2<=PROX)||(LA2_2>=IDENTIFIER && LA2_2<=STRING)||LA2_2==16||LA2_2==19) ) {
234
                        alt2=2;
235
                    }
236
                    else if ( (LA2_2==17) ) {
237
                        alt2=1;
238
                    }
239
                    else {
240
                        NoViableAltException nvae =
241
                            new NoViableAltException("45:1: qscope : ( '>' prefix '=' uri | '>' uri );", 2, 2, input);
242

    
243
                        throw nvae;
244
                    }
245
                    }
246
                    break;
247
                case STRING:
248
                    {
249
                    int LA2_3 = input.LA(3);
250

    
251
                    if ( ((LA2_3>=AND && LA2_3<=PROX)||(LA2_3>=IDENTIFIER && LA2_3<=STRING)||LA2_3==16||LA2_3==19) ) {
252
                        alt2=2;
253
                    }
254
                    else if ( (LA2_3==17) ) {
255
                        alt2=1;
256
                    }
257
                    else {
258
                        NoViableAltException nvae =
259
                            new NoViableAltException("45:1: qscope : ( '>' prefix '=' uri | '>' uri );", 2, 3, input);
260

    
261
                        throw nvae;
262
                    }
263
                    }
264
                    break;
265
                case AND:
266
                    {
267
                    int LA2_4 = input.LA(3);
268

    
269
                    if ( (LA2_4==17) ) {
270
                        alt2=1;
271
                    }
272
                    else if ( ((LA2_4>=AND && LA2_4<=PROX)||(LA2_4>=IDENTIFIER && LA2_4<=STRING)||LA2_4==16||LA2_4==19) ) {
273
                        alt2=2;
274
                    }
275
                    else {
276
                        NoViableAltException nvae =
277
                            new NoViableAltException("45:1: qscope : ( '>' prefix '=' uri | '>' uri );", 2, 4, input);
278

    
279
                        throw nvae;
280
                    }
281
                    }
282
                    break;
283
                case OR:
284
                    {
285
                    int LA2_5 = input.LA(3);
286

    
287
                    if ( (LA2_5==17) ) {
288
                        alt2=1;
289
                    }
290
                    else if ( ((LA2_5>=AND && LA2_5<=PROX)||(LA2_5>=IDENTIFIER && LA2_5<=STRING)||LA2_5==16||LA2_5==19) ) {
291
                        alt2=2;
292
                    }
293
                    else {
294
                        NoViableAltException nvae =
295
                            new NoViableAltException("45:1: qscope : ( '>' prefix '=' uri | '>' uri );", 2, 5, input);
296

    
297
                        throw nvae;
298
                    }
299
                    }
300
                    break;
301
                case NOT:
302
                    {
303
                    int LA2_6 = input.LA(3);
304

    
305
                    if ( (LA2_6==17) ) {
306
                        alt2=1;
307
                    }
308
                    else if ( ((LA2_6>=AND && LA2_6<=PROX)||(LA2_6>=IDENTIFIER && LA2_6<=STRING)||LA2_6==16||LA2_6==19) ) {
309
                        alt2=2;
310
                    }
311
                    else {
312
                        NoViableAltException nvae =
313
                            new NoViableAltException("45:1: qscope : ( '>' prefix '=' uri | '>' uri );", 2, 6, input);
314

    
315
                        throw nvae;
316
                    }
317
                    }
318
                    break;
319
                case PROX:
320
                    {
321
                    int LA2_7 = input.LA(3);
322

    
323
                    if ( (LA2_7==17) ) {
324
                        alt2=1;
325
                    }
326
                    else if ( ((LA2_7>=AND && LA2_7<=PROX)||(LA2_7>=IDENTIFIER && LA2_7<=STRING)||LA2_7==16||LA2_7==19) ) {
327
                        alt2=2;
328
                    }
329
                    else {
330
                        NoViableAltException nvae =
331
                            new NoViableAltException("45:1: qscope : ( '>' prefix '=' uri | '>' uri );", 2, 7, input);
332

    
333
                        throw nvae;
334
                    }
335
                    }
336
                    break;
337
                default:
338
                    NoViableAltException nvae =
339
                        new NoViableAltException("45:1: qscope : ( '>' prefix '=' uri | '>' uri );", 2, 1, input);
340

    
341
                    throw nvae;
342
                }
343

    
344
            }
345
            else {
346
                NoViableAltException nvae =
347
                    new NoViableAltException("45:1: qscope : ( '>' prefix '=' uri | '>' uri );", 2, 0, input);
348

    
349
                throw nvae;
350
            }
351
            switch (alt2) {
352
                case 1 :
353
                    // Cql.g3:47:11: '>' prefix '=' uri
354
                    {
355
                    root_0 = (CommonTree)adaptor.nil();
356

    
357
                    char_literal2=(Token)input.LT(1);
358
                    match(input,16,FOLLOW_16_in_qscope137); 
359
                    char_literal2_tree = (CommonTree)adaptor.create(char_literal2);
360
                    adaptor.addChild(root_0, char_literal2_tree);
361

    
362
                    pushFollow(FOLLOW_prefix_in_qscope139);
363
                    prefix3=prefix();
364
                    _fsp--;
365

    
366
                    adaptor.addChild(root_0, prefix3.getTree());
367
                    char_literal4=(Token)input.LT(1);
368
                    match(input,17,FOLLOW_17_in_qscope141); 
369
                    char_literal4_tree = (CommonTree)adaptor.create(char_literal4);
370
                    adaptor.addChild(root_0, char_literal4_tree);
371

    
372
                    pushFollow(FOLLOW_uri_in_qscope143);
373
                    uri5=uri();
374
                    _fsp--;
375

    
376
                    adaptor.addChild(root_0, uri5.getTree());
377

    
378
                    }
379
                    break;
380
                case 2 :
381
                    // Cql.g3:47:32: '>' uri
382
                    {
383
                    root_0 = (CommonTree)adaptor.nil();
384

    
385
                    char_literal6=(Token)input.LT(1);
386
                    match(input,16,FOLLOW_16_in_qscope147); 
387
                    char_literal6_tree = (CommonTree)adaptor.create(char_literal6);
388
                    adaptor.addChild(root_0, char_literal6_tree);
389

    
390
                    pushFollow(FOLLOW_uri_in_qscope149);
391
                    uri7=uri();
392
                    _fsp--;
393

    
394
                    adaptor.addChild(root_0, uri7.getTree());
395

    
396
                    }
397
                    break;
398

    
399
            }
400
            retval.stop = input.LT(-1);
401

    
402
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
403
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
404

    
405
        }
406
        catch (RecognitionException re) {
407
            reportError(re);
408
            recover(input,re);
409
        }
410
        finally {
411
        }
412
        return retval;
413
    }
414
    // $ANTLR end qscope
415

    
416
    public static class prefix_return extends ParserRuleReturnScope {
417
        CommonTree tree;
418
        public Object getTree() { return tree; }
419
    };
420

    
421
    // $ANTLR start prefix
422
    // Cql.g3:48:1: prefix : term ;
423
    public final prefix_return prefix() throws RecognitionException {
424
        prefix_return retval = new prefix_return();
425
        retval.start = input.LT(1);
426

    
427
        CommonTree root_0 = null;
428

    
429
        term_return term8 = null;
430

    
431

    
432

    
433
        try {
434
            // Cql.g3:48:9: ( term )
435
            // Cql.g3:48:11: term
436
            {
437
            root_0 = (CommonTree)adaptor.nil();
438

    
439
            pushFollow(FOLLOW_term_in_prefix158);
440
            term8=term();
441
            _fsp--;
442

    
443
            adaptor.addChild(root_0, term8.getTree());
444

    
445
            }
446

    
447
            retval.stop = input.LT(-1);
448

    
449
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
450
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
451

    
452
        }
453
        catch (RecognitionException re) {
454
            reportError(re);
455
            recover(input,re);
456
        }
457
        finally {
458
        }
459
        return retval;
460
    }
461
    // $ANTLR end prefix
462

    
463
    public static class uri_return extends ParserRuleReturnScope {
464
        CommonTree tree;
465
        public Object getTree() { return tree; }
466
    };
467

    
468
    // $ANTLR start uri
469
    // Cql.g3:49:1: uri : term ;
470
    public final uri_return uri() throws RecognitionException {
471
        uri_return retval = new uri_return();
472
        retval.start = input.LT(1);
473

    
474
        CommonTree root_0 = null;
475

    
476
        term_return term9 = null;
477

    
478

    
479

    
480
        try {
481
            // Cql.g3:49:7: ( term )
482
            // Cql.g3:49:9: term
483
            {
484
            root_0 = (CommonTree)adaptor.nil();
485

    
486
            pushFollow(FOLLOW_term_in_uri168);
487
            term9=term();
488
            _fsp--;
489

    
490
            adaptor.addChild(root_0, term9.getTree());
491

    
492
            }
493

    
494
            retval.stop = input.LT(-1);
495

    
496
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
497
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
498

    
499
        }
500
        catch (RecognitionException re) {
501
            reportError(re);
502
            recover(input,re);
503
        }
504
        finally {
505
        }
506
        return retval;
507
    }
508
    // $ANTLR end uri
509

    
510
    public static class scopedClause_return extends ParserRuleReturnScope {
511
        public CqlClause clause;
512
        CommonTree tree;
513
        public Object getTree() { return tree; }
514
    };
515

    
516
    // $ANTLR start scopedClause
517
    // Cql.g3:50:1: scopedClause returns [CqlClause clause] : left= searchClause (op= booleanGroup right= searchClause )* ;
518
    public final scopedClause_return scopedClause() throws RecognitionException {
519
        scopedClause_return retval = new scopedClause_return();
520
        retval.start = input.LT(1);
521

    
522
        CommonTree root_0 = null;
523

    
524
        searchClause_return left = null;
525

    
526
        booleanGroup_return op = null;
527

    
528
        searchClause_return right = null;
529

    
530

    
531

    
532
        try {
533
            // Cql.g3:53:41: (left= searchClause (op= booleanGroup right= searchClause )* )
534
            // Cql.g3:54:3: left= searchClause (op= booleanGroup right= searchClause )*
535
            {
536
            root_0 = (CommonTree)adaptor.nil();
537

    
538
            pushFollow(FOLLOW_searchClause_in_scopedClause188);
539
            left=searchClause();
540
            _fsp--;
541

    
542
            adaptor.addChild(root_0, left.getTree());
543
             retval.clause = left.clause; 
544
            // Cql.g3:55:3: (op= booleanGroup right= searchClause )*
545
            loop3:
546
            do {
547
                int alt3=2;
548
                int LA3_0 = input.LA(1);
549

    
550
                if ( ((LA3_0>=AND && LA3_0<=PROX)) ) {
551
                    alt3=1;
552
                }
553

    
554

    
555
                switch (alt3) {
556
            	case 1 :
557
            	    // Cql.g3:55:4: op= booleanGroup right= searchClause
558
            	    {
559
            	    pushFollow(FOLLOW_booleanGroup_in_scopedClause197);
560
            	    op=booleanGroup();
561
            	    _fsp--;
562

    
563
            	    root_0 = (CommonTree)adaptor.becomeRoot(op.getTree(), root_0);
564
            	    pushFollow(FOLLOW_searchClause_in_scopedClause202);
565
            	    right=searchClause();
566
            	    _fsp--;
567

    
568
            	    adaptor.addChild(root_0, right.getTree());
569
            	     retval.clause = new CqlBoolean(retval.clause, op.value, right.clause); 
570

    
571
            	    }
572
            	    break;
573

    
574
            	default :
575
            	    break loop3;
576
                }
577
            } while (true);
578

    
579

    
580
            }
581

    
582
            retval.stop = input.LT(-1);
583

    
584
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
585
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
586

    
587
        }
588
        catch (RecognitionException re) {
589
            reportError(re);
590
            recover(input,re);
591
        }
592
        finally {
593
        }
594
        return retval;
595
    }
596
    // $ANTLR end scopedClause
597

    
598
    public static class booleanGroup_return extends ParserRuleReturnScope {
599
        public String value;
600
        CommonTree tree;
601
        public Object getTree() { return tree; }
602
    };
603

    
604
    // $ANTLR start booleanGroup
605
    // Cql.g3:60:1: booleanGroup returns [String value] : b= bool ( modifierList )? ;
606
    public final booleanGroup_return booleanGroup() throws RecognitionException {
607
        booleanGroup_return retval = new booleanGroup_return();
608
        retval.start = input.LT(1);
609

    
610
        CommonTree root_0 = null;
611

    
612
        bool_return b = null;
613

    
614
        modifierList_return modifierList10 = null;
615

    
616

    
617

    
618
        try {
619
            // Cql.g3:60:37: (b= bool ( modifierList )? )
620
            // Cql.g3:61:2: b= bool ( modifierList )?
621
            {
622
            root_0 = (CommonTree)adaptor.nil();
623

    
624
            pushFollow(FOLLOW_bool_in_booleanGroup230);
625
            b=bool();
626
            _fsp--;
627

    
628
            adaptor.addChild(root_0, b.getTree());
629
            // Cql.g3:61:9: ( modifierList )?
630
            int alt4=2;
631
            int LA4_0 = input.LA(1);
632

    
633
            if ( (LA4_0==18) ) {
634
                alt4=1;
635
            }
636
            switch (alt4) {
637
                case 1 :
638
                    // Cql.g3:61:10: modifierList
639
                    {
640
                    pushFollow(FOLLOW_modifierList_in_booleanGroup233);
641
                    modifierList10=modifierList();
642
                    _fsp--;
643

    
644
                    adaptor.addChild(root_0, modifierList10.getTree());
645

    
646
                    }
647
                    break;
648

    
649
            }
650

    
651
             retval.value = b.value; 
652

    
653
            }
654

    
655
            retval.stop = input.LT(-1);
656

    
657
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
658
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
659

    
660
        }
661
        catch (RecognitionException re) {
662
            reportError(re);
663
            recover(input,re);
664
        }
665
        finally {
666
        }
667
        return retval;
668
    }
669
    // $ANTLR end booleanGroup
670

    
671
    public static class bool_return extends ParserRuleReturnScope {
672
        public String value;
673
        CommonTree tree;
674
        public Object getTree() { return tree; }
675
    };
676

    
677
    // $ANTLR start bool
678
    // Cql.g3:62:1: bool returns [String value] : ( AND | OR | NOT | PROX );
679
    public final bool_return bool() throws RecognitionException {
680
        bool_return retval = new bool_return();
681
        retval.start = input.LT(1);
682

    
683
        CommonTree root_0 = null;
684

    
685
        Token AND11=null;
686
        Token OR12=null;
687
        Token NOT13=null;
688
        Token PROX14=null;
689

    
690
        CommonTree AND11_tree=null;
691
        CommonTree OR12_tree=null;
692
        CommonTree NOT13_tree=null;
693
        CommonTree PROX14_tree=null;
694

    
695
        try {
696
            // Cql.g3:63:2: ( AND | OR | NOT | PROX )
697
            int alt5=4;
698
            switch ( input.LA(1) ) {
699
            case AND:
700
                {
701
                alt5=1;
702
                }
703
                break;
704
            case OR:
705
                {
706
                alt5=2;
707
                }
708
                break;
709
            case NOT:
710
                {
711
                alt5=3;
712
                }
713
                break;
714
            case PROX:
715
                {
716
                alt5=4;
717
                }
718
                break;
719
            default:
720
                NoViableAltException nvae =
721
                    new NoViableAltException("62:1: bool returns [String value] : ( AND | OR | NOT | PROX );", 5, 0, input);
722

    
723
                throw nvae;
724
            }
725

    
726
            switch (alt5) {
727
                case 1 :
728
                    // Cql.g3:63:4: AND
729
                    {
730
                    root_0 = (CommonTree)adaptor.nil();
731

    
732
                    AND11=(Token)input.LT(1);
733
                    match(input,AND,FOLLOW_AND_in_bool250); 
734
                    AND11_tree = (CommonTree)adaptor.create(AND11);
735
                    adaptor.addChild(root_0, AND11_tree);
736

    
737
                     retval.value = "and"; 
738

    
739
                    }
740
                    break;
741
                case 2 :
742
                    // Cql.g3:64:4: OR
743
                    {
744
                    root_0 = (CommonTree)adaptor.nil();
745

    
746
                    OR12=(Token)input.LT(1);
747
                    match(input,OR,FOLLOW_OR_in_bool257); 
748
                    OR12_tree = (CommonTree)adaptor.create(OR12);
749
                    adaptor.addChild(root_0, OR12_tree);
750

    
751
                     retval.value = "or"; 
752

    
753
                    }
754
                    break;
755
                case 3 :
756
                    // Cql.g3:65:4: NOT
757
                    {
758
                    root_0 = (CommonTree)adaptor.nil();
759

    
760
                    NOT13=(Token)input.LT(1);
761
                    match(input,NOT,FOLLOW_NOT_in_bool264); 
762
                    NOT13_tree = (CommonTree)adaptor.create(NOT13);
763
                    adaptor.addChild(root_0, NOT13_tree);
764

    
765
                     retval.value = "not"; 
766

    
767
                    }
768
                    break;
769
                case 4 :
770
                    // Cql.g3:66:4: PROX
771
                    {
772
                    root_0 = (CommonTree)adaptor.nil();
773

    
774
                    PROX14=(Token)input.LT(1);
775
                    match(input,PROX,FOLLOW_PROX_in_bool271); 
776
                    PROX14_tree = (CommonTree)adaptor.create(PROX14);
777
                    adaptor.addChild(root_0, PROX14_tree);
778

    
779
                     retval.value = "prox"; 
780

    
781
                    }
782
                    break;
783

    
784
            }
785
            retval.stop = input.LT(-1);
786

    
787
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
788
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
789

    
790
        }
791
        catch (RecognitionException re) {
792
            reportError(re);
793
            recover(input,re);
794
        }
795
        finally {
796
        }
797
        return retval;
798
    }
799
    // $ANTLR end bool
800

    
801
    public static class modifierList_return extends ParserRuleReturnScope {
802
        CommonTree tree;
803
        public Object getTree() { return tree; }
804
    };
805

    
806
    // $ANTLR start modifierList
807
    // Cql.g3:68:1: modifierList : ( modifier )+ ;
808
    public final modifierList_return modifierList() throws RecognitionException {
809
        modifierList_return retval = new modifierList_return();
810
        retval.start = input.LT(1);
811

    
812
        CommonTree root_0 = null;
813

    
814
        modifier_return modifier15 = null;
815

    
816

    
817

    
818
        try {
819
            // Cql.g3:70:14: ( ( modifier )+ )
820
            // Cql.g3:70:16: ( modifier )+
821
            {
822
            root_0 = (CommonTree)adaptor.nil();
823

    
824
            // Cql.g3:70:16: ( modifier )+
825
            int cnt6=0;
826
            loop6:
827
            do {
828
                int alt6=2;
829
                int LA6_0 = input.LA(1);
830

    
831
                if ( (LA6_0==18) ) {
832
                    alt6=1;
833
                }
834

    
835

    
836
                switch (alt6) {
837
            	case 1 :
838
            	    // Cql.g3:70:17: modifier
839
            	    {
840
            	    pushFollow(FOLLOW_modifier_in_modifierList287);
841
            	    modifier15=modifier();
842
            	    _fsp--;
843

    
844
            	    adaptor.addChild(root_0, modifier15.getTree());
845

    
846
            	    }
847
            	    break;
848

    
849
            	default :
850
            	    if ( cnt6 >= 1 ) break loop6;
851
                        EarlyExitException eee =
852
                            new EarlyExitException(6, input);
853
                        throw eee;
854
                }
855
                cnt6++;
856
            } while (true);
857

    
858

    
859
            }
860

    
861
            retval.stop = input.LT(-1);
862

    
863
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
864
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
865

    
866
        }
867
        catch (RecognitionException re) {
868
            reportError(re);
869
            recover(input,re);
870
        }
871
        finally {
872
        }
873
        return retval;
874
    }
875
    // $ANTLR end modifierList
876

    
877
    public static class modifier_return extends ParserRuleReturnScope {
878
        CommonTree tree;
879
        public Object getTree() { return tree; }
880
    };
881

    
882
    // $ANTLR start modifier
883
    // Cql.g3:71:1: modifier : ( '/' modifierName comparitorSymbol modifierValue | '/' modifierName );
884
    public final modifier_return modifier() throws RecognitionException {
885
        modifier_return retval = new modifier_return();
886
        retval.start = input.LT(1);
887

    
888
        CommonTree root_0 = null;
889

    
890
        Token char_literal16=null;
891
        Token char_literal20=null;
892
        modifierName_return modifierName17 = null;
893

    
894
        comparitorSymbol_return comparitorSymbol18 = null;
895

    
896
        modifierValue_return modifierValue19 = null;
897

    
898
        modifierName_return modifierName21 = null;
899

    
900

    
901
        CommonTree char_literal16_tree=null;
902
        CommonTree char_literal20_tree=null;
903

    
904
        try {
905
            // Cql.g3:71:11: ( '/' modifierName comparitorSymbol modifierValue | '/' modifierName )
906
            int alt7=2;
907
            int LA7_0 = input.LA(1);
908

    
909
            if ( (LA7_0==18) ) {
910
                switch ( input.LA(2) ) {
911
                case IDENTIFIER:
912
                    {
913
                    int LA7_2 = input.LA(3);
914

    
915
                    if ( ((LA7_2>=AND && LA7_2<=PROX)||(LA7_2>=IDENTIFIER && LA7_2<=STRING)||(LA7_2>=18 && LA7_2<=19)) ) {
916
                        alt7=2;
917
                    }
918
                    else if ( ((LA7_2>=16 && LA7_2<=17)||(LA7_2>=21 && LA7_2<=24)) ) {
919
                        alt7=1;
920
                    }
921
                    else {
922
                        NoViableAltException nvae =
923
                            new NoViableAltException("71:1: modifier : ( '/' modifierName comparitorSymbol modifierValue | '/' modifierName );", 7, 2, input);
924

    
925
                        throw nvae;
926
                    }
927
                    }
928
                    break;
929
                case STRING:
930
                    {
931
                    int LA7_3 = input.LA(3);
932

    
933
                    if ( ((LA7_3>=AND && LA7_3<=PROX)||(LA7_3>=IDENTIFIER && LA7_3<=STRING)||(LA7_3>=18 && LA7_3<=19)) ) {
934
                        alt7=2;
935
                    }
936
                    else if ( ((LA7_3>=16 && LA7_3<=17)||(LA7_3>=21 && LA7_3<=24)) ) {
937
                        alt7=1;
938
                    }
939
                    else {
940
                        NoViableAltException nvae =
941
                            new NoViableAltException("71:1: modifier : ( '/' modifierName comparitorSymbol modifierValue | '/' modifierName );", 7, 3, input);
942

    
943
                        throw nvae;
944
                    }
945
                    }
946
                    break;
947
                case AND:
948
                    {
949
                    int LA7_4 = input.LA(3);
950

    
951
                    if ( ((LA7_4>=16 && LA7_4<=17)||(LA7_4>=21 && LA7_4<=24)) ) {
952
                        alt7=1;
953
                    }
954
                    else if ( ((LA7_4>=AND && LA7_4<=PROX)||(LA7_4>=IDENTIFIER && LA7_4<=STRING)||(LA7_4>=18 && LA7_4<=19)) ) {
955
                        alt7=2;
956
                    }
957
                    else {
958
                        NoViableAltException nvae =
959
                            new NoViableAltException("71:1: modifier : ( '/' modifierName comparitorSymbol modifierValue | '/' modifierName );", 7, 4, input);
960

    
961
                        throw nvae;
962
                    }
963
                    }
964
                    break;
965
                case OR:
966
                    {
967
                    int LA7_5 = input.LA(3);
968

    
969
                    if ( ((LA7_5>=16 && LA7_5<=17)||(LA7_5>=21 && LA7_5<=24)) ) {
970
                        alt7=1;
971
                    }
972
                    else if ( ((LA7_5>=AND && LA7_5<=PROX)||(LA7_5>=IDENTIFIER && LA7_5<=STRING)||(LA7_5>=18 && LA7_5<=19)) ) {
973
                        alt7=2;
974
                    }
975
                    else {
976
                        NoViableAltException nvae =
977
                            new NoViableAltException("71:1: modifier : ( '/' modifierName comparitorSymbol modifierValue | '/' modifierName );", 7, 5, input);
978

    
979
                        throw nvae;
980
                    }
981
                    }
982
                    break;
983
                case NOT:
984
                    {
985
                    int LA7_6 = input.LA(3);
986

    
987
                    if ( ((LA7_6>=16 && LA7_6<=17)||(LA7_6>=21 && LA7_6<=24)) ) {
988
                        alt7=1;
989
                    }
990
                    else if ( ((LA7_6>=AND && LA7_6<=PROX)||(LA7_6>=IDENTIFIER && LA7_6<=STRING)||(LA7_6>=18 && LA7_6<=19)) ) {
991
                        alt7=2;
992
                    }
993
                    else {
994
                        NoViableAltException nvae =
995
                            new NoViableAltException("71:1: modifier : ( '/' modifierName comparitorSymbol modifierValue | '/' modifierName );", 7, 6, input);
996

    
997
                        throw nvae;
998
                    }
999
                    }
1000
                    break;
1001
                case PROX:
1002
                    {
1003
                    int LA7_7 = input.LA(3);
1004

    
1005
                    if ( ((LA7_7>=16 && LA7_7<=17)||(LA7_7>=21 && LA7_7<=24)) ) {
1006
                        alt7=1;
1007
                    }
1008
                    else if ( ((LA7_7>=AND && LA7_7<=PROX)||(LA7_7>=IDENTIFIER && LA7_7<=STRING)||(LA7_7>=18 && LA7_7<=19)) ) {
1009
                        alt7=2;
1010
                    }
1011
                    else {
1012
                        NoViableAltException nvae =
1013
                            new NoViableAltException("71:1: modifier : ( '/' modifierName comparitorSymbol modifierValue | '/' modifierName );", 7, 7, input);
1014

    
1015
                        throw nvae;
1016
                    }
1017
                    }
1018
                    break;
1019
                default:
1020
                    NoViableAltException nvae =
1021
                        new NoViableAltException("71:1: modifier : ( '/' modifierName comparitorSymbol modifierValue | '/' modifierName );", 7, 1, input);
1022

    
1023
                    throw nvae;
1024
                }
1025

    
1026
            }
1027
            else {
1028
                NoViableAltException nvae =
1029
                    new NoViableAltException("71:1: modifier : ( '/' modifierName comparitorSymbol modifierValue | '/' modifierName );", 7, 0, input);
1030

    
1031
                throw nvae;
1032
            }
1033
            switch (alt7) {
1034
                case 1 :
1035
                    // Cql.g3:71:13: '/' modifierName comparitorSymbol modifierValue
1036
                    {
1037
                    root_0 = (CommonTree)adaptor.nil();
1038

    
1039
                    char_literal16=(Token)input.LT(1);
1040
                    match(input,18,FOLLOW_18_in_modifier298); 
1041
                    char_literal16_tree = (CommonTree)adaptor.create(char_literal16);
1042
                    adaptor.addChild(root_0, char_literal16_tree);
1043

    
1044
                    pushFollow(FOLLOW_modifierName_in_modifier300);
1045
                    modifierName17=modifierName();
1046
                    _fsp--;
1047

    
1048
                    adaptor.addChild(root_0, modifierName17.getTree());
1049
                    pushFollow(FOLLOW_comparitorSymbol_in_modifier302);
1050
                    comparitorSymbol18=comparitorSymbol();
1051
                    _fsp--;
1052

    
1053
                    adaptor.addChild(root_0, comparitorSymbol18.getTree());
1054
                    pushFollow(FOLLOW_modifierValue_in_modifier304);
1055
                    modifierValue19=modifierValue();
1056
                    _fsp--;
1057

    
1058
                    adaptor.addChild(root_0, modifierValue19.getTree());
1059

    
1060
                    }
1061
                    break;
1062
                case 2 :
1063
                    // Cql.g3:72:9: '/' modifierName
1064
                    {
1065
                    root_0 = (CommonTree)adaptor.nil();
1066

    
1067
                    char_literal20=(Token)input.LT(1);
1068
                    match(input,18,FOLLOW_18_in_modifier314); 
1069
                    char_literal20_tree = (CommonTree)adaptor.create(char_literal20);
1070
                    adaptor.addChild(root_0, char_literal20_tree);
1071

    
1072
                    pushFollow(FOLLOW_modifierName_in_modifier316);
1073
                    modifierName21=modifierName();
1074
                    _fsp--;
1075

    
1076
                    adaptor.addChild(root_0, modifierName21.getTree());
1077

    
1078
                    }
1079
                    break;
1080

    
1081
            }
1082
            retval.stop = input.LT(-1);
1083

    
1084
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1085
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1086

    
1087
        }
1088
        catch (RecognitionException re) {
1089
            reportError(re);
1090
            recover(input,re);
1091
        }
1092
        finally {
1093
        }
1094
        return retval;
1095
    }
1096
    // $ANTLR end modifier
1097

    
1098
    public static class modifierName_return extends ParserRuleReturnScope {
1099
        CommonTree tree;
1100
        public Object getTree() { return tree; }
1101
    };
1102

    
1103
    // $ANTLR start modifierName
1104
    // Cql.g3:73:1: modifierName : term ;
1105
    public final modifierName_return modifierName() throws RecognitionException {
1106
        modifierName_return retval = new modifierName_return();
1107
        retval.start = input.LT(1);
1108

    
1109
        CommonTree root_0 = null;
1110

    
1111
        term_return term22 = null;
1112

    
1113

    
1114

    
1115
        try {
1116
            // Cql.g3:73:14: ( term )
1117
            // Cql.g3:73:16: term
1118
            {
1119
            root_0 = (CommonTree)adaptor.nil();
1120

    
1121
            pushFollow(FOLLOW_term_in_modifierName324);
1122
            term22=term();
1123
            _fsp--;
1124

    
1125
            adaptor.addChild(root_0, term22.getTree());
1126

    
1127
            }
1128

    
1129
            retval.stop = input.LT(-1);
1130

    
1131
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1132
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1133

    
1134
        }
1135
        catch (RecognitionException re) {
1136
            reportError(re);
1137
            recover(input,re);
1138
        }
1139
        finally {
1140
        }
1141
        return retval;
1142
    }
1143
    // $ANTLR end modifierName
1144

    
1145
    public static class modifierValue_return extends ParserRuleReturnScope {
1146
        CommonTree tree;
1147
        public Object getTree() { return tree; }
1148
    };
1149

    
1150
    // $ANTLR start modifierValue
1151
    // Cql.g3:74:1: modifierValue : term ;
1152
    public final modifierValue_return modifierValue() throws RecognitionException {
1153
        modifierValue_return retval = new modifierValue_return();
1154
        retval.start = input.LT(1);
1155

    
1156
        CommonTree root_0 = null;
1157

    
1158
        term_return term23 = null;
1159

    
1160

    
1161

    
1162
        try {
1163
            // Cql.g3:74:15: ( term )
1164
            // Cql.g3:74:17: term
1165
            {
1166
            root_0 = (CommonTree)adaptor.nil();
1167

    
1168
            pushFollow(FOLLOW_term_in_modifierValue332);
1169
            term23=term();
1170
            _fsp--;
1171

    
1172
            adaptor.addChild(root_0, term23.getTree());
1173

    
1174
            }
1175

    
1176
            retval.stop = input.LT(-1);
1177

    
1178
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1179
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1180

    
1181
        }
1182
        catch (RecognitionException re) {
1183
            reportError(re);
1184
            recover(input,re);
1185
        }
1186
        finally {
1187
        }
1188
        return retval;
1189
    }
1190
    // $ANTLR end modifierValue
1191

    
1192
    public static class searchClause_return extends ParserRuleReturnScope {
1193
        public CqlClause clause;
1194
        CommonTree tree;
1195
        public Object getTree() { return tree; }
1196
    };
1197

    
1198
    // $ANTLR start searchClause
1199
    // Cql.g3:75:1: searchClause returns [CqlClause clause] : ( '(' q= cqlquery ')' | i= index r= relation v= searchTerm | t= searchTerm );
1200
    public final searchClause_return searchClause() throws RecognitionException {
1201
        searchClause_return retval = new searchClause_return();
1202
        retval.start = input.LT(1);
1203

    
1204
        CommonTree root_0 = null;
1205

    
1206
        Token char_literal24=null;
1207
        Token char_literal25=null;
1208
        cqlquery_return q = null;
1209

    
1210
        index_return i = null;
1211

    
1212
        relation_return r = null;
1213

    
1214
        searchTerm_return v = null;
1215

    
1216
        searchTerm_return t = null;
1217

    
1218

    
1219
        CommonTree char_literal24_tree=null;
1220
        CommonTree char_literal25_tree=null;
1221

    
1222
        try {
1223
            // Cql.g3:79:6: ( '(' q= cqlquery ')' | i= index r= relation v= searchTerm | t= searchTerm )
1224
            int alt8=3;
1225
            switch ( input.LA(1) ) {
1226
            case 19:
1227
                {
1228
                alt8=1;
1229
                }
1230
                break;
1231
            case IDENTIFIER:
1232
                {
1233
                int LA8_2 = input.LA(2);
1234

    
1235
                if ( ((LA8_2>=WITHIN && LA8_2<=ANY)||(LA8_2>=16 && LA8_2<=17)||(LA8_2>=21 && LA8_2<=24)) ) {
1236
                    alt8=2;
1237
                }
1238
                else if ( (LA8_2==EOF||(LA8_2>=AND && LA8_2<=PROX)||LA8_2==20) ) {
1239
                    alt8=3;
1240
                }
1241
                else {
1242
                    NoViableAltException nvae =
1243
                        new NoViableAltException("75:1: searchClause returns [CqlClause clause] : ( '(' q= cqlquery ')' | i= index r= relation v= searchTerm | t= searchTerm );", 8, 2, input);
1244

    
1245
                    throw nvae;
1246
                }
1247
                }
1248
                break;
1249
            case STRING:
1250
                {
1251
                int LA8_3 = input.LA(2);
1252

    
1253
                if ( ((LA8_3>=WITHIN && LA8_3<=ANY)||(LA8_3>=16 && LA8_3<=17)||(LA8_3>=21 && LA8_3<=24)) ) {
1254
                    alt8=2;
1255
                }
1256
                else if ( (LA8_3==EOF||(LA8_3>=AND && LA8_3<=PROX)||LA8_3==20) ) {
1257
                    alt8=3;
1258
                }
1259
                else {
1260
                    NoViableAltException nvae =
1261
                        new NoViableAltException("75:1: searchClause returns [CqlClause clause] : ( '(' q= cqlquery ')' | i= index r= relation v= searchTerm | t= searchTerm );", 8, 3, input);
1262

    
1263
                    throw nvae;
1264
                }
1265
                }
1266
                break;
1267
            case AND:
1268
                {
1269
                int LA8_4 = input.LA(2);
1270

    
1271
                if ( (LA8_4==EOF||(LA8_4>=AND && LA8_4<=PROX)||LA8_4==20) ) {
1272
                    alt8=3;
1273
                }
1274
                else if ( ((LA8_4>=WITHIN && LA8_4<=ANY)||(LA8_4>=16 && LA8_4<=17)||(LA8_4>=21 && LA8_4<=24)) ) {
1275
                    alt8=2;
1276
                }
1277
                else {
1278
                    NoViableAltException nvae =
1279
                        new NoViableAltException("75:1: searchClause returns [CqlClause clause] : ( '(' q= cqlquery ')' | i= index r= relation v= searchTerm | t= searchTerm );", 8, 4, input);
1280

    
1281
                    throw nvae;
1282
                }
1283
                }
1284
                break;
1285
            case OR:
1286
                {
1287
                int LA8_5 = input.LA(2);
1288

    
1289
                if ( (LA8_5==EOF||(LA8_5>=AND && LA8_5<=PROX)||LA8_5==20) ) {
1290
                    alt8=3;
1291
                }
1292
                else if ( ((LA8_5>=WITHIN && LA8_5<=ANY)||(LA8_5>=16 && LA8_5<=17)||(LA8_5>=21 && LA8_5<=24)) ) {
1293
                    alt8=2;
1294
                }
1295
                else {
1296
                    NoViableAltException nvae =
1297
                        new NoViableAltException("75:1: searchClause returns [CqlClause clause] : ( '(' q= cqlquery ')' | i= index r= relation v= searchTerm | t= searchTerm );", 8, 5, input);
1298

    
1299
                    throw nvae;
1300
                }
1301
                }
1302
                break;
1303
            case NOT:
1304
                {
1305
                int LA8_6 = input.LA(2);
1306

    
1307
                if ( (LA8_6==EOF||(LA8_6>=AND && LA8_6<=PROX)||LA8_6==20) ) {
1308
                    alt8=3;
1309
                }
1310
                else if ( ((LA8_6>=WITHIN && LA8_6<=ANY)||(LA8_6>=16 && LA8_6<=17)||(LA8_6>=21 && LA8_6<=24)) ) {
1311
                    alt8=2;
1312
                }
1313
                else {
1314
                    NoViableAltException nvae =
1315
                        new NoViableAltException("75:1: searchClause returns [CqlClause clause] : ( '(' q= cqlquery ')' | i= index r= relation v= searchTerm | t= searchTerm );", 8, 6, input);
1316

    
1317
                    throw nvae;
1318
                }
1319
                }
1320
                break;
1321
            case PROX:
1322
                {
1323
                int LA8_7 = input.LA(2);
1324

    
1325
                if ( (LA8_7==EOF||(LA8_7>=AND && LA8_7<=PROX)||LA8_7==20) ) {
1326
                    alt8=3;
1327
                }
1328
                else if ( ((LA8_7>=WITHIN && LA8_7<=ANY)||(LA8_7>=16 && LA8_7<=17)||(LA8_7>=21 && LA8_7<=24)) ) {
1329
                    alt8=2;
1330
                }
1331
                else {
1332
                    NoViableAltException nvae =
1333
                        new NoViableAltException("75:1: searchClause returns [CqlClause clause] : ( '(' q= cqlquery ')' | i= index r= relation v= searchTerm | t= searchTerm );", 8, 7, input);
1334

    
1335
                    throw nvae;
1336
                }
1337
                }
1338
                break;
1339
            default:
1340
                NoViableAltException nvae =
1341
                    new NoViableAltException("75:1: searchClause returns [CqlClause clause] : ( '(' q= cqlquery ')' | i= index r= relation v= searchTerm | t= searchTerm );", 8, 0, input);
1342

    
1343
                throw nvae;
1344
            }
1345

    
1346
            switch (alt8) {
1347
                case 1 :
1348
                    // Cql.g3:79:8: '(' q= cqlquery ')'
1349
                    {
1350
                    root_0 = (CommonTree)adaptor.nil();
1351

    
1352
                    char_literal24=(Token)input.LT(1);
1353
                    match(input,19,FOLLOW_19_in_searchClause353); 
1354
                    pushFollow(FOLLOW_cqlquery_in_searchClause358);
1355
                    q=cqlquery();
1356
                    _fsp--;
1357

    
1358
                    adaptor.addChild(root_0, q.getTree());
1359
                    char_literal25=(Token)input.LT(1);
1360
                    match(input,20,FOLLOW_20_in_searchClause360); 
1361
                     retval.clause = q.query.root; 
1362

    
1363
                    }
1364
                    break;
1365
                case 2 :
1366
                    // Cql.g3:80:8: i= index r= relation v= searchTerm
1367
                    {
1368
                    root_0 = (CommonTree)adaptor.nil();
1369

    
1370
                    pushFollow(FOLLOW_index_in_searchClause374);
1371
                    i=index();
1372
                    _fsp--;
1373

    
1374
                    adaptor.addChild(root_0, i.getTree());
1375
                    pushFollow(FOLLOW_relation_in_searchClause378);
1376
                    r=relation();
1377
                    _fsp--;
1378

    
1379
                    root_0 = (CommonTree)adaptor.becomeRoot(r.getTree(), root_0);
1380
                    pushFollow(FOLLOW_searchTerm_in_searchClause383);
1381
                    v=searchTerm();
1382
                    _fsp--;
1383

    
1384
                    adaptor.addChild(root_0, v.getTree());
1385
                     retval.clause = new CqlRelation(i.value, r.value, v.value); 
1386

    
1387
                    }
1388
                    break;
1389
                case 3 :
1390
                    // Cql.g3:82:8: t= searchTerm
1391
                    {
1392
                    root_0 = (CommonTree)adaptor.nil();
1393

    
1394
                    pushFollow(FOLLOW_searchTerm_in_searchClause402);
1395
                    t=searchTerm();
1396
                    _fsp--;
1397

    
1398
                    adaptor.addChild(root_0, t.getTree());
1399
                     retval.clause = new CqlTerm(t.value); 
1400

    
1401
                    }
1402
                    break;
1403

    
1404
            }
1405
            retval.stop = input.LT(-1);
1406

    
1407
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1408
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1409

    
1410
        }
1411
        catch (RecognitionException re) {
1412
            reportError(re);
1413
            recover(input,re);
1414
        }
1415
        finally {
1416
        }
1417
        return retval;
1418
    }
1419
    // $ANTLR end searchClause
1420

    
1421
    public static class index_return extends ParserRuleReturnScope {
1422
        public String value;
1423
        CommonTree tree;
1424
        public Object getTree() { return tree; }
1425
    };
1426

    
1427
    // $ANTLR start index
1428
    // Cql.g3:84:1: index returns [String value] : t= term ;
1429
    public final index_return index() throws RecognitionException {
1430
        index_return retval = new index_return();
1431
        retval.start = input.LT(1);
1432

    
1433
        CommonTree root_0 = null;
1434

    
1435
        term_return t = null;
1436

    
1437

    
1438

    
1439
        try {
1440
            // Cql.g3:84:31: (t= term )
1441
            // Cql.g3:84:33: t= term
1442
            {
1443
            root_0 = (CommonTree)adaptor.nil();
1444

    
1445
            pushFollow(FOLLOW_term_in_index420);
1446
            t=term();
1447
            _fsp--;
1448

    
1449
            adaptor.addChild(root_0, t.getTree());
1450
             retval.value = t.value; 
1451

    
1452
            }
1453

    
1454
            retval.stop = input.LT(-1);
1455

    
1456
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1457
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1458

    
1459
        }
1460
        catch (RecognitionException re) {
1461
            reportError(re);
1462
            recover(input,re);
1463
        }
1464
        finally {
1465
        }
1466
        return retval;
1467
    }
1468
    // $ANTLR end index
1469

    
1470
    public static class relation_return extends ParserRuleReturnScope {
1471
        public String value;
1472
        CommonTree tree;
1473
        public Object getTree() { return tree; }
1474
    };
1475

    
1476
    // $ANTLR start relation
1477
    // Cql.g3:86:1: relation returns [String value] : c= comparitor ( modifierList )? ;
1478
    public final relation_return relation() throws RecognitionException {
1479
        relation_return retval = new relation_return();
1480
        retval.start = input.LT(1);
1481

    
1482
        CommonTree root_0 = null;
1483

    
1484
        comparitor_return c = null;
1485

    
1486
        modifierList_return modifierList26 = null;
1487

    
1488

    
1489

    
1490
        try {
1491
            // Cql.g3:86:33: (c= comparitor ( modifierList )? )
1492
            // Cql.g3:87:7: c= comparitor ( modifierList )?
1493
            {
1494
            root_0 = (CommonTree)adaptor.nil();
1495

    
1496
            pushFollow(FOLLOW_comparitor_in_relation444);
1497
            c=comparitor();
1498
            _fsp--;
1499

    
1500
            adaptor.addChild(root_0, c.getTree());
1501
             retval.value = c.value; 
1502
            // Cql.g3:87:42: ( modifierList )?
1503
            int alt9=2;
1504
            int LA9_0 = input.LA(1);
1505

    
1506
            if ( (LA9_0==18) ) {
1507
                alt9=1;
1508
            }
1509
            switch (alt9) {
1510
                case 1 :
1511
                    // Cql.g3:87:43: modifierList
1512
                    {
1513
                    pushFollow(FOLLOW_modifierList_in_relation449);
1514
                    modifierList26=modifierList();
1515
                    _fsp--;
1516

    
1517
                    adaptor.addChild(root_0, modifierList26.getTree());
1518

    
1519
                    }
1520
                    break;
1521

    
1522
            }
1523

    
1524

    
1525
            }
1526

    
1527
            retval.stop = input.LT(-1);
1528

    
1529
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1530
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1531

    
1532
        }
1533
        catch (RecognitionException re) {
1534
            reportError(re);
1535
            recover(input,re);
1536
        }
1537
        finally {
1538
        }
1539
        return retval;
1540
    }
1541
    // $ANTLR end relation
1542

    
1543
    public static class comparitor_return extends ParserRuleReturnScope {
1544
        public String value;
1545
        CommonTree tree;
1546
        public Object getTree() { return tree; }
1547
    };
1548

    
1549
    // $ANTLR start comparitor
1550
    // Cql.g3:88:1: comparitor returns [String value] : (s= comparitorSymbol | n= namedComparitor );
1551
    public final comparitor_return comparitor() throws RecognitionException {
1552
        comparitor_return retval = new comparitor_return();
1553
        retval.start = input.LT(1);
1554

    
1555
        CommonTree root_0 = null;
1556

    
1557
        comparitorSymbol_return s = null;
1558

    
1559
        namedComparitor_return n = null;
1560

    
1561

    
1562

    
1563
        try {
1564
            // Cql.g3:89:5: (s= comparitorSymbol | n= namedComparitor )
1565
            int alt10=2;
1566
            int LA10_0 = input.LA(1);
1567

    
1568
            if ( ((LA10_0>=16 && LA10_0<=17)||(LA10_0>=21 && LA10_0<=24)) ) {
1569
                alt10=1;
1570
            }
1571
            else if ( ((LA10_0>=WITHIN && LA10_0<=ANY)) ) {
1572
                alt10=2;
1573
            }
1574
            else {
1575
                NoViableAltException nvae =
1576
                    new NoViableAltException("88:1: comparitor returns [String value] : (s= comparitorSymbol | n= namedComparitor );", 10, 0, input);
1577

    
1578
                throw nvae;
1579
            }
1580
            switch (alt10) {
1581
                case 1 :
1582
                    // Cql.g3:89:7: s= comparitorSymbol
1583
                    {
1584
                    root_0 = (CommonTree)adaptor.nil();
1585

    
1586
                    pushFollow(FOLLOW_comparitorSymbol_in_comparitor469);
1587
                    s=comparitorSymbol();
1588
                    _fsp--;
1589

    
1590
                    adaptor.addChild(root_0, s.getTree());
1591
                     retval.value = s.value; 
1592

    
1593
                    }
1594
                    break;
1595
                case 2 :
1596
                    // Cql.g3:90:7: n= namedComparitor
1597
                    {
1598
                    root_0 = (CommonTree)adaptor.nil();
1599

    
1600
                    pushFollow(FOLLOW_namedComparitor_in_comparitor481);
1601
                    n=namedComparitor();
1602
                    _fsp--;
1603

    
1604
                    adaptor.addChild(root_0, n.getTree());
1605
                     retval.value = n.value; 
1606

    
1607
                    }
1608
                    break;
1609

    
1610
            }
1611
            retval.stop = input.LT(-1);
1612

    
1613
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1614
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1615

    
1616
        }
1617
        catch (RecognitionException re) {
1618
            reportError(re);
1619
            recover(input,re);
1620
        }
1621
        finally {
1622
        }
1623
        return retval;
1624
    }
1625
    // $ANTLR end comparitor
1626

    
1627
    public static class comparitorSymbol_return extends ParserRuleReturnScope {
1628
        public String value;
1629
        CommonTree tree;
1630
        public Object getTree() { return tree; }
1631
    };
1632

    
1633
    // $ANTLR start comparitorSymbol
1634
    // Cql.g3:91:1: comparitorSymbol returns [String value] : ( '=' | '>' | '<' | '>=' | '<=' | '<>' );
1635
    public final comparitorSymbol_return comparitorSymbol() throws RecognitionException {
1636
        comparitorSymbol_return retval = new comparitorSymbol_return();
1637
        retval.start = input.LT(1);
1638

    
1639
        CommonTree root_0 = null;
1640

    
1641
        Token char_literal27=null;
1642
        Token char_literal28=null;
1643
        Token char_literal29=null;
1644
        Token string_literal30=null;
1645
        Token string_literal31=null;
1646
        Token string_literal32=null;
1647

    
1648
        CommonTree char_literal27_tree=null;
1649
        CommonTree char_literal28_tree=null;
1650
        CommonTree char_literal29_tree=null;
1651
        CommonTree string_literal30_tree=null;
1652
        CommonTree string_literal31_tree=null;
1653
        CommonTree string_literal32_tree=null;
1654

    
1655
        try {
1656
            // Cql.g3:92:7: ( '=' | '>' | '<' | '>=' | '<=' | '<>' )
1657
            int alt11=6;
1658
            switch ( input.LA(1) ) {
1659
            case 17:
1660
                {
1661
                alt11=1;
1662
                }
1663
                break;
1664
            case 16:
1665
                {
1666
                alt11=2;
1667
                }
1668
                break;
1669
            case 21:
1670
                {
1671
                alt11=3;
1672
                }
1673
                break;
1674
            case 22:
1675
                {
1676
                alt11=4;
1677
                }
1678
                break;
1679
            case 23:
1680
                {
1681
                alt11=5;
1682
                }
1683
                break;
1684
            case 24:
1685
                {
1686
                alt11=6;
1687
                }
1688
                break;
1689
            default:
1690
                NoViableAltException nvae =
1691
                    new NoViableAltException("91:1: comparitorSymbol returns [String value] : ( '=' | '>' | '<' | '>=' | '<=' | '<>' );", 11, 0, input);
1692

    
1693
                throw nvae;
1694
            }
1695

    
1696
            switch (alt11) {
1697
                case 1 :
1698
                    // Cql.g3:92:9: '='
1699
                    {
1700
                    root_0 = (CommonTree)adaptor.nil();
1701

    
1702
                    char_literal27=(Token)input.LT(1);
1703
                    match(input,17,FOLLOW_17_in_comparitorSymbol501); 
1704
                    char_literal27_tree = (CommonTree)adaptor.create(char_literal27);
1705
                    adaptor.addChild(root_0, char_literal27_tree);
1706

    
1707
                     retval.value = "="; 
1708

    
1709
                    }
1710
                    break;
1711
                case 2 :
1712
                    // Cql.g3:93:9: '>'
1713
                    {
1714
                    root_0 = (CommonTree)adaptor.nil();
1715

    
1716
                    char_literal28=(Token)input.LT(1);
1717
                    match(input,16,FOLLOW_16_in_comparitorSymbol513); 
1718
                    char_literal28_tree = (CommonTree)adaptor.create(char_literal28);
1719
                    adaptor.addChild(root_0, char_literal28_tree);
1720

    
1721
                     retval.value = ">"; 
1722

    
1723
                    }
1724
                    break;
1725
                case 3 :
1726
                    // Cql.g3:94:9: '<'
1727
                    {
1728
                    root_0 = (CommonTree)adaptor.nil();
1729

    
1730
                    char_literal29=(Token)input.LT(1);
1731
                    match(input,21,FOLLOW_21_in_comparitorSymbol525); 
1732
                    char_literal29_tree = (CommonTree)adaptor.create(char_literal29);
1733
                    adaptor.addChild(root_0, char_literal29_tree);
1734

    
1735
                     retval.value = "<"; 
1736

    
1737
                    }
1738
                    break;
1739
                case 4 :
1740
                    // Cql.g3:95:9: '>='
1741
                    {
1742
                    root_0 = (CommonTree)adaptor.nil();
1743

    
1744
                    string_literal30=(Token)input.LT(1);
1745
                    match(input,22,FOLLOW_22_in_comparitorSymbol537); 
1746
                    string_literal30_tree = (CommonTree)adaptor.create(string_literal30);
1747
                    adaptor.addChild(root_0, string_literal30_tree);
1748

    
1749
                     retval.value = ">="; 
1750

    
1751
                    }
1752
                    break;
1753
                case 5 :
1754
                    // Cql.g3:96:9: '<='
1755
                    {
1756
                    root_0 = (CommonTree)adaptor.nil();
1757

    
1758
                    string_literal31=(Token)input.LT(1);
1759
                    match(input,23,FOLLOW_23_in_comparitorSymbol549); 
1760
                    string_literal31_tree = (CommonTree)adaptor.create(string_literal31);
1761
                    adaptor.addChild(root_0, string_literal31_tree);
1762

    
1763
                     retval.value = "<="; 
1764

    
1765
                    }
1766
                    break;
1767
                case 6 :
1768
                    // Cql.g3:97:9: '<>'
1769
                    {
1770
                    root_0 = (CommonTree)adaptor.nil();
1771

    
1772
                    string_literal32=(Token)input.LT(1);
1773
                    match(input,24,FOLLOW_24_in_comparitorSymbol561); 
1774
                    string_literal32_tree = (CommonTree)adaptor.create(string_literal32);
1775
                    adaptor.addChild(root_0, string_literal32_tree);
1776

    
1777
                     retval.value = "<>"; 
1778

    
1779
                    }
1780
                    break;
1781

    
1782
            }
1783
            retval.stop = input.LT(-1);
1784

    
1785
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1786
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1787

    
1788
        }
1789
        catch (RecognitionException re) {
1790
            reportError(re);
1791
            recover(input,re);
1792
        }
1793
        finally {
1794
        }
1795
        return retval;
1796
    }
1797
    // $ANTLR end comparitorSymbol
1798

    
1799
    public static class namedComparitor_return extends ParserRuleReturnScope {
1800
        public String value;
1801
        CommonTree tree;
1802
        public Object getTree() { return tree; }
1803
    };
1804

    
1805
    // $ANTLR start namedComparitor
1806
    // Cql.g3:99:1: namedComparitor returns [String value] : ( WITHIN | EXACT | ALL | ANY );
1807
    public final namedComparitor_return namedComparitor() throws RecognitionException {
1808
        namedComparitor_return retval = new namedComparitor_return();
1809
        retval.start = input.LT(1);
1810

    
1811
        CommonTree root_0 = null;
1812

    
1813
        Token WITHIN33=null;
1814
        Token EXACT34=null;
1815
        Token ALL35=null;
1816
        Token ANY36=null;
1817

    
1818
        CommonTree WITHIN33_tree=null;
1819
        CommonTree EXACT34_tree=null;
1820
        CommonTree ALL35_tree=null;
1821
        CommonTree ANY36_tree=null;
1822

    
1823
        try {
1824
            // Cql.g3:100:5: ( WITHIN | EXACT | ALL | ANY )
1825
            int alt12=4;
1826
            switch ( input.LA(1) ) {
1827
            case WITHIN:
1828
                {
1829
                alt12=1;
1830
                }
1831
                break;
1832
            case EXACT:
1833
                {
1834
                alt12=2;
1835
                }
1836
                break;
1837
            case ALL:
1838
                {
1839
                alt12=3;
1840
                }
1841
                break;
1842
            case ANY:
1843
                {
1844
                alt12=4;
1845
                }
1846
                break;
1847
            default:
1848
                NoViableAltException nvae =
1849
                    new NoViableAltException("99:1: namedComparitor returns [String value] : ( WITHIN | EXACT | ALL | ANY );", 12, 0, input);
1850

    
1851
                throw nvae;
1852
            }
1853

    
1854
            switch (alt12) {
1855
                case 1 :
1856
                    // Cql.g3:100:7: WITHIN
1857
                    {
1858
                    root_0 = (CommonTree)adaptor.nil();
1859

    
1860
                    WITHIN33=(Token)input.LT(1);
1861
                    match(input,WITHIN,FOLLOW_WITHIN_in_namedComparitor582); 
1862
                    WITHIN33_tree = (CommonTree)adaptor.create(WITHIN33);
1863
                    adaptor.addChild(root_0, WITHIN33_tree);
1864

    
1865
                     retval.value = "within"; 
1866

    
1867
                    }
1868
                    break;
1869
                case 2 :
1870
                    // Cql.g3:101:7: EXACT
1871
                    {
1872
                    root_0 = (CommonTree)adaptor.nil();
1873

    
1874
                    EXACT34=(Token)input.LT(1);
1875
                    match(input,EXACT,FOLLOW_EXACT_in_namedComparitor593); 
1876
                    EXACT34_tree = (CommonTree)adaptor.create(EXACT34);
1877
                    adaptor.addChild(root_0, EXACT34_tree);
1878

    
1879
                     retval.value = "exact"; 
1880

    
1881
                    }
1882
                    break;
1883
                case 3 :
1884
                    // Cql.g3:102:7: ALL
1885
                    {
1886
                    root_0 = (CommonTree)adaptor.nil();
1887

    
1888
                    ALL35=(Token)input.LT(1);
1889
                    match(input,ALL,FOLLOW_ALL_in_namedComparitor604); 
1890
                    ALL35_tree = (CommonTree)adaptor.create(ALL35);
1891
                    adaptor.addChild(root_0, ALL35_tree);
1892

    
1893
                     retval.value = "all"; 
1894

    
1895
                    }
1896
                    break;
1897
                case 4 :
1898
                    // Cql.g3:103:7: ANY
1899
                    {
1900
                    root_0 = (CommonTree)adaptor.nil();
1901

    
1902
                    ANY36=(Token)input.LT(1);
1903
                    match(input,ANY,FOLLOW_ANY_in_namedComparitor614); 
1904
                    ANY36_tree = (CommonTree)adaptor.create(ANY36);
1905
                    adaptor.addChild(root_0, ANY36_tree);
1906

    
1907
                     retval.value = "any"; 
1908

    
1909
                    }
1910
                    break;
1911

    
1912
            }
1913
            retval.stop = input.LT(-1);
1914

    
1915
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1916
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1917

    
1918
        }
1919
        catch (RecognitionException re) {
1920
            reportError(re);
1921
            recover(input,re);
1922
        }
1923
        finally {
1924
        }
1925
        return retval;
1926
    }
1927
    // $ANTLR end namedComparitor
1928

    
1929
    public static class searchTerm_return extends ParserRuleReturnScope {
1930
        public String value;
1931
        CommonTree tree;
1932
        public Object getTree() { return tree; }
1933
    };
1934

    
1935
    // $ANTLR start searchTerm
1936
    // Cql.g3:106:1: searchTerm returns [String value] : t= term ;
1937
    public final searchTerm_return searchTerm() throws RecognitionException {
1938
        searchTerm_return retval = new searchTerm_return();
1939
        retval.start = input.LT(1);
1940

    
1941
        CommonTree root_0 = null;
1942

    
1943
        term_return t = null;
1944

    
1945

    
1946

    
1947
        try {
1948
            // Cql.g3:106:36: (t= term )
1949
            // Cql.g3:106:38: t= term
1950
            {
1951
            root_0 = (CommonTree)adaptor.nil();
1952

    
1953
            pushFollow(FOLLOW_term_in_searchTerm633);
1954
            t=term();
1955
            _fsp--;
1956

    
1957
            adaptor.addChild(root_0, t.getTree());
1958
             retval.value = t.value; 
1959

    
1960
            }
1961

    
1962
            retval.stop = input.LT(-1);
1963

    
1964
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1965
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1966

    
1967
        }
1968
        catch (RecognitionException re) {
1969
            reportError(re);
1970
            recover(input,re);
1971
        }
1972
        finally {
1973
        }
1974
        return retval;
1975
    }
1976
    // $ANTLR end searchTerm
1977

    
1978
    public static class term_return extends ParserRuleReturnScope {
1979
        public String value;
1980
        CommonTree tree;
1981
        public Object getTree() { return tree; }
1982
    };
1983

    
1984
    // $ANTLR start term
1985
    // Cql.g3:108:1: term returns [String value] : (i= identifier | AND | OR | NOT | PROX );
1986
    public final term_return term() throws RecognitionException {
1987
        term_return retval = new term_return();
1988
        retval.start = input.LT(1);
1989

    
1990
        CommonTree root_0 = null;
1991

    
1992
        Token AND37=null;
1993
        Token OR38=null;
1994
        Token NOT39=null;
1995
        Token PROX40=null;
1996
        identifier_return i = null;
1997

    
1998

    
1999
        CommonTree AND37_tree=null;
2000
        CommonTree OR38_tree=null;
2001
        CommonTree NOT39_tree=null;
2002
        CommonTree PROX40_tree=null;
2003

    
2004
        try {
2005
            // Cql.g3:108:30: (i= identifier | AND | OR | NOT | PROX )
2006
            int alt13=5;
2007
            switch ( input.LA(1) ) {
2008
            case IDENTIFIER:
2009
            case STRING:
2010
                {
2011
                alt13=1;
2012
                }
2013
                break;
2014
            case AND:
2015
                {
2016
                alt13=2;
2017
                }
2018
                break;
2019
            case OR:
2020
                {
2021
                alt13=3;
2022
                }
2023
                break;
2024
            case NOT:
2025
                {
2026
                alt13=4;
2027
                }
2028
                break;
2029
            case PROX:
2030
                {
2031
                alt13=5;
2032
                }
2033
                break;
2034
            default:
2035
                NoViableAltException nvae =
2036
                    new NoViableAltException("108:1: term returns [String value] : (i= identifier | AND | OR | NOT | PROX );", 13, 0, input);
2037

    
2038
                throw nvae;
2039
            }
2040

    
2041
            switch (alt13) {
2042
                case 1 :
2043
                    // Cql.g3:109:5: i= identifier
2044
                    {
2045
                    root_0 = (CommonTree)adaptor.nil();
2046

    
2047
                    pushFollow(FOLLOW_identifier_in_term655);
2048
                    i=identifier();
2049
                    _fsp--;
2050

    
2051
                    adaptor.addChild(root_0, i.getTree());
2052
                     retval.value = i.value; 
2053

    
2054
                    }
2055
                    break;
2056
                case 2 :
2057
                    // Cql.g3:110:7: AND
2058
                    {
2059
                    root_0 = (CommonTree)adaptor.nil();
2060

    
2061
                    AND37=(Token)input.LT(1);
2062
                    match(input,AND,FOLLOW_AND_in_term665); 
2063
                    AND37_tree = (CommonTree)adaptor.create(AND37);
2064
                    adaptor.addChild(root_0, AND37_tree);
2065

    
2066
                     retval.value = "and"; 
2067

    
2068
                    }
2069
                    break;
2070
                case 3 :
2071
                    // Cql.g3:111:7: OR
2072
                    {
2073
                    root_0 = (CommonTree)adaptor.nil();
2074

    
2075
                    OR38=(Token)input.LT(1);
2076
                    match(input,OR,FOLLOW_OR_in_term675); 
2077
                    OR38_tree = (CommonTree)adaptor.create(OR38);
2078
                    adaptor.addChild(root_0, OR38_tree);
2079

    
2080
                     retval.value = "or"; 
2081

    
2082
                    }
2083
                    break;
2084
                case 4 :
2085
                    // Cql.g3:112:7: NOT
2086
                    {
2087
                    root_0 = (CommonTree)adaptor.nil();
2088

    
2089
                    NOT39=(Token)input.LT(1);
2090
                    match(input,NOT,FOLLOW_NOT_in_term685); 
2091
                    NOT39_tree = (CommonTree)adaptor.create(NOT39);
2092
                    adaptor.addChild(root_0, NOT39_tree);
2093

    
2094
                     retval.value = "not"; 
2095

    
2096
                    }
2097
                    break;
2098
                case 5 :
2099
                    // Cql.g3:113:7: PROX
2100
                    {
2101
                    root_0 = (CommonTree)adaptor.nil();
2102

    
2103
                    PROX40=(Token)input.LT(1);
2104
                    match(input,PROX,FOLLOW_PROX_in_term695); 
2105
                    PROX40_tree = (CommonTree)adaptor.create(PROX40);
2106
                    adaptor.addChild(root_0, PROX40_tree);
2107

    
2108
                     retval.value = "prox"; 
2109

    
2110
                    }
2111
                    break;
2112

    
2113
            }
2114
            retval.stop = input.LT(-1);
2115

    
2116
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
2117
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
2118

    
2119
        }
2120
        catch (RecognitionException re) {
2121
            reportError(re);
2122
            recover(input,re);
2123
        }
2124
        finally {
2125
        }
2126
        return retval;
2127
    }
2128
    // $ANTLR end term
2129

    
2130
    public static class identifier_return extends ParserRuleReturnScope {
2131
        public String value;
2132
        CommonTree tree;
2133
        public Object getTree() { return tree; }
2134
    };
2135

    
2136
    // $ANTLR start identifier
2137
    // Cql.g3:114:1: identifier returns [String value] : ( IDENTIFIER | STRING );
2138
    public final identifier_return identifier() throws RecognitionException {
2139
        identifier_return retval = new identifier_return();
2140
        retval.start = input.LT(1);
2141

    
2142
        CommonTree root_0 = null;
2143

    
2144
        Token IDENTIFIER41=null;
2145
        Token STRING42=null;
2146

    
2147
        CommonTree IDENTIFIER41_tree=null;
2148
        CommonTree STRING42_tree=null;
2149

    
2150
        try {
2151
            // Cql.g3:114:35: ( IDENTIFIER | STRING )
2152
            int alt14=2;
2153
            int LA14_0 = input.LA(1);
2154

    
2155
            if ( (LA14_0==IDENTIFIER) ) {
2156
                alt14=1;
2157
            }
2158
            else if ( (LA14_0==STRING) ) {
2159
                alt14=2;
2160
            }
2161
            else {
2162
                NoViableAltException nvae =
2163
                    new NoViableAltException("114:1: identifier returns [String value] : ( IDENTIFIER | STRING );", 14, 0, input);
2164

    
2165
                throw nvae;
2166
            }
2167
            switch (alt14) {
2168
                case 1 :
2169
                    // Cql.g3:115:5: IDENTIFIER
2170
                    {
2171
                    root_0 = (CommonTree)adaptor.nil();
2172

    
2173
                    IDENTIFIER41=(Token)input.LT(1);
2174
                    match(input,IDENTIFIER,FOLLOW_IDENTIFIER_in_identifier713); 
2175
                    IDENTIFIER41_tree = (CommonTree)adaptor.create(IDENTIFIER41);
2176
                    adaptor.addChild(root_0, IDENTIFIER41_tree);
2177

    
2178
                     retval.value = IDENTIFIER41.getText(); 
2179

    
2180
                    }
2181
                    break;
2182
                case 2 :
2183
                    // Cql.g3:116:7: STRING
2184
                    {
2185
                    root_0 = (CommonTree)adaptor.nil();
2186

    
2187
                    STRING42=(Token)input.LT(1);
2188
                    match(input,STRING,FOLLOW_STRING_in_identifier723); 
2189
                    STRING42_tree = (CommonTree)adaptor.create(STRING42);
2190
                    adaptor.addChild(root_0, STRING42_tree);
2191

    
2192
                     retval.value = STRING42.getText(); 
2193

    
2194
                    }
2195
                    break;
2196

    
2197
            }
2198
            retval.stop = input.LT(-1);
2199

    
2200
                retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
2201
                adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
2202

    
2203
        }
2204
        catch (RecognitionException re) {
2205
            reportError(re);
2206
            recover(input,re);
2207
        }
2208
        finally {
2209
        }
2210
        return retval;
2211
    }
2212
    // $ANTLR end identifier
2213

    
2214

    
2215
 
2216

    
2217
    public static final BitSet FOLLOW_cqlquery_in_cql78 = new BitSet(new long[]{0x0000000000000002L});
2218
    public static final BitSet FOLLOW_qscope_in_cqlquery104 = new BitSet(new long[]{0x00000000000930F0L});
2219
    public static final BitSet FOLLOW_cqlquery_in_cqlquery109 = new BitSet(new long[]{0x0000000000000002L});
2220
    public static final BitSet FOLLOW_scopedClause_in_cqlquery121 = new BitSet(new long[]{0x0000000000000002L});
2221
    public static final BitSet FOLLOW_16_in_qscope137 = new BitSet(new long[]{0x00000000000030F0L});
2222
    public static final BitSet FOLLOW_prefix_in_qscope139 = new BitSet(new long[]{0x0000000000020000L});
2223
    public static final BitSet FOLLOW_17_in_qscope141 = new BitSet(new long[]{0x00000000000030F0L});
2224
    public static final BitSet FOLLOW_uri_in_qscope143 = new BitSet(new long[]{0x0000000000000002L});
2225
    public static final BitSet FOLLOW_16_in_qscope147 = new BitSet(new long[]{0x00000000000030F0L});
2226
    public static final BitSet FOLLOW_uri_in_qscope149 = new BitSet(new long[]{0x0000000000000002L});
2227
    public static final BitSet FOLLOW_term_in_prefix158 = new BitSet(new long[]{0x0000000000000002L});
2228
    public static final BitSet FOLLOW_term_in_uri168 = new BitSet(new long[]{0x0000000000000002L});
2229
    public static final BitSet FOLLOW_searchClause_in_scopedClause188 = new BitSet(new long[]{0x00000000000000F2L});
2230
    public static final BitSet FOLLOW_booleanGroup_in_scopedClause197 = new BitSet(new long[]{0x00000000000830F0L});
2231
    public static final BitSet FOLLOW_searchClause_in_scopedClause202 = new BitSet(new long[]{0x00000000000000F2L});
2232
    public static final BitSet FOLLOW_bool_in_booleanGroup230 = new BitSet(new long[]{0x0000000000040002L});
2233
    public static final BitSet FOLLOW_modifierList_in_booleanGroup233 = new BitSet(new long[]{0x0000000000000002L});
2234
    public static final BitSet FOLLOW_AND_in_bool250 = new BitSet(new long[]{0x0000000000000002L});
2235
    public static final BitSet FOLLOW_OR_in_bool257 = new BitSet(new long[]{0x0000000000000002L});
2236
    public static final BitSet FOLLOW_NOT_in_bool264 = new BitSet(new long[]{0x0000000000000002L});
2237
    public static final BitSet FOLLOW_PROX_in_bool271 = new BitSet(new long[]{0x0000000000000002L});
2238
    public static final BitSet FOLLOW_modifier_in_modifierList287 = new BitSet(new long[]{0x0000000000040002L});
2239
    public static final BitSet FOLLOW_18_in_modifier298 = new BitSet(new long[]{0x00000000000030F0L});
2240
    public static final BitSet FOLLOW_modifierName_in_modifier300 = new BitSet(new long[]{0x0000000001E30000L});
2241
    public static final BitSet FOLLOW_comparitorSymbol_in_modifier302 = new BitSet(new long[]{0x00000000000030F0L});
2242
    public static final BitSet FOLLOW_modifierValue_in_modifier304 = new BitSet(new long[]{0x0000000000000002L});
2243
    public static final BitSet FOLLOW_18_in_modifier314 = new BitSet(new long[]{0x00000000000030F0L});
2244
    public static final BitSet FOLLOW_modifierName_in_modifier316 = new BitSet(new long[]{0x0000000000000002L});
2245
    public static final BitSet FOLLOW_term_in_modifierName324 = new BitSet(new long[]{0x0000000000000002L});
2246
    public static final BitSet FOLLOW_term_in_modifierValue332 = new BitSet(new long[]{0x0000000000000002L});
2247
    public static final BitSet FOLLOW_19_in_searchClause353 = new BitSet(new long[]{0x00000000000930F0L});
2248
    public static final BitSet FOLLOW_cqlquery_in_searchClause358 = new BitSet(new long[]{0x0000000000100000L});
2249
    public static final BitSet FOLLOW_20_in_searchClause360 = new BitSet(new long[]{0x0000000000000002L});
2250
    public static final BitSet FOLLOW_index_in_searchClause374 = new BitSet(new long[]{0x0000000001E30F00L});
2251
    public static final BitSet FOLLOW_relation_in_searchClause378 = new BitSet(new long[]{0x00000000000030F0L});
2252
    public static final BitSet FOLLOW_searchTerm_in_searchClause383 = new BitSet(new long[]{0x0000000000000002L});
2253
    public static final BitSet FOLLOW_searchTerm_in_searchClause402 = new BitSet(new long[]{0x0000000000000002L});
2254
    public static final BitSet FOLLOW_term_in_index420 = new BitSet(new long[]{0x0000000000000002L});
2255
    public static final BitSet FOLLOW_comparitor_in_relation444 = new BitSet(new long[]{0x0000000000040002L});
2256
    public static final BitSet FOLLOW_modifierList_in_relation449 = new BitSet(new long[]{0x0000000000000002L});
2257
    public static final BitSet FOLLOW_comparitorSymbol_in_comparitor469 = new BitSet(new long[]{0x0000000000000002L});
2258
    public static final BitSet FOLLOW_namedComparitor_in_comparitor481 = new BitSet(new long[]{0x0000000000000002L});
2259
    public static final BitSet FOLLOW_17_in_comparitorSymbol501 = new BitSet(new long[]{0x0000000000000002L});
2260
    public static final BitSet FOLLOW_16_in_comparitorSymbol513 = new BitSet(new long[]{0x0000000000000002L});
2261
    public static final BitSet FOLLOW_21_in_comparitorSymbol525 = new BitSet(new long[]{0x0000000000000002L});
2262
    public static final BitSet FOLLOW_22_in_comparitorSymbol537 = new BitSet(new long[]{0x0000000000000002L});
2263
    public static final BitSet FOLLOW_23_in_comparitorSymbol549 = new BitSet(new long[]{0x0000000000000002L});
2264
    public static final BitSet FOLLOW_24_in_comparitorSymbol561 = new BitSet(new long[]{0x0000000000000002L});
2265
    public static final BitSet FOLLOW_WITHIN_in_namedComparitor582 = new BitSet(new long[]{0x0000000000000002L});
2266
    public static final BitSet FOLLOW_EXACT_in_namedComparitor593 = new BitSet(new long[]{0x0000000000000002L});
2267
    public static final BitSet FOLLOW_ALL_in_namedComparitor604 = new BitSet(new long[]{0x0000000000000002L});
2268
    public static final BitSet FOLLOW_ANY_in_namedComparitor614 = new BitSet(new long[]{0x0000000000000002L});
2269
    public static final BitSet FOLLOW_term_in_searchTerm633 = new BitSet(new long[]{0x0000000000000002L});
2270
    public static final BitSet FOLLOW_identifier_in_term655 = new BitSet(new long[]{0x0000000000000002L});
2271
    public static final BitSet FOLLOW_AND_in_term665 = new BitSet(new long[]{0x0000000000000002L});
2272
    public static final BitSet FOLLOW_OR_in_term675 = new BitSet(new long[]{0x0000000000000002L});
2273
    public static final BitSet FOLLOW_NOT_in_term685 = new BitSet(new long[]{0x0000000000000002L});
2274
    public static final BitSet FOLLOW_PROX_in_term695 = new BitSet(new long[]{0x0000000000000002L});
2275
    public static final BitSet FOLLOW_IDENTIFIER_in_identifier713 = new BitSet(new long[]{0x0000000000000002L});
2276
    public static final BitSet FOLLOW_STRING_in_identifier723 = new BitSet(new long[]{0x0000000000000002L});
2277

    
2278
}
(6-6/10)