Version 1.7.4
[gae.git] / java / src / main / com / google / appengine / api / search / ExpressionParser.java
bloba720b7c793f5f904ae450adc76c978562c620f2c
3 package com.google.appengine.api.search;
5 import org.antlr.runtime.*;
7 import org.antlr.runtime.tree.*;
9 public class ExpressionParser extends Parser {
10 public static final String[] tokenNames = new String[] {
11 "<invalid>", "<EOR>", "<DOWN>", "<UP>", "NEG", "INDEX", "FN", "LT", "LE", "GT", "GE", "EQ", "NE", "PLUS", "MINUS", "TIMES", "DIV", "LPAREN", "RPAREN", "LSQUARE", "INT", "RSQUARE", "NAME", "FLOAT", "PHRASE", "DIGIT", "QUOTE", "ESC_SEQ", "EXPONENT", "NAME_START", "WS", "ASCII_LETTER", "UNDERSCORE", "DOLLAR", "HEX_DIGIT", "UNICODE_ESC", "OCTAL_ESC", "'.'", "','", "'abs'", "'count'", "'distance'", "'geopoint'", "'if'", "'len'", "'log'", "'max'", "'min'", "'pow'", "'snippet'"
13 public static final int DOLLAR=33;
14 public static final int LT=7;
15 public static final int EXPONENT=28;
16 public static final int LSQUARE=19;
17 public static final int ASCII_LETTER=31;
18 public static final int OCTAL_ESC=36;
19 public static final int FLOAT=23;
20 public static final int NAME_START=29;
21 public static final int EOF=-1;
22 public static final int LPAREN=17;
23 public static final int INDEX=5;
24 public static final int RPAREN=18;
25 public static final int QUOTE=26;
26 public static final int NAME=22;
27 public static final int ESC_SEQ=27;
28 public static final int PLUS=13;
29 public static final int DIGIT=25;
30 public static final int EQ=11;
31 public static final int NE=12;
32 public static final int T__42=42;
33 public static final int T__43=43;
34 public static final int T__40=40;
35 public static final int GE=10;
36 public static final int T__41=41;
37 public static final int T__46=46;
38 public static final int T__47=47;
39 public static final int T__44=44;
40 public static final int T__45=45;
41 public static final int T__48=48;
42 public static final int T__49=49;
43 public static final int UNICODE_ESC=35;
44 public static final int HEX_DIGIT=34;
45 public static final int UNDERSCORE=32;
46 public static final int INT=20;
47 public static final int FN=6;
48 public static final int MINUS=14;
49 public static final int RSQUARE=21;
50 public static final int PHRASE=24;
51 public static final int WS=30;
52 public static final int T__37=37;
53 public static final int T__38=38;
54 public static final int T__39=39;
55 public static final int NEG=4;
56 public static final int GT=9;
57 public static final int DIV=16;
58 public static final int TIMES=15;
59 public static final int LE=8;
61 public ExpressionParser(TokenStream input) {
62 this(input, new RecognizerSharedState());
64 public ExpressionParser(TokenStream input, RecognizerSharedState state) {
65 super(input, state);
69 protected TreeAdaptor adaptor = new CommonTreeAdaptor();
71 public void setTreeAdaptor(TreeAdaptor adaptor) {
72 this.adaptor = adaptor;
74 public TreeAdaptor getTreeAdaptor() {
75 return adaptor;
78 public String[] getTokenNames() { return ExpressionParser.tokenNames; }
79 public String getGrammarFileName() { return "java/com/google/appengine/api/search/Expression.g"; }
81 @Override
82 public Object recoverFromMismatchedSet(IntStream input,
83 RecognitionException e, BitSet follow) throws RecognitionException {
84 throw e;
87 @Override
88 protected Object recoverFromMismatchedToken(
89 IntStream input, int ttype, BitSet follow) throws RecognitionException {
90 throw new MismatchedTokenException(ttype, input);
93 public static class expression_return extends ParserRuleReturnScope {
94 CommonTree tree;
95 public Object getTree() { return tree; }
98 public final ExpressionParser.expression_return expression() throws RecognitionException {
99 ExpressionParser.expression_return retval = new ExpressionParser.expression_return();
100 retval.start = input.LT(1);
102 CommonTree root_0 = null;
104 Token EOF2=null;
105 ExpressionParser.cmpExpr_return cmpExpr1 = null;
107 CommonTree EOF2_tree=null;
109 try {
111 root_0 = (CommonTree)adaptor.nil();
113 pushFollow(FOLLOW_cmpExpr_in_expression87);
114 cmpExpr1=cmpExpr();
116 state._fsp--;
118 adaptor.addChild(root_0, cmpExpr1.getTree());
119 EOF2=(Token)match(input,EOF,FOLLOW_EOF_in_expression89);
120 EOF2_tree = (CommonTree)adaptor.create(EOF2);
121 adaptor.addChild(root_0, EOF2_tree);
125 retval.stop = input.LT(-1);
127 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
128 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
132 catch (RecognitionException e) {
133 reportError(e);
134 throw e;
136 finally {
138 return retval;
141 public static class cmpExpr_return extends ParserRuleReturnScope {
142 CommonTree tree;
143 public Object getTree() { return tree; }
146 public final ExpressionParser.cmpExpr_return cmpExpr() throws RecognitionException {
147 ExpressionParser.cmpExpr_return retval = new ExpressionParser.cmpExpr_return();
148 retval.start = input.LT(1);
150 CommonTree root_0 = null;
152 ExpressionParser.addExpr_return addExpr3 = null;
154 ExpressionParser.cmpOp_return cmpOp4 = null;
156 ExpressionParser.addExpr_return addExpr5 = null;
158 try {
160 root_0 = (CommonTree)adaptor.nil();
162 pushFollow(FOLLOW_addExpr_in_cmpExpr102);
163 addExpr3=addExpr();
165 state._fsp--;
167 adaptor.addChild(root_0, addExpr3.getTree());
168 int alt1=2;
169 int LA1_0 = input.LA(1);
171 if ( ((LA1_0>=LT && LA1_0<=NE)) ) {
172 alt1=1;
174 switch (alt1) {
175 case 1 :
177 pushFollow(FOLLOW_cmpOp_in_cmpExpr105);
178 cmpOp4=cmpOp();
180 state._fsp--;
182 root_0 = (CommonTree)adaptor.becomeRoot(cmpOp4.getTree(), root_0);
183 pushFollow(FOLLOW_addExpr_in_cmpExpr108);
184 addExpr5=addExpr();
186 state._fsp--;
188 adaptor.addChild(root_0, addExpr5.getTree());
191 break;
197 retval.stop = input.LT(-1);
199 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
200 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
204 catch (RecognitionException e) {
205 reportError(e);
206 throw e;
208 finally {
210 return retval;
213 public static class cmpOp_return extends ParserRuleReturnScope {
214 CommonTree tree;
215 public Object getTree() { return tree; }
218 public final ExpressionParser.cmpOp_return cmpOp() throws RecognitionException {
219 ExpressionParser.cmpOp_return retval = new ExpressionParser.cmpOp_return();
220 retval.start = input.LT(1);
222 CommonTree root_0 = null;
224 Token set6=null;
226 CommonTree set6_tree=null;
228 try {
230 root_0 = (CommonTree)adaptor.nil();
232 set6=(Token)input.LT(1);
233 if ( (input.LA(1)>=LT && input.LA(1)<=NE) ) {
234 input.consume();
235 adaptor.addChild(root_0, (CommonTree)adaptor.create(set6));
236 state.errorRecovery=false;
238 else {
239 MismatchedSetException mse = new MismatchedSetException(null,input);
240 throw mse;
245 retval.stop = input.LT(-1);
247 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
248 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
252 catch (RecognitionException e) {
253 reportError(e);
254 throw e;
256 finally {
258 return retval;
261 public static class addExpr_return extends ParserRuleReturnScope {
262 CommonTree tree;
263 public Object getTree() { return tree; }
266 public final ExpressionParser.addExpr_return addExpr() throws RecognitionException {
267 ExpressionParser.addExpr_return retval = new ExpressionParser.addExpr_return();
268 retval.start = input.LT(1);
270 CommonTree root_0 = null;
272 ExpressionParser.multExpr_return multExpr7 = null;
274 ExpressionParser.addOp_return addOp8 = null;
276 ExpressionParser.multExpr_return multExpr9 = null;
278 try {
280 root_0 = (CommonTree)adaptor.nil();
282 pushFollow(FOLLOW_multExpr_in_addExpr166);
283 multExpr7=multExpr();
285 state._fsp--;
287 adaptor.addChild(root_0, multExpr7.getTree());
288 loop2:
289 do {
290 int alt2=2;
291 int LA2_0 = input.LA(1);
293 if ( ((LA2_0>=PLUS && LA2_0<=MINUS)) ) {
294 alt2=1;
297 switch (alt2) {
298 case 1 :
300 pushFollow(FOLLOW_addOp_in_addExpr169);
301 addOp8=addOp();
303 state._fsp--;
305 root_0 = (CommonTree)adaptor.becomeRoot(addOp8.getTree(), root_0);
306 pushFollow(FOLLOW_multExpr_in_addExpr172);
307 multExpr9=multExpr();
309 state._fsp--;
311 adaptor.addChild(root_0, multExpr9.getTree());
314 break;
316 default :
317 break loop2;
319 } while (true);
323 retval.stop = input.LT(-1);
325 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
326 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
330 catch (RecognitionException e) {
331 reportError(e);
332 throw e;
334 finally {
336 return retval;
339 public static class addOp_return extends ParserRuleReturnScope {
340 CommonTree tree;
341 public Object getTree() { return tree; }
344 public final ExpressionParser.addOp_return addOp() throws RecognitionException {
345 ExpressionParser.addOp_return retval = new ExpressionParser.addOp_return();
346 retval.start = input.LT(1);
348 CommonTree root_0 = null;
350 Token set10=null;
352 CommonTree set10_tree=null;
354 try {
356 root_0 = (CommonTree)adaptor.nil();
358 set10=(Token)input.LT(1);
359 if ( (input.LA(1)>=PLUS && input.LA(1)<=MINUS) ) {
360 input.consume();
361 adaptor.addChild(root_0, (CommonTree)adaptor.create(set10));
362 state.errorRecovery=false;
364 else {
365 MismatchedSetException mse = new MismatchedSetException(null,input);
366 throw mse;
371 retval.stop = input.LT(-1);
373 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
374 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
378 catch (RecognitionException e) {
379 reportError(e);
380 throw e;
382 finally {
384 return retval;
387 public static class multExpr_return extends ParserRuleReturnScope {
388 CommonTree tree;
389 public Object getTree() { return tree; }
392 public final ExpressionParser.multExpr_return multExpr() throws RecognitionException {
393 ExpressionParser.multExpr_return retval = new ExpressionParser.multExpr_return();
394 retval.start = input.LT(1);
396 CommonTree root_0 = null;
398 ExpressionParser.unary_return unary11 = null;
400 ExpressionParser.multOp_return multOp12 = null;
402 ExpressionParser.unary_return unary13 = null;
404 try {
406 root_0 = (CommonTree)adaptor.nil();
408 pushFollow(FOLLOW_unary_in_multExpr206);
409 unary11=unary();
411 state._fsp--;
413 adaptor.addChild(root_0, unary11.getTree());
414 loop3:
415 do {
416 int alt3=2;
417 int LA3_0 = input.LA(1);
419 if ( ((LA3_0>=TIMES && LA3_0<=DIV)) ) {
420 alt3=1;
423 switch (alt3) {
424 case 1 :
426 pushFollow(FOLLOW_multOp_in_multExpr209);
427 multOp12=multOp();
429 state._fsp--;
431 root_0 = (CommonTree)adaptor.becomeRoot(multOp12.getTree(), root_0);
432 pushFollow(FOLLOW_unary_in_multExpr212);
433 unary13=unary();
435 state._fsp--;
437 adaptor.addChild(root_0, unary13.getTree());
440 break;
442 default :
443 break loop3;
445 } while (true);
449 retval.stop = input.LT(-1);
451 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
452 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
456 catch (RecognitionException e) {
457 reportError(e);
458 throw e;
460 finally {
462 return retval;
465 public static class multOp_return extends ParserRuleReturnScope {
466 CommonTree tree;
467 public Object getTree() { return tree; }
470 public final ExpressionParser.multOp_return multOp() throws RecognitionException {
471 ExpressionParser.multOp_return retval = new ExpressionParser.multOp_return();
472 retval.start = input.LT(1);
474 CommonTree root_0 = null;
476 Token set14=null;
478 CommonTree set14_tree=null;
480 try {
482 root_0 = (CommonTree)adaptor.nil();
484 set14=(Token)input.LT(1);
485 if ( (input.LA(1)>=TIMES && input.LA(1)<=DIV) ) {
486 input.consume();
487 adaptor.addChild(root_0, (CommonTree)adaptor.create(set14));
488 state.errorRecovery=false;
490 else {
491 MismatchedSetException mse = new MismatchedSetException(null,input);
492 throw mse;
497 retval.stop = input.LT(-1);
499 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
500 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
504 catch (RecognitionException e) {
505 reportError(e);
506 throw e;
508 finally {
510 return retval;
513 public static class unary_return extends ParserRuleReturnScope {
514 CommonTree tree;
515 public Object getTree() { return tree; }
518 public final ExpressionParser.unary_return unary() throws RecognitionException {
519 ExpressionParser.unary_return retval = new ExpressionParser.unary_return();
520 retval.start = input.LT(1);
522 CommonTree root_0 = null;
524 Token MINUS15=null;
525 ExpressionParser.atom_return atom16 = null;
527 ExpressionParser.atom_return atom17 = null;
529 CommonTree MINUS15_tree=null;
530 RewriteRuleTokenStream stream_MINUS=new RewriteRuleTokenStream(adaptor,"token MINUS");
531 RewriteRuleSubtreeStream stream_atom=new RewriteRuleSubtreeStream(adaptor,"rule atom");
532 try {
533 int alt4=2;
534 int LA4_0 = input.LA(1);
536 if ( (LA4_0==MINUS) ) {
537 alt4=1;
539 else if ( (LA4_0==LPAREN||LA4_0==INT||(LA4_0>=NAME && LA4_0<=PHRASE)||(LA4_0>=39 && LA4_0<=49)) ) {
540 alt4=2;
542 else {
543 NoViableAltException nvae =
544 new NoViableAltException("", 4, 0, input);
546 throw nvae;
548 switch (alt4) {
549 case 1 :
551 MINUS15=(Token)match(input,MINUS,FOLLOW_MINUS_in_unary246);
552 stream_MINUS.add(MINUS15);
554 pushFollow(FOLLOW_atom_in_unary248);
555 atom16=atom();
557 state._fsp--;
559 stream_atom.add(atom16.getTree());
561 retval.tree = root_0;
562 RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
564 root_0 = (CommonTree)adaptor.nil();
567 CommonTree root_1 = (CommonTree)adaptor.nil();
568 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(NEG, "-"), root_1);
570 adaptor.addChild(root_1, stream_atom.nextTree());
572 adaptor.addChild(root_0, root_1);
577 retval.tree = root_0;
579 break;
580 case 2 :
582 root_0 = (CommonTree)adaptor.nil();
584 pushFollow(FOLLOW_atom_in_unary263);
585 atom17=atom();
587 state._fsp--;
589 adaptor.addChild(root_0, atom17.getTree());
592 break;
595 retval.stop = input.LT(-1);
597 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
598 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
602 catch (RecognitionException e) {
603 reportError(e);
604 throw e;
606 finally {
608 return retval;
611 public static class atom_return extends ParserRuleReturnScope {
612 CommonTree tree;
613 public Object getTree() { return tree; }
616 public final ExpressionParser.atom_return atom() throws RecognitionException {
617 ExpressionParser.atom_return retval = new ExpressionParser.atom_return();
618 retval.start = input.LT(1);
620 CommonTree root_0 = null;
622 Token LPAREN22=null;
623 Token RPAREN24=null;
624 ExpressionParser.var_return var18 = null;
626 ExpressionParser.num_return num19 = null;
628 ExpressionParser.str_return str20 = null;
630 ExpressionParser.fn_return fn21 = null;
632 ExpressionParser.addExpr_return addExpr23 = null;
634 CommonTree LPAREN22_tree=null;
635 CommonTree RPAREN24_tree=null;
636 RewriteRuleTokenStream stream_RPAREN=new RewriteRuleTokenStream(adaptor,"token RPAREN");
637 RewriteRuleTokenStream stream_LPAREN=new RewriteRuleTokenStream(adaptor,"token LPAREN");
638 RewriteRuleSubtreeStream stream_addExpr=new RewriteRuleSubtreeStream(adaptor,"rule addExpr");
639 try {
640 int alt5=5;
641 switch ( input.LA(1) ) {
642 case NAME:
644 alt5=1;
646 break;
647 case INT:
648 case FLOAT:
650 alt5=2;
652 break;
653 case PHRASE:
655 alt5=3;
657 break;
658 case 39:
659 case 40:
660 case 41:
661 case 42:
662 case 43:
663 case 44:
664 case 45:
665 case 46:
666 case 47:
667 case 48:
668 case 49:
670 alt5=4;
672 break;
673 case LPAREN:
675 alt5=5;
677 break;
678 default:
679 NoViableAltException nvae =
680 new NoViableAltException("", 5, 0, input);
682 throw nvae;
685 switch (alt5) {
686 case 1 :
688 root_0 = (CommonTree)adaptor.nil();
690 pushFollow(FOLLOW_var_in_atom276);
691 var18=var();
693 state._fsp--;
695 adaptor.addChild(root_0, var18.getTree());
698 break;
699 case 2 :
701 root_0 = (CommonTree)adaptor.nil();
703 pushFollow(FOLLOW_num_in_atom282);
704 num19=num();
706 state._fsp--;
708 adaptor.addChild(root_0, num19.getTree());
711 break;
712 case 3 :
714 root_0 = (CommonTree)adaptor.nil();
716 pushFollow(FOLLOW_str_in_atom288);
717 str20=str();
719 state._fsp--;
721 adaptor.addChild(root_0, str20.getTree());
724 break;
725 case 4 :
727 root_0 = (CommonTree)adaptor.nil();
729 pushFollow(FOLLOW_fn_in_atom294);
730 fn21=fn();
732 state._fsp--;
734 adaptor.addChild(root_0, fn21.getTree());
737 break;
738 case 5 :
740 LPAREN22=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_atom300);
741 stream_LPAREN.add(LPAREN22);
743 pushFollow(FOLLOW_addExpr_in_atom302);
744 addExpr23=addExpr();
746 state._fsp--;
748 stream_addExpr.add(addExpr23.getTree());
749 RPAREN24=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_atom304);
750 stream_RPAREN.add(RPAREN24);
752 retval.tree = root_0;
753 RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
755 root_0 = (CommonTree)adaptor.nil();
757 adaptor.addChild(root_0, stream_addExpr.nextTree());
761 retval.tree = root_0;
763 break;
766 retval.stop = input.LT(-1);
768 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
769 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
773 catch (RecognitionException e) {
774 reportError(e);
775 throw e;
777 finally {
779 return retval;
782 public static class var_return extends ParserRuleReturnScope {
783 CommonTree tree;
784 public Object getTree() { return tree; }
787 public final ExpressionParser.var_return var() throws RecognitionException {
788 ExpressionParser.var_return retval = new ExpressionParser.var_return();
789 retval.start = input.LT(1);
791 CommonTree root_0 = null;
793 ExpressionParser.name_return name25 = null;
795 ExpressionParser.name_return name26 = null;
797 ExpressionParser.index_return index27 = null;
799 RewriteRuleSubtreeStream stream_index=new RewriteRuleSubtreeStream(adaptor,"rule index");
800 RewriteRuleSubtreeStream stream_name=new RewriteRuleSubtreeStream(adaptor,"rule name");
801 try {
802 int alt6=2;
803 alt6 = dfa6.predict(input);
804 switch (alt6) {
805 case 1 :
807 root_0 = (CommonTree)adaptor.nil();
809 pushFollow(FOLLOW_name_in_var321);
810 name25=name();
812 state._fsp--;
814 adaptor.addChild(root_0, name25.getTree());
817 break;
818 case 2 :
820 pushFollow(FOLLOW_name_in_var327);
821 name26=name();
823 state._fsp--;
825 stream_name.add(name26.getTree());
826 pushFollow(FOLLOW_index_in_var329);
827 index27=index();
829 state._fsp--;
831 stream_index.add(index27.getTree());
833 retval.tree = root_0;
834 RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
836 root_0 = (CommonTree)adaptor.nil();
839 CommonTree root_1 = (CommonTree)adaptor.nil();
840 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(INDEX, (index27!=null?input.toString(index27.start,index27.stop):null)), root_1);
842 adaptor.addChild(root_1, stream_name.nextTree());
844 adaptor.addChild(root_0, root_1);
849 retval.tree = root_0;
851 break;
854 retval.stop = input.LT(-1);
856 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
857 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
861 catch (RecognitionException e) {
862 reportError(e);
863 throw e;
865 finally {
867 return retval;
870 public static class index_return extends ParserRuleReturnScope {
871 CommonTree tree;
872 public Object getTree() { return tree; }
875 public final ExpressionParser.index_return index() throws RecognitionException {
876 ExpressionParser.index_return retval = new ExpressionParser.index_return();
877 retval.start = input.LT(1);
879 CommonTree root_0 = null;
881 Token x=null;
882 Token LSQUARE28=null;
883 Token RSQUARE29=null;
885 CommonTree x_tree=null;
886 CommonTree LSQUARE28_tree=null;
887 CommonTree RSQUARE29_tree=null;
888 RewriteRuleTokenStream stream_INT=new RewriteRuleTokenStream(adaptor,"token INT");
889 RewriteRuleTokenStream stream_LSQUARE=new RewriteRuleTokenStream(adaptor,"token LSQUARE");
890 RewriteRuleTokenStream stream_RSQUARE=new RewriteRuleTokenStream(adaptor,"token RSQUARE");
892 try {
894 LSQUARE28=(Token)match(input,LSQUARE,FOLLOW_LSQUARE_in_index351);
895 stream_LSQUARE.add(LSQUARE28);
897 x=(Token)match(input,INT,FOLLOW_INT_in_index355);
898 stream_INT.add(x);
900 RSQUARE29=(Token)match(input,RSQUARE,FOLLOW_RSQUARE_in_index357);
901 stream_RSQUARE.add(RSQUARE29);
903 retval.tree = root_0;
904 RewriteRuleTokenStream stream_x=new RewriteRuleTokenStream(adaptor,"token x",x);
905 RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
907 root_0 = (CommonTree)adaptor.nil();
909 adaptor.addChild(root_0, stream_x.nextNode());
913 retval.tree = root_0;
916 retval.stop = input.LT(-1);
918 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
919 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
923 catch (RecognitionException e) {
924 reportError(e);
925 throw e;
927 finally {
929 return retval;
932 public static class name_return extends ParserRuleReturnScope {
933 CommonTree tree;
934 public Object getTree() { return tree; }
937 public final ExpressionParser.name_return name() throws RecognitionException {
938 ExpressionParser.name_return retval = new ExpressionParser.name_return();
939 retval.start = input.LT(1);
941 CommonTree root_0 = null;
943 Token NAME30=null;
944 Token char_literal31=null;
945 Token NAME32=null;
947 CommonTree NAME30_tree=null;
948 CommonTree char_literal31_tree=null;
949 CommonTree NAME32_tree=null;
951 try {
953 root_0 = (CommonTree)adaptor.nil();
955 NAME30=(Token)match(input,NAME,FOLLOW_NAME_in_name375);
956 NAME30_tree = (CommonTree)adaptor.create(NAME30);
957 adaptor.addChild(root_0, NAME30_tree);
959 loop7:
960 do {
961 int alt7=2;
962 int LA7_0 = input.LA(1);
964 if ( (LA7_0==37) ) {
965 alt7=1;
968 switch (alt7) {
969 case 1 :
971 char_literal31=(Token)match(input,37,FOLLOW_37_in_name378);
972 char_literal31_tree = (CommonTree)adaptor.create(char_literal31);
973 root_0 = (CommonTree)adaptor.becomeRoot(char_literal31_tree, root_0);
975 NAME32=(Token)match(input,NAME,FOLLOW_NAME_in_name381);
976 NAME32_tree = (CommonTree)adaptor.create(NAME32);
977 adaptor.addChild(root_0, NAME32_tree);
980 break;
982 default :
983 break loop7;
985 } while (true);
989 retval.stop = input.LT(-1);
991 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
992 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
996 catch (RecognitionException e) {
997 reportError(e);
998 throw e;
1000 finally {
1002 return retval;
1005 public static class num_return extends ParserRuleReturnScope {
1006 CommonTree tree;
1007 public Object getTree() { return tree; }
1010 public final ExpressionParser.num_return num() throws RecognitionException {
1011 ExpressionParser.num_return retval = new ExpressionParser.num_return();
1012 retval.start = input.LT(1);
1014 CommonTree root_0 = null;
1016 Token set33=null;
1018 CommonTree set33_tree=null;
1020 try {
1022 root_0 = (CommonTree)adaptor.nil();
1024 set33=(Token)input.LT(1);
1025 if ( input.LA(1)==INT||input.LA(1)==FLOAT ) {
1026 input.consume();
1027 adaptor.addChild(root_0, (CommonTree)adaptor.create(set33));
1028 state.errorRecovery=false;
1030 else {
1031 MismatchedSetException mse = new MismatchedSetException(null,input);
1032 throw mse;
1037 retval.stop = input.LT(-1);
1039 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1040 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1044 catch (RecognitionException e) {
1045 reportError(e);
1046 throw e;
1048 finally {
1050 return retval;
1053 public static class str_return extends ParserRuleReturnScope {
1054 CommonTree tree;
1055 public Object getTree() { return tree; }
1058 public final ExpressionParser.str_return str() throws RecognitionException {
1059 ExpressionParser.str_return retval = new ExpressionParser.str_return();
1060 retval.start = input.LT(1);
1062 CommonTree root_0 = null;
1064 Token PHRASE34=null;
1066 CommonTree PHRASE34_tree=null;
1068 try {
1070 root_0 = (CommonTree)adaptor.nil();
1072 PHRASE34=(Token)match(input,PHRASE,FOLLOW_PHRASE_in_str415);
1073 PHRASE34_tree = (CommonTree)adaptor.create(PHRASE34);
1074 adaptor.addChild(root_0, PHRASE34_tree);
1078 retval.stop = input.LT(-1);
1080 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1081 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1085 catch (RecognitionException e) {
1086 reportError(e);
1087 throw e;
1089 finally {
1091 return retval;
1094 public static class fn_return extends ParserRuleReturnScope {
1095 CommonTree tree;
1096 public Object getTree() { return tree; }
1099 public final ExpressionParser.fn_return fn() throws RecognitionException {
1100 ExpressionParser.fn_return retval = new ExpressionParser.fn_return();
1101 retval.start = input.LT(1);
1103 CommonTree root_0 = null;
1105 Token LPAREN36=null;
1106 Token char_literal38=null;
1107 Token RPAREN40=null;
1108 ExpressionParser.fnName_return fnName35 = null;
1110 ExpressionParser.cmpExpr_return cmpExpr37 = null;
1112 ExpressionParser.cmpExpr_return cmpExpr39 = null;
1114 CommonTree LPAREN36_tree=null;
1115 CommonTree char_literal38_tree=null;
1116 CommonTree RPAREN40_tree=null;
1117 RewriteRuleTokenStream stream_RPAREN=new RewriteRuleTokenStream(adaptor,"token RPAREN");
1118 RewriteRuleTokenStream stream_LPAREN=new RewriteRuleTokenStream(adaptor,"token LPAREN");
1119 RewriteRuleTokenStream stream_38=new RewriteRuleTokenStream(adaptor,"token 38");
1120 RewriteRuleSubtreeStream stream_fnName=new RewriteRuleSubtreeStream(adaptor,"rule fnName");
1121 RewriteRuleSubtreeStream stream_cmpExpr=new RewriteRuleSubtreeStream(adaptor,"rule cmpExpr");
1122 try {
1124 pushFollow(FOLLOW_fnName_in_fn428);
1125 fnName35=fnName();
1127 state._fsp--;
1129 stream_fnName.add(fnName35.getTree());
1130 LPAREN36=(Token)match(input,LPAREN,FOLLOW_LPAREN_in_fn430);
1131 stream_LPAREN.add(LPAREN36);
1133 pushFollow(FOLLOW_cmpExpr_in_fn432);
1134 cmpExpr37=cmpExpr();
1136 state._fsp--;
1138 stream_cmpExpr.add(cmpExpr37.getTree());
1139 loop8:
1140 do {
1141 int alt8=2;
1142 int LA8_0 = input.LA(1);
1144 if ( (LA8_0==38) ) {
1145 alt8=1;
1148 switch (alt8) {
1149 case 1 :
1151 char_literal38=(Token)match(input,38,FOLLOW_38_in_fn435);
1152 stream_38.add(char_literal38);
1154 pushFollow(FOLLOW_cmpExpr_in_fn437);
1155 cmpExpr39=cmpExpr();
1157 state._fsp--;
1159 stream_cmpExpr.add(cmpExpr39.getTree());
1162 break;
1164 default :
1165 break loop8;
1167 } while (true);
1169 RPAREN40=(Token)match(input,RPAREN,FOLLOW_RPAREN_in_fn441);
1170 stream_RPAREN.add(RPAREN40);
1172 retval.tree = root_0;
1173 RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.tree:null);
1175 root_0 = (CommonTree)adaptor.nil();
1178 CommonTree root_1 = (CommonTree)adaptor.nil();
1179 root_1 = (CommonTree)adaptor.becomeRoot((CommonTree)adaptor.create(FN, (fnName35!=null?input.toString(fnName35.start,fnName35.stop):null)), root_1);
1181 if ( !(stream_cmpExpr.hasNext()) ) {
1182 throw new RewriteEarlyExitException();
1184 while ( stream_cmpExpr.hasNext() ) {
1185 adaptor.addChild(root_1, stream_cmpExpr.nextTree());
1188 stream_cmpExpr.reset();
1190 adaptor.addChild(root_0, root_1);
1195 retval.tree = root_0;
1198 retval.stop = input.LT(-1);
1200 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1201 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1205 catch (RecognitionException e) {
1206 reportError(e);
1207 throw e;
1209 finally {
1211 return retval;
1214 public static class fnName_return extends ParserRuleReturnScope {
1215 CommonTree tree;
1216 public Object getTree() { return tree; }
1219 public final ExpressionParser.fnName_return fnName() throws RecognitionException {
1220 ExpressionParser.fnName_return retval = new ExpressionParser.fnName_return();
1221 retval.start = input.LT(1);
1223 CommonTree root_0 = null;
1225 Token set41=null;
1227 CommonTree set41_tree=null;
1229 try {
1231 root_0 = (CommonTree)adaptor.nil();
1233 set41=(Token)input.LT(1);
1234 if ( (input.LA(1)>=39 && input.LA(1)<=49) ) {
1235 input.consume();
1236 adaptor.addChild(root_0, (CommonTree)adaptor.create(set41));
1237 state.errorRecovery=false;
1239 else {
1240 MismatchedSetException mse = new MismatchedSetException(null,input);
1241 throw mse;
1246 retval.stop = input.LT(-1);
1248 retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
1249 adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
1253 catch (RecognitionException e) {
1254 reportError(e);
1255 throw e;
1257 finally {
1259 return retval;
1262 protected DFA6 dfa6 = new DFA6(this);
1263 static final String DFA6_eotS =
1264 "\6\uffff";
1265 static final String DFA6_eofS =
1266 "\1\uffff\1\3\3\uffff\1\3";
1267 static final String DFA6_minS =
1268 "\1\26\1\7\1\26\2\uffff\1\7";
1269 static final String DFA6_maxS =
1270 "\1\26\1\46\1\26\2\uffff\1\46";
1271 static final String DFA6_acceptS =
1272 "\3\uffff\1\1\1\2\1\uffff";
1273 static final String DFA6_specialS =
1274 "\6\uffff}>";
1275 static final String[] DFA6_transitionS = {
1276 "\1\1",
1277 "\12\3\1\uffff\1\3\1\4\21\uffff\1\2\1\3",
1278 "\1\5",
1281 "\12\3\1\uffff\1\3\1\4\21\uffff\1\2\1\3"
1284 static final short[] DFA6_eot = DFA.unpackEncodedString(DFA6_eotS);
1285 static final short[] DFA6_eof = DFA.unpackEncodedString(DFA6_eofS);
1286 static final char[] DFA6_min = DFA.unpackEncodedStringToUnsignedChars(DFA6_minS);
1287 static final char[] DFA6_max = DFA.unpackEncodedStringToUnsignedChars(DFA6_maxS);
1288 static final short[] DFA6_accept = DFA.unpackEncodedString(DFA6_acceptS);
1289 static final short[] DFA6_special = DFA.unpackEncodedString(DFA6_specialS);
1290 static final short[][] DFA6_transition;
1292 static {
1293 int numStates = DFA6_transitionS.length;
1294 DFA6_transition = new short[numStates][];
1295 for (int i=0; i<numStates; i++) {
1296 DFA6_transition[i] = DFA.unpackEncodedString(DFA6_transitionS[i]);
1300 class DFA6 extends DFA {
1302 public DFA6(BaseRecognizer recognizer) {
1303 this.recognizer = recognizer;
1304 this.decisionNumber = 6;
1305 this.eot = DFA6_eot;
1306 this.eof = DFA6_eof;
1307 this.min = DFA6_min;
1308 this.max = DFA6_max;
1309 this.accept = DFA6_accept;
1310 this.special = DFA6_special;
1311 this.transition = DFA6_transition;
1313 public String getDescription() {
1314 return "100:1: var : ( name | name index -> ^( INDEX[$index.text] name ) );";
1318 public static final BitSet FOLLOW_cmpExpr_in_expression87 = new BitSet(new long[]{0x0000000000000000L});
1319 public static final BitSet FOLLOW_EOF_in_expression89 = new BitSet(new long[]{0x0000000000000002L});
1320 public static final BitSet FOLLOW_addExpr_in_cmpExpr102 = new BitSet(new long[]{0x0000000000001F82L});
1321 public static final BitSet FOLLOW_cmpOp_in_cmpExpr105 = new BitSet(new long[]{0x0003FF8001D24000L});
1322 public static final BitSet FOLLOW_addExpr_in_cmpExpr108 = new BitSet(new long[]{0x0000000000000002L});
1323 public static final BitSet FOLLOW_set_in_cmpOp0 = new BitSet(new long[]{0x0000000000000002L});
1324 public static final BitSet FOLLOW_multExpr_in_addExpr166 = new BitSet(new long[]{0x0000000000006002L});
1325 public static final BitSet FOLLOW_addOp_in_addExpr169 = new BitSet(new long[]{0x0003FF8001D24000L});
1326 public static final BitSet FOLLOW_multExpr_in_addExpr172 = new BitSet(new long[]{0x0000000000006002L});
1327 public static final BitSet FOLLOW_set_in_addOp0 = new BitSet(new long[]{0x0000000000000002L});
1328 public static final BitSet FOLLOW_unary_in_multExpr206 = new BitSet(new long[]{0x0000000000018002L});
1329 public static final BitSet FOLLOW_multOp_in_multExpr209 = new BitSet(new long[]{0x0003FF8001D24000L});
1330 public static final BitSet FOLLOW_unary_in_multExpr212 = new BitSet(new long[]{0x0000000000018002L});
1331 public static final BitSet FOLLOW_set_in_multOp0 = new BitSet(new long[]{0x0000000000000002L});
1332 public static final BitSet FOLLOW_MINUS_in_unary246 = new BitSet(new long[]{0x0003FF8001D24000L});
1333 public static final BitSet FOLLOW_atom_in_unary248 = new BitSet(new long[]{0x0000000000000002L});
1334 public static final BitSet FOLLOW_atom_in_unary263 = new BitSet(new long[]{0x0000000000000002L});
1335 public static final BitSet FOLLOW_var_in_atom276 = new BitSet(new long[]{0x0000000000000002L});
1336 public static final BitSet FOLLOW_num_in_atom282 = new BitSet(new long[]{0x0000000000000002L});
1337 public static final BitSet FOLLOW_str_in_atom288 = new BitSet(new long[]{0x0000000000000002L});
1338 public static final BitSet FOLLOW_fn_in_atom294 = new BitSet(new long[]{0x0000000000000002L});
1339 public static final BitSet FOLLOW_LPAREN_in_atom300 = new BitSet(new long[]{0x0003FF8001D24000L});
1340 public static final BitSet FOLLOW_addExpr_in_atom302 = new BitSet(new long[]{0x0000000000040000L});
1341 public static final BitSet FOLLOW_RPAREN_in_atom304 = new BitSet(new long[]{0x0000000000000002L});
1342 public static final BitSet FOLLOW_name_in_var321 = new BitSet(new long[]{0x0000000000000002L});
1343 public static final BitSet FOLLOW_name_in_var327 = new BitSet(new long[]{0x0000000000080000L});
1344 public static final BitSet FOLLOW_index_in_var329 = new BitSet(new long[]{0x0000000000000002L});
1345 public static final BitSet FOLLOW_LSQUARE_in_index351 = new BitSet(new long[]{0x0000000000100000L});
1346 public static final BitSet FOLLOW_INT_in_index355 = new BitSet(new long[]{0x0000000000200000L});
1347 public static final BitSet FOLLOW_RSQUARE_in_index357 = new BitSet(new long[]{0x0000000000000002L});
1348 public static final BitSet FOLLOW_NAME_in_name375 = new BitSet(new long[]{0x0000002000000002L});
1349 public static final BitSet FOLLOW_37_in_name378 = new BitSet(new long[]{0x0000000000400000L});
1350 public static final BitSet FOLLOW_NAME_in_name381 = new BitSet(new long[]{0x0000002000000002L});
1351 public static final BitSet FOLLOW_set_in_num0 = new BitSet(new long[]{0x0000000000000002L});
1352 public static final BitSet FOLLOW_PHRASE_in_str415 = new BitSet(new long[]{0x0000000000000002L});
1353 public static final BitSet FOLLOW_fnName_in_fn428 = new BitSet(new long[]{0x0000000000020000L});
1354 public static final BitSet FOLLOW_LPAREN_in_fn430 = new BitSet(new long[]{0x0003FF8001D24000L});
1355 public static final BitSet FOLLOW_cmpExpr_in_fn432 = new BitSet(new long[]{0x0000004000040000L});
1356 public static final BitSet FOLLOW_38_in_fn435 = new BitSet(new long[]{0x0003FF8001D24000L});
1357 public static final BitSet FOLLOW_cmpExpr_in_fn437 = new BitSet(new long[]{0x0000004000040000L});
1358 public static final BitSet FOLLOW_RPAREN_in_fn441 = new BitSet(new long[]{0x0000000000000002L});
1359 public static final BitSet FOLLOW_set_in_fnName0 = new BitSet(new long[]{0x0000000000000002L});