The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
CSharpParser.cs
Go to the documentation of this file.
1 // $ANTLR 2.7.6 (2005-12-22): "CSharpParser.g" -> "CSharpParser.cs"$
2 
3 using System.Linq;
6  using AST;
7  using TypeSystem;
8  using ErrorManagement;
9  using System.Collections.Generic;
10  using System.Globalization;
11 
12  #region
13 
61 
77 
80  #endregion
81 
82 namespace Parser
83 {
84  // Generate the header common to all output files.
85  using System;
86 
92  using Token = antlr.Token;
93  using IToken = antlr.IToken;
101 
102  public class CSharpParser : antlr.LLkParser
103  {
104  public const int EOF = 1;
105  public const int NULL_TREE_LOOKAHEAD = 3;
106  public const int UNICODE_CLASS_Nl = 4;
107  public const int UNICODE_CLASS_Lt = 5;
108  public const int UNICODE_CLASS_Zs = 6;
109  public const int UNICODE_CLASS_Ll = 7;
110  public const int UNICODE_CLASS_Lu = 8;
111  public const int UNICODE_CLASS_Lo = 9;
112  public const int UNICODE_CLASS_Lm = 10;
113  public const int UNICODE_CLASS_Mn = 11;
114  public const int UNICODE_CLASS_Mc = 12;
115  public const int UNICODE_CLASS_Nd = 13;
116  public const int UNICODE_CLASS_Pc = 14;
117  public const int UNICODE_CLASS_Cf = 15;
118  public const int TRUE = 16;
119  public const int FALSE = 17;
120  public const int DEFAULT = 18;
121  public const int PP_DEFINE = 19;
122  public const int PP_UNDEFINE = 20;
123  public const int PP_COND_IF = 21;
124  public const int PP_COND_ELIF = 22;
125  public const int PP_COND_ELSE = 23;
126  public const int PP_COND_ENDIF = 24;
127  public const int PP_LINE = 25;
128  public const int PP_ERROR = 26;
129  public const int PP_WARNING = 27;
130  public const int PP_REGION = 28;
131  public const int PP_ENDREGION = 29;
132  public const int PP_FILENAME = 30;
133  public const int PP_IDENT = 31;
134  public const int PP_STRING = 32;
135  public const int PP_NUMBER = 33;
136  public const int WHITESPACE = 34;
137  public const int QUOTE = 35;
138  public const int OPEN_PAREN = 36;
139  public const int CLOSE_PAREN = 37;
140  public const int LOG_NOT = 38;
141  public const int LOG_AND = 39;
142  public const int LOG_OR = 40;
143  public const int EQUAL = 41;
144  public const int NOT_EQUAL = 42;
145  public const int SL_COMMENT = 43;
146  public const int NEWLINE = 44;
147  public const int NOT_NEWLINE = 45;
148  public const int NON_NEWLINE_WHITESPACE = 46;
149  public const int UNICODE_ESCAPE_SEQUENCE = 47;
150  public const int DECIMAL_DIGIT = 48;
151  public const int HEX_DIGIT = 49;
152  public const int LETTER_CHARACTER = 50;
153  public const int DECIMAL_DIGIT_CHARACTER = 51;
154  public const int CONNECTING_CHARACTER = 52;
155  public const int COMBINING_CHARACTER = 53;
156  public const int FORMATTING_CHARACTER = 54;
157  public const int ABSTRACT = 55;
158  public const int AS = 56;
159  public const int BASE = 57;
160  public const int BOOL = 58;
161  public const int BREAK = 59;
162  public const int BYTE = 60;
163  public const int CASE = 61;
164  public const int CATCH = 62;
165  public const int CHAR = 63;
166  public const int CHECKED = 64;
167  public const int CLASS = 65;
168  public const int CONST = 66;
169  public const int CONTINUE = 67;
170  public const int DECIMAL = 68;
171  public const int DELEGATE = 69;
172  public const int DO = 70;
173  public const int DOUBLE = 71;
174  public const int ELSE = 72;
175  public const int ENUM = 73;
176  public const int EVENT = 74;
177  public const int EXPLICIT = 75;
178  public const int EXTERN = 76;
179  public const int FINALLY = 77;
180  public const int FIXED = 78;
181  public const int FLOAT = 79;
182  public const int FOR = 80;
183  public const int FOREACH = 81;
184  public const int GOTO = 82;
185  public const int IF = 83;
186  public const int IMPLICIT = 84;
187  public const int IN = 85;
188  public const int INT = 86;
189  public const int INTERFACE = 87;
190  public const int INTERNAL = 88;
191  public const int IS = 89;
192  public const int LOCK = 90;
193  public const int LONG = 91;
194  public const int NAMESPACE = 92;
195  public const int NEW = 93;
196  public const int NULL = 94;
197  public const int OBJECT = 95;
198  public const int OPERATOR = 96;
199  public const int OUT = 97;
200  public const int OVERRIDE = 98;
201  public const int PARAMS = 99;
202  public const int PRIVATE = 100;
203  public const int PROTECTED = 101;
204  public const int PUBLIC = 102;
205  public const int READONLY = 103;
206  public const int REF = 104;
207  public const int RETURN = 105;
208  public const int SBYTE = 106;
209  public const int SEALED = 107;
210  public const int SHORT = 108;
211  public const int SIZEOF = 109;
212  public const int STACKALLOC = 110;
213  public const int STATIC = 111;
214  public const int STRING = 112;
215  public const int STRUCT = 113;
216  public const int SWITCH = 114;
217  public const int THIS = 115;
218  public const int THROW = 116;
219  public const int TRY = 117;
220  public const int TYPEOF = 118;
221  public const int UINT = 119;
222  public const int ULONG = 120;
223  public const int UNCHECKED = 121;
224  public const int UNSAFE = 122;
225  public const int USHORT = 123;
226  public const int USING = 124;
227  public const int VIRTUAL = 125;
228  public const int VOID = 126;
229  public const int VOLATILE = 127;
230  public const int WHILE = 128;
231  public const int VAR = 129;
232  public const int DOT = 130;
233  public const int UINT_LITERAL = 131;
234  public const int LONG_LITERAL = 132;
235  public const int ULONG_LITERAL = 133;
236  public const int DECIMAL_LITERAL = 134;
237  public const int FLOAT_LITERAL = 135;
238  public const int DOUBLE_LITERAL = 136;
239  public const int LITERAL_add = 137;
240  public const int LITERAL_remove = 138;
241  public const int LITERAL_get = 139;
242  public const int LITERAL_set = 140;
243  public const int LITERAL_assembly = 141;
244  public const int LITERAL_field = 142;
245  public const int LITERAL_method = 143;
246  public const int LITERAL_module = 144;
247  public const int LITERAL_param = 145;
248  public const int LITERAL_property = 146;
249  public const int LITERAL_type = 147;
250  public const int ML_COMMENT = 148;
251  public const int IDENTIFIER = 149;
252  public const int INT_LITERAL = 150;
253  public const int CHAR_LITERAL = 151;
254  public const int STRING_LITERAL = 152;
255  public const int ESCAPED_LITERAL = 153;
256  public const int OPEN_CURLY = 154;
257  public const int CLOSE_CURLY = 155;
258  public const int OPEN_BRACK = 156;
259  public const int CLOSE_BRACK = 157;
260  public const int COMMA = 158;
261  public const int COLON = 159;
262  public const int SEMI = 160;
263  public const int PLUS = 161;
264  public const int MINUS = 162;
265  public const int STAR = 163;
266  public const int DIV = 164;
267  public const int MOD = 165;
268  public const int BIN_AND = 166;
269  public const int BIN_OR = 167;
270  public const int BIN_XOR = 168;
271  public const int BIN_NOT = 169;
272  public const int ASSIGN = 170;
273  public const int LTHAN = 171;
274  public const int GTHAN = 172;
275  public const int QUESTION = 173;
276  public const int INC = 174;
277  public const int DEC = 175;
278  public const int SHIFTL = 176;
279  public const int SHIFTR = 177;
280  public const int LTE = 178;
281  public const int GTE = 179;
282  public const int PLUS_ASSIGN = 180;
283  public const int MINUS_ASSIGN = 181;
284  public const int STAR_ASSIGN = 182;
285  public const int DIV_ASSIGN = 183;
286  public const int MOD_ASSIGN = 184;
287  public const int BIN_AND_ASSIGN = 185;
288  public const int BIN_OR_ASSIGN = 186;
289  public const int BIN_XOR_ASSIGN = 187;
290  public const int SHIFTL_ASSIGN = 188;
291  public const int SHIFTR_ASSIGN = 189;
292  public const int DEREF = 190;
293  public const int PP_DIRECTIVE = 191;
294  public const int COMPILATION_UNIT = 192;
295  public const int USING_DIRECTIVES = 193;
296  public const int USING_ALIAS_DIRECTIVE = 194;
297  public const int USING_NAMESPACE_DIRECTIVE = 195;
298  public const int GLOBAL_ATTRIBUTE_SECTIONS = 196;
299  public const int GLOBAL_ATTRIBUTE_SECTION = 197;
300  public const int ATTRIBUTE_SECTIONS = 198;
301  public const int ATTRIBUTE_SECTION = 199;
302  public const int ATTRIBUTE = 200;
303  public const int QUALIFIED_IDENTIFIER = 201;
304  public const int POSITIONAL_ARGLIST = 202;
305  public const int POSITIONAL_ARG = 203;
306  public const int NAMED_ARGLIST = 204;
307  public const int NAMED_ARG = 205;
308  public const int ARG_LIST = 206;
309  public const int FORMAL_PARAMETER_LIST = 207;
310  public const int PARAMETER_FIXED = 208;
311  public const int PARAMETER_ARRAY = 209;
312  public const int ATTRIB_ARGUMENT_EXPR = 210;
313  public const int UNARY_MINUS = 211;
314  public const int UNARY_PLUS = 212;
315  public const int CLASS_BASE = 213;
316  public const int STRUCT_BASE = 214;
317  public const int INTERFACE_BASE = 215;
318  public const int ENUM_BASE = 216;
319  public const int TYPE_BODY = 217;
320  public const int MEMBER_LIST = 218;
321  public const int CONST_DECLARATOR = 219;
322  public const int CTOR_DECL = 220;
323  public const int STATIC_CTOR_DECL = 221;
324  public const int DTOR_DECL = 222;
325  public const int FIELD_DECL = 223;
326  public const int METHOD_DECL = 224;
327  public const int PROPERTY_DECL = 225;
328  public const int INDEXER_DECL = 226;
329  public const int UNARY_OP_DECL = 227;
330  public const int BINARY_OP_DECL = 228;
331  public const int CONV_OP_DECL = 229;
332  public const int TYPE = 230;
333  public const int STARS = 231;
334  public const int ARRAY_RANK = 232;
335  public const int ARRAY_RANKS = 233;
336  public const int ARRAY_INIT = 234;
337  public const int VAR_INIT = 235;
338  public const int VAR_INIT_LIST = 236;
339  public const int VAR_DECLARATOR = 237;
340  public const int LOCVAR_INIT = 238;
341  public const int LOCVAR_INIT_LIST = 239;
342  public const int LOCVAR_DECLS = 240;
343  public const int LOCAL_CONST = 241;
344  public const int EXPR = 242;
345  public const int EXPR_LIST = 243;
346  public const int MEMBER_ACCESS_EXPR = 244;
347  public const int ELEMENT_ACCESS_EXPR = 245;
348  public const int INVOCATION_EXPR = 246;
349  public const int POST_INC_EXPR = 247;
350  public const int POST_DEC_EXPR = 248;
351  public const int PAREN_EXPR = 249;
352  public const int OBJ_CREATE_EXPR = 250;
353  public const int DLG_CREATE_EXPR = 251;
354  public const int ARRAY_CREATE_EXPR = 252;
355  public const int CAST_EXPR = 253;
356  public const int PTR_ELEMENT_ACCESS_EXPR = 254;
357  public const int PTR_INDIRECTION_EXPR = 255;
358  public const int PTR_DECLARATOR = 256;
359  public const int PTR_INIT = 257;
360  public const int ADDRESS_OF_EXPR = 258;
361  public const int MODIFIERS = 259;
362  public const int NAMESPACE_BODY = 260;
363  public const int BLOCK = 261;
364  public const int STMT_LIST = 262;
365  public const int EMPTY_STMT = 263;
366  public const int LABEL_STMT = 264;
367  public const int EXPR_STMT = 265;
368  public const int FOR_INIT = 266;
369  public const int FOR_COND = 267;
370  public const int FOR_ITER = 268;
371  public const int SWITCH_SECTION = 269;
372  public const int SWITCH_LABELS = 270;
373  public const int SWITCH_LABEL = 271;
374  public const int PP_DIRECTIVES = 272;
375  public const int PP_EXPR = 273;
376  public const int PP_MESSAGE = 274;
377  public const int PP_BLOCK = 275;
378 
379 
380  //---------------------------------------------------------------------
381  // PRIVATE DATA MEMBERS
382  //---------------------------------------------------------------------
384  // the ocurrence of an intem in the text program
385 
386  private Location getLocation(IToken i) { return new Location(fileinfo_.FullName, i.getLine(), i.getColumn()); }
387 
388  private FileInfo fileinfo_;
389 
390 
391  private bool NotExcluded(CodeMaskEnums codeMask, CodeMaskEnums construct)
392  {
393  return ((codeMask & construct) != 0);
394  }
395 
396  public override void setFilename(string filename)
397  {
398  base.setFilename(filename);
399  fileinfo_ = new FileInfo(filename);
400  }
401 
402  private bool SingleLinePPDirectiveIsPredictedByLA(int lookAheadDepth)
403  {
404  if ((LA(lookAheadDepth) == PP_WARNING) ||
405  (LA(lookAheadDepth) == PP_ERROR) ||
406  (LA(lookAheadDepth) == PP_LINE) ||
407  (LA(lookAheadDepth) == PP_UNDEFINE) ||
408  (LA(lookAheadDepth) == PP_DEFINE))
409  {
410  return true;
411  }
412  return false;
413  }
414 
415  private bool PPDirectiveIsPredictedByLA(int lookAheadDepth)
416  {
417  if ((LA(lookAheadDepth) == PP_REGION) ||
418  (LA(lookAheadDepth) == PP_COND_IF) ||
419  (LA(lookAheadDepth) == PP_WARNING) ||
420  (LA(lookAheadDepth) == PP_ERROR) ||
421  (LA(lookAheadDepth) == PP_LINE) ||
422  (LA(lookAheadDepth) == PP_UNDEFINE) ||
423  (LA(lookAheadDepth) == PP_DEFINE))
424  {
425  return true;
426  }
427  return false;
428  }
429 
430  private bool IdentifierRuleIsPredictedByLA(int lookAheadDepth)
431  {
432  if ((LA(lookAheadDepth) == IDENTIFIER) ||
433  (LA(lookAheadDepth) == LITERAL_add) ||
434  (LA(lookAheadDepth) == LITERAL_remove) ||
435  (LA(lookAheadDepth) == LITERAL_get) ||
436  (LA(lookAheadDepth) == LITERAL_set) ||
437  (LA(lookAheadDepth) == LITERAL_assembly) ||
438  (LA(lookAheadDepth) == LITERAL_field) ||
439  (LA(lookAheadDepth) == LITERAL_method) ||
440  (LA(lookAheadDepth) == LITERAL_module) ||
441  (LA(lookAheadDepth) == LITERAL_param) ||
442  (LA(lookAheadDepth) == LITERAL_property) ||
443  (LA(lookAheadDepth) == LITERAL_type))
444  {
445  return true;
446  }
447  return false;
448  }
449 
450  private bool TypeRuleIsPredictedByLA(int lookAheadDepth)
451  {
452  if ((LA(lookAheadDepth) == DOT) ||
453  (LA(lookAheadDepth) == VOID) ||
454  (LA(lookAheadDepth) == IDENTIFIER) ||
455  (LA(lookAheadDepth) == INT) ||
456  (LA(lookAheadDepth) == BOOL) ||
457  (LA(lookAheadDepth) == STRING) ||
458  (LA(lookAheadDepth) == OBJECT) ||
459  (LA(lookAheadDepth) == BYTE) ||
460  (LA(lookAheadDepth) == CHAR) ||
461  (LA(lookAheadDepth) == DECIMAL) ||
462  (LA(lookAheadDepth) == DOUBLE) ||
463  (LA(lookAheadDepth) == FLOAT) ||
464  (LA(lookAheadDepth) == LONG) ||
465  (LA(lookAheadDepth) == SBYTE) ||
466  (LA(lookAheadDepth) == SHORT) ||
467  (LA(lookAheadDepth) == UINT) ||
468  (LA(lookAheadDepth) == ULONG) ||
469  (LA(lookAheadDepth) == VAR) ||
470  (LA(lookAheadDepth) == USHORT))
471  {
472  return true;
473  }
474  return false;
475  }
476 
477 
478  // * Error recovery
482  private bool errorState = false;
483 
484  // * Overrides the
489  public override void match(int token) {
490  if (!errorState)
491  base.match(token);
492  else {
493  while (this.LA(0) != token && this.LA(0) != EOF)
494  this.consume();
495  errorState = false;
496  }
497  }
498 
499 
500  protected void initialize()
501  {
502  tokenNames = tokenNames_;
503  }
504 
505 
506  protected CSharpParser(TokenBuffer tokenBuf, int k) : base(tokenBuf, k)
507  {
508  initialize();
509  }
510 
511  public CSharpParser(TokenBuffer tokenBuf) : this(tokenBuf,2)
512  {
513  }
514 
515  protected CSharpParser(TokenStream lexer, int k) : base(lexer,k)
516  {
517  initialize();
518  }
519 
520  public CSharpParser(TokenStream lexer) : this(lexer,2)
521  {
522  }
523 
524  public CSharpParser(ParserSharedInputState state) : base(state,2)
525  {
526  initialize();
527  }
528 
529  public SingleIdentifierExpression nonKeywordLiterals() //throws RecognitionException, TokenStreamException
530 {
531  SingleIdentifierExpression id = null;
532 
533  IToken a = null;
534  IToken r = null;
535  IToken g = null;
536  IToken s = null;
537  IToken ab = null;
538  IToken f = null;
539  IToken m = null;
540  IToken mo = null;
541  IToken p = null;
542  IToken pr = null;
543  IToken t = null;
544 
545  switch ( LA(1) )
546  {
547  case LITERAL_add:
548  {
549  a = LT(1);
551  if (0==inputState.guessing)
552  {
553  id = new SingleIdentifierExpression(a.getText(), getLocation(a));
554  }
555  break;
556  }
557  case LITERAL_remove:
558  {
559  r = LT(1);
561  if (0==inputState.guessing)
562  {
563  id = new SingleIdentifierExpression(r.getText(), getLocation(r));
564  }
565  break;
566  }
567  case LITERAL_get:
568  {
569  g = LT(1);
571  if (0==inputState.guessing)
572  {
573  id = new SingleIdentifierExpression(g.getText(), getLocation(g));
574  }
575  break;
576  }
577  case LITERAL_set:
578  {
579  s = LT(1);
581  if (0==inputState.guessing)
582  {
583  id = new SingleIdentifierExpression(s.getText(), getLocation(s));
584  }
585  break;
586  }
587  case LITERAL_assembly:
588  {
589  ab = LT(1);
591  if (0==inputState.guessing)
592  {
593  id = new SingleIdentifierExpression(ab.getText(), getLocation(ab));
594  }
595  break;
596  }
597  case LITERAL_field:
598  {
599  f = LT(1);
601  if (0==inputState.guessing)
602  {
603  id = new SingleIdentifierExpression(f.getText(), getLocation(f));
604  }
605  break;
606  }
607  case LITERAL_method:
608  {
609  m = LT(1);
611  if (0==inputState.guessing)
612  {
613  id = new SingleIdentifierExpression(m.getText(), getLocation(m));
614  }
615  break;
616  }
617  case LITERAL_module:
618  {
619  mo = LT(1);
621  if (0==inputState.guessing)
622  {
623  id = new SingleIdentifierExpression(mo.getText(), getLocation(mo));
624  }
625  break;
626  }
627  case LITERAL_param:
628  {
629  p = LT(1);
631  if (0==inputState.guessing)
632  {
633  id = new SingleIdentifierExpression(p.getText(), getLocation(p));
634  }
635  break;
636  }
637  case LITERAL_property:
638  {
639  pr = LT(1);
641  if (0==inputState.guessing)
642  {
643  id = new SingleIdentifierExpression(pr.getText(), getLocation(pr));
644  }
645  break;
646  }
647  case LITERAL_type:
648  {
649  t = LT(1);
651  if (0==inputState.guessing)
652  {
653  id = new SingleIdentifierExpression(t.getText(), getLocation(t));
654  }
655  break;
656  }
657  default:
658  {
659  throw new NoViableAltException(LT(1), getFilename());
660  }
661  }
662  return id;
663  }
664 
665  public SingleIdentifierExpression identifier() //throws RecognitionException, TokenStreamException
666 {
667  SingleIdentifierExpression id = null;
668 
669  IToken i = null;
670 
671  switch ( LA(1) )
672  {
673  case IDENTIFIER:
674  {
675  i = LT(1);
676  match(IDENTIFIER);
677  if (0==inputState.guessing)
678  {
679  id = new SingleIdentifierExpression(i.getText(), getLocation(i));
680  }
681  break;
682  }
683  case LITERAL_add:
684  case LITERAL_remove:
685  case LITERAL_get:
686  case LITERAL_set:
687  case LITERAL_assembly:
688  case LITERAL_field:
689  case LITERAL_method:
690  case LITERAL_module:
691  case LITERAL_param:
692  case LITERAL_property:
693  case LITERAL_type:
694  {
695  id=nonKeywordLiterals();
696  break;
697  }
698  default:
699  {
700  throw new NoViableAltException(LT(1), getFilename());
701  }
702  }
703  return id;
704  }
705 
706  public IdentifierExpression qualifiedIdentifier() //throws RecognitionException, TokenStreamException
707 {
708  IdentifierExpression e = null;
709 
711 
712  i=identifier();
713  {
714  switch ( LA(1) )
715  {
716  case DOT:
717  {
718  match(DOT);
720  break;
721  }
722  case EOF:
723  case OPEN_PAREN:
724  case CLOSE_PAREN:
725  case LOG_AND:
726  case LOG_OR:
727  case EQUAL:
728  case NOT_EQUAL:
729  case LITERAL_add:
730  case LITERAL_remove:
731  case LITERAL_get:
732  case LITERAL_set:
733  case LITERAL_assembly:
734  case LITERAL_field:
735  case LITERAL_method:
736  case LITERAL_module:
737  case LITERAL_param:
738  case LITERAL_property:
739  case LITERAL_type:
740  case IDENTIFIER:
741  case OPEN_CURLY:
742  case CLOSE_CURLY:
743  case OPEN_BRACK:
744  case CLOSE_BRACK:
745  case COMMA:
746  case COLON:
747  case SEMI:
748  case BIN_AND:
749  case BIN_OR:
750  case BIN_XOR:
751  case ASSIGN:
752  case QUESTION:
753  case PLUS_ASSIGN:
754  case MINUS_ASSIGN:
755  case STAR_ASSIGN:
756  case DIV_ASSIGN:
757  case MOD_ASSIGN:
758  case BIN_AND_ASSIGN:
759  case BIN_OR_ASSIGN:
760  case BIN_XOR_ASSIGN:
761  case SHIFTL_ASSIGN:
762  case SHIFTR_ASSIGN:
763  {
764  break;
765  }
766  default:
767  {
768  throw new NoViableAltException(LT(1), getFilename());
769  }
770  }
771  }
772  if (0==inputState.guessing)
773  {
774 
775  if (q != null)
776  e = new QualifiedIdentifierExpression(i, q, i.Location);
777  else
778  e = i;
779 
780  }
781  return e;
782  }
783 
784  public string type() //throws RecognitionException, TokenStreamException
785 {
786  string name = ""; ;
787 
788  IdentifierExpression qid = null; int rank = 0;
789 
790  {
791  switch ( LA(1) )
792  {
793  case BOOL:
794  case CHAR:
795  case DOUBLE:
796  case INT:
797  case OBJECT:
798  case STRING:
799  case VAR:
800  case LITERAL_add:
801  case LITERAL_remove:
802  case LITERAL_get:
803  case LITERAL_set:
804  case LITERAL_assembly:
805  case LITERAL_field:
806  case LITERAL_method:
807  case LITERAL_module:
808  case LITERAL_param:
809  case LITERAL_property:
810  case LITERAL_type:
811  case IDENTIFIER:
812  {
813  {
814  switch ( LA(1) )
815  {
816  case BOOL:
817  case CHAR:
818  case DOUBLE:
819  case INT:
820  case OBJECT:
821  case STRING:
822  case VAR:
823  {
824  name=predefinedTypeName();
825  break;
826  }
827  case LITERAL_add:
828  case LITERAL_remove:
829  case LITERAL_get:
830  case LITERAL_set:
831  case LITERAL_assembly:
832  case LITERAL_field:
833  case LITERAL_method:
834  case LITERAL_module:
835  case LITERAL_param:
836  case LITERAL_property:
837  case LITERAL_type:
838  case IDENTIFIER:
839  {
840  qid=qualifiedIdentifier();
841  if (0==inputState.guessing)
842  {
843  name = qid.Identifier;
844  }
845  break;
846  }
847  default:
848  {
849  throw new NoViableAltException(LT(1), getFilename());
850  }
851  }
852  }
853  break;
854  }
855  case VOID:
856  {
857  match(VOID);
858  if (0==inputState.guessing)
859  {
860  name = "void";
861  }
862  break;
863  }
864  default:
865  {
866  throw new NoViableAltException(LT(1), getFilename());
867  }
868  }
869  }
870  rank=rankSpecifiers();
871  if (0==inputState.guessing)
872  {
873 
874  if (rank != 0)
875  {
876  for (int i = 0; i < rank; i++) { name += "[]"; }
877  }
878 
879  }
880  return name;
881  }
882 
883  public string predefinedTypeName() //throws RecognitionException, TokenStreamException
884 {
885  string typeExp = ""; ;
886 
887 
888  switch ( LA(1) )
889  {
890  case BOOL:
891  {
892  match(BOOL);
893  if (0==inputState.guessing)
894  {
895  typeExp = "bool";
896  }
897  break;
898  }
899  case CHAR:
900  {
901  match(CHAR);
902  if (0==inputState.guessing)
903  {
904  typeExp = "char";
905  }
906  break;
907  }
908  case DOUBLE:
909  {
910  match(DOUBLE);
911  if (0==inputState.guessing)
912  {
913  typeExp = "double";
914  }
915  break;
916  }
917  case INT:
918  {
919  match(INT);
920  if (0==inputState.guessing)
921  {
922  typeExp = "int";
923  }
924  break;
925  }
926  case OBJECT:
927  {
928  match(OBJECT);
929  if (0==inputState.guessing)
930  {
931  typeExp = "object";
932  }
933  break;
934  }
935  case STRING:
936  {
937  match(STRING);
938  if (0==inputState.guessing)
939  {
940  typeExp = "string";
941  }
942  break;
943  }
944  case VAR:
945  {
946  match(VAR);
947  if (0==inputState.guessing)
948  {
949  typeExp = Convert.ToString(TypeVariable.NewTypeVariable);
950  }
951  break;
952  }
953  default:
954  {
955  throw new NoViableAltException(LT(1), getFilename());
956  }
957  }
958  return typeExp;
959  }
960 
961  public int rankSpecifiers() //throws RecognitionException, TokenStreamException
962 {
963  int rank = 0;
964 
965 
966  { // ( ... )*
967  for (;;)
968  {
969  if ((LA(1)==OPEN_BRACK) && (LA(2)==CLOSE_BRACK||LA(2)==COMMA))
970  {
971  rankSpecifier();
972  if (0==inputState.guessing)
973  {
974  rank++;
975  }
976  }
977  else
978  {
979  goto _loop224_breakloop;
980  }
981 
982  }
983 _loop224_breakloop: ;
984  } // ( ... )*
985  return rank;
986  }
987 
988  public CompoundExpression argumentList() //throws RecognitionException, TokenStreamException
989 {
990  CompoundExpression ce = null;
991 
992  Expression exp = null;
993 
994  exp=argument();
995  if (0==inputState.guessing)
996  {
997  ce = new CompoundExpression(exp.Location); ce.AddExpression(exp);
998  }
999  { // ( ... )*
1000  for (;;)
1001  {
1002  if ((LA(1)==COMMA))
1003  {
1004  match(COMMA);
1005  exp=argument();
1006  if (0==inputState.guessing)
1007  {
1008  ce.AddExpression(exp);
1009  }
1010  }
1011  else
1012  {
1013  goto _loop10_breakloop;
1014  }
1015 
1016  }
1017 _loop10_breakloop: ;
1018  } // ( ... )*
1019  return ce;
1020  }
1021 
1022  public ArgumentExpression argument() //throws RecognitionException, TokenStreamException
1023 {
1024  ArgumentExpression arg = null;
1025 
1026  Expression exp = null;
1027 
1028  exp=expression();
1029  if (0==inputState.guessing)
1030  {
1031  arg = new ArgumentExpression(exp, exp.Location);
1032  }
1033  return arg;
1034  }
1035 
1036  public Expression expression() //throws RecognitionException, TokenStreamException
1037 {
1038  Expression exp = null;
1039 
1040 
1041  exp=assignmentExpression();
1042  return exp;
1043  }
1044 
1045  public Expression constantExpression() //throws RecognitionException, TokenStreamException
1046 {
1047  Expression exp = null;
1048 
1049 
1050  exp=expression();
1051  return exp;
1052  }
1053 
1054  public Expression booleanExpression() //throws RecognitionException, TokenStreamException
1055 {
1056  Expression exp = null;
1057 
1058 
1059  exp=expression();
1060  return exp;
1061  }
1062 
1063  public CompoundExpression expressionList() //throws RecognitionException, TokenStreamException
1064 {
1065  CompoundExpression ce = null;
1066 
1067  Expression exp = null;
1068 
1069  exp=expression();
1070  if (0==inputState.guessing)
1071  {
1072  ce = new CompoundExpression(exp.Location); ce.AddExpression(exp);
1073  }
1074  { // ( ... )*
1075  for (;;)
1076  {
1077  if ((LA(1)==COMMA))
1078  {
1079  match(COMMA);
1080  exp=expression();
1081  if (0==inputState.guessing)
1082  {
1083  ce.AddExpression(exp);
1084  }
1085  }
1086  else
1087  {
1088  goto _loop16_breakloop;
1089  }
1090 
1091  }
1092 _loop16_breakloop: ;
1093  } // ( ... )*
1094  return ce;
1095  }
1096 
1097  public Expression assignmentExpression() //throws RecognitionException, TokenStreamException
1098 {
1099  Expression exp = null;
1100 
1101  AssignmentOperator op = 0; BitwiseOperator opBit = 0; ArithmeticOperator opArith = 0; Expression exp1 = null; Expression exp2 = null;
1102 
1103  exp1=conditionalExpression();
1104  {
1105  switch ( LA(1) )
1106  {
1107  case ASSIGN:
1108  case PLUS_ASSIGN:
1109  case MINUS_ASSIGN:
1110  case STAR_ASSIGN:
1111  case DIV_ASSIGN:
1112  case MOD_ASSIGN:
1113  case BIN_AND_ASSIGN:
1114  case BIN_OR_ASSIGN:
1115  case BIN_XOR_ASSIGN:
1116  case SHIFTL_ASSIGN:
1117  case SHIFTR_ASSIGN:
1118  {
1119  {
1120  switch ( LA(1) )
1121  {
1122  case ASSIGN:
1123  {
1124  match(ASSIGN);
1125  if (0==inputState.guessing)
1126  {
1127  op = AssignmentOperator.Assign;
1128  }
1129  break;
1130  }
1131  case PLUS_ASSIGN:
1132  {
1133  match(PLUS_ASSIGN);
1134  if (0==inputState.guessing)
1135  {
1136  opArith = ArithmeticOperator.Plus;
1137  }
1138  break;
1139  }
1140  case MINUS_ASSIGN:
1141  {
1143  if (0==inputState.guessing)
1144  {
1145  opArith = ArithmeticOperator.Minus;
1146  }
1147  break;
1148  }
1149  case STAR_ASSIGN:
1150  {
1151  match(STAR_ASSIGN);
1152  if (0==inputState.guessing)
1153  {
1154  opArith = ArithmeticOperator.Mult;
1155  }
1156  break;
1157  }
1158  case DIV_ASSIGN:
1159  {
1160  match(DIV_ASSIGN);
1161  if (0==inputState.guessing)
1162  {
1163  opArith = ArithmeticOperator.Div;
1164  }
1165  break;
1166  }
1167  case MOD_ASSIGN:
1168  {
1169  match(MOD_ASSIGN);
1170  if (0==inputState.guessing)
1171  {
1172  opArith = ArithmeticOperator.Mod;
1173  }
1174  break;
1175  }
1176  case BIN_AND_ASSIGN:
1177  {
1179  if (0==inputState.guessing)
1180  {
1181  opBit = BitwiseOperator.BitwiseAnd;
1182  }
1183  break;
1184  }
1185  case BIN_OR_ASSIGN:
1186  {
1188  if (0==inputState.guessing)
1189  {
1190  opBit = BitwiseOperator.BitwiseOr;
1191  }
1192  break;
1193  }
1194  case BIN_XOR_ASSIGN:
1195  {
1197  if (0==inputState.guessing)
1198  {
1199  opBit = BitwiseOperator.BitwiseXOr;
1200  }
1201  break;
1202  }
1203  case SHIFTL_ASSIGN:
1204  {
1206  if (0==inputState.guessing)
1207  {
1208  opBit = BitwiseOperator.ShiftLeft;
1209  }
1210  break;
1211  }
1212  case SHIFTR_ASSIGN:
1213  {
1215  if (0==inputState.guessing)
1216  {
1217  opBit = BitwiseOperator.ShiftRight;
1218  }
1219  break;
1220  }
1221  default:
1222  {
1223  throw new NoViableAltException(LT(1), getFilename());
1224  }
1225  }
1226  }
1227  exp2=assignmentExpression();
1228  break;
1229  }
1230  case CLOSE_PAREN:
1231  case CLOSE_CURLY:
1232  case CLOSE_BRACK:
1233  case COMMA:
1234  case COLON:
1235  case SEMI:
1236  {
1237  break;
1238  }
1239  default:
1240  {
1241  throw new NoViableAltException(LT(1), getFilename());
1242  }
1243  }
1244  }
1245  if (0==inputState.guessing)
1246  {
1247 
1248  if (exp2 != null)
1249  {
1250  // exp1 ?= exp2 --> exp1 = exp1 ? exp2
1251  if (op == AssignmentOperator.Assign)
1252  exp = new AssignmentExpression(exp1, exp2, op, exp1.Location);
1253  else
1254  {
1255  if (opArith != 0)
1256  exp = new AssignmentExpression(exp1, new ArithmeticExpression(exp1.CloneInit(), exp2, opArith, exp1.Location), AssignmentOperator.Assign, exp1.Location); // creo qeu es un error poner exp1
1257  else
1258  exp = new AssignmentExpression(exp1, new BitwiseExpression(exp1.CloneInit(), exp2, opBit, exp1.Location), AssignmentOperator.Assign, exp1.Location);
1259  }
1260  }
1261  else
1262  exp = exp1;
1263 
1264  }
1265  return exp;
1266  }
1267 
1268  public Expression conditionalExpression() //throws RecognitionException, TokenStreamException
1269 {
1270  Expression exp = null;
1271 
1272  Expression exp1 = null; Expression exp2 = null; Expression exp3 = null;
1273 
1274  exp1=conditionalOrExpression();
1275  {
1276  switch ( LA(1) )
1277  {
1278  case QUESTION:
1279  {
1280  match(QUESTION);
1281  exp2=assignmentExpression();
1282  match(COLON);
1283  exp3=conditionalExpression();
1284  if (0==inputState.guessing)
1285  {
1286  exp = new TernaryExpression(exp1, exp2, exp3, TernaryOperator.Question, exp1.Location);
1287  }
1288  break;
1289  }
1290  case CLOSE_PAREN:
1291  case CLOSE_CURLY:
1292  case CLOSE_BRACK:
1293  case COMMA:
1294  case COLON:
1295  case SEMI:
1296  case ASSIGN:
1297  case PLUS_ASSIGN:
1298  case MINUS_ASSIGN:
1299  case STAR_ASSIGN:
1300  case DIV_ASSIGN:
1301  case MOD_ASSIGN:
1302  case BIN_AND_ASSIGN:
1303  case BIN_OR_ASSIGN:
1304  case BIN_XOR_ASSIGN:
1305  case SHIFTL_ASSIGN:
1306  case SHIFTR_ASSIGN:
1307  {
1308  break;
1309  }
1310  default:
1311  {
1312  throw new NoViableAltException(LT(1), getFilename());
1313  }
1314  }
1315  }
1316  if (0==inputState.guessing)
1317  {
1318  if (exp == null) exp = exp1;
1319  }
1320  return exp;
1321  }
1322 
1323  public Expression conditionalOrExpression() //throws RecognitionException, TokenStreamException
1324 {
1325  Expression exp = null;
1326 
1327  Expression exp1 = null; Expression exp2 = null;
1328 
1329  exp1=conditionalAndExpression();
1330  { // ( ... )*
1331  for (;;)
1332  {
1333  if ((LA(1)==LOG_OR))
1334  {
1335  match(LOG_OR);
1336  exp2=conditionalAndExpression();
1337  if (0==inputState.guessing)
1338  {
1339  exp1 = new LogicalExpression(exp1, exp2, LogicalOperator.Or, exp1.Location);
1340  }
1341  }
1342  else
1343  {
1344  goto _loop25_breakloop;
1345  }
1346 
1347  }
1348 _loop25_breakloop: ;
1349  } // ( ... )*
1350  if (0==inputState.guessing)
1351  {
1352  exp = exp1;
1353  }
1354  return exp;
1355  }
1356 
1357  public Expression conditionalAndExpression() //throws RecognitionException, TokenStreamException
1358 {
1359  Expression exp = null;
1360 
1361  Expression exp1 = null; Expression exp2 = null;
1362 
1363  exp1=inclusiveOrExpression();
1364  { // ( ... )*
1365  for (;;)
1366  {
1367  if ((LA(1)==LOG_AND))
1368  {
1369  match(LOG_AND);
1370  exp2=inclusiveOrExpression();
1371  if (0==inputState.guessing)
1372  {
1373  exp1 = new LogicalExpression(exp1, exp2, LogicalOperator.And, exp1.Location);
1374  }
1375  }
1376  else
1377  {
1378  goto _loop28_breakloop;
1379  }
1380 
1381  }
1382 _loop28_breakloop: ;
1383  } // ( ... )*
1384  if (0==inputState.guessing)
1385  {
1386  exp = exp1;
1387  }
1388  return exp;
1389  }
1390 
1391  public Expression inclusiveOrExpression() //throws RecognitionException, TokenStreamException
1392 {
1393  Expression exp = null;
1394 
1395  Expression exp1 = null; Expression exp2 = null;
1396 
1397  exp1=exclusiveOrExpression();
1398  { // ( ... )*
1399  for (;;)
1400  {
1401  if ((LA(1)==BIN_OR))
1402  {
1403  match(BIN_OR);
1404  exp2=exclusiveOrExpression();
1405  if (0==inputState.guessing)
1406  {
1407  exp1 = new BitwiseExpression(exp1, exp2, BitwiseOperator.BitwiseOr, exp1.Location);
1408  }
1409  }
1410  else
1411  {
1412  goto _loop31_breakloop;
1413  }
1414 
1415  }
1416 _loop31_breakloop: ;
1417  } // ( ... )*
1418  if (0==inputState.guessing)
1419  {
1420  exp = exp1;
1421  }
1422  return exp;
1423  }
1424 
1425  public Expression exclusiveOrExpression() //throws RecognitionException, TokenStreamException
1426 {
1427  Expression exp = null;
1428 
1429  Expression exp1 = null; Expression exp2 = null;
1430 
1431  exp1=andExpression();
1432  { // ( ... )*
1433  for (;;)
1434  {
1435  if ((LA(1)==BIN_XOR))
1436  {
1437  match(BIN_XOR);
1438  exp2=andExpression();
1439  if (0==inputState.guessing)
1440  {
1441  exp1 = new BitwiseExpression(exp1, exp2, BitwiseOperator.BitwiseXOr, exp1.Location);
1442  }
1443  }
1444  else
1445  {
1446  goto _loop34_breakloop;
1447  }
1448 
1449  }
1450 _loop34_breakloop: ;
1451  } // ( ... )*
1452  if (0==inputState.guessing)
1453  {
1454  exp = exp1;
1455  }
1456  return exp;
1457  }
1458 
1459  public Expression andExpression() //throws RecognitionException, TokenStreamException
1460 {
1461  Expression exp = null;
1462 
1463  Expression exp1 = null; Expression exp2 = null;
1464 
1465  exp1=equalityExpression();
1466  { // ( ... )*
1467  for (;;)
1468  {
1469  if ((LA(1)==BIN_AND))
1470  {
1471  match(BIN_AND);
1472  exp2=equalityExpression();
1473  if (0==inputState.guessing)
1474  {
1475  exp1 = new BitwiseExpression(exp1, exp2, BitwiseOperator.BitwiseAnd, exp1.Location);
1476  }
1477  }
1478  else
1479  {
1480  goto _loop37_breakloop;
1481  }
1482 
1483  }
1484 _loop37_breakloop: ;
1485  } // ( ... )*
1486  if (0==inputState.guessing)
1487  {
1488  exp = exp1;
1489  }
1490  return exp;
1491  }
1492 
1493  public Expression equalityExpression() //throws RecognitionException, TokenStreamException
1494 {
1495  Expression exp = null;
1496 
1497  RelationalOperator op = 0; Expression exp1 = null; Expression exp2 = null;
1498 
1499  exp1=relationalExpression();
1500  { // ( ... )*
1501  for (;;)
1502  {
1503  if ((LA(1)==EQUAL||LA(1)==NOT_EQUAL))
1504  {
1505  {
1506  switch ( LA(1) )
1507  {
1508  case EQUAL:
1509  {
1510  match(EQUAL);
1511  if (0==inputState.guessing)
1512  {
1513  op = RelationalOperator.Equal;
1514  }
1515  break;
1516  }
1517  case NOT_EQUAL:
1518  {
1519  match(NOT_EQUAL);
1520  if (0==inputState.guessing)
1521  {
1522  op = RelationalOperator.NotEqual;
1523  }
1524  break;
1525  }
1526  default:
1527  {
1528  throw new NoViableAltException(LT(1), getFilename());
1529  }
1530  }
1531  }
1532  exp2=relationalExpression();
1533  if (0==inputState.guessing)
1534  {
1535  exp1 = new RelationalExpression(exp1, exp2, op, exp1.Location);
1536  }
1537  }
1538  else
1539  {
1540  goto _loop41_breakloop;
1541  }
1542 
1543  }
1544 _loop41_breakloop: ;
1545  } // ( ... )*
1546  if (0==inputState.guessing)
1547  {
1548  exp = exp1;
1549  }
1550  return exp;
1551  }
1552 
1553  public Expression relationalExpression() //throws RecognitionException, TokenStreamException
1554 {
1555  Expression exp = null;
1556 
1557  IToken i = null;
1558  RelationalOperator op = 0; Expression exp1 = null; Expression exp2 = null; string typeExp = "";
1559 
1560  exp1=shiftExpression();
1561  {
1562  switch ( LA(1) )
1563  {
1564  case CLOSE_PAREN:
1565  case LOG_AND:
1566  case LOG_OR:
1567  case EQUAL:
1568  case NOT_EQUAL:
1569  case CLOSE_CURLY:
1570  case CLOSE_BRACK:
1571  case COMMA:
1572  case COLON:
1573  case SEMI:
1574  case BIN_AND:
1575  case BIN_OR:
1576  case BIN_XOR:
1577  case ASSIGN:
1578  case LTHAN:
1579  case GTHAN:
1580  case QUESTION:
1581  case LTE:
1582  case GTE:
1583  case PLUS_ASSIGN:
1584  case MINUS_ASSIGN:
1585  case STAR_ASSIGN:
1586  case DIV_ASSIGN:
1587  case MOD_ASSIGN:
1588  case BIN_AND_ASSIGN:
1589  case BIN_OR_ASSIGN:
1590  case BIN_XOR_ASSIGN:
1591  case SHIFTL_ASSIGN:
1592  case SHIFTR_ASSIGN:
1593  {
1594  { // ( ... )*
1595  for (;;)
1596  {
1597  if ((tokenSet_0_.member(LA(1))))
1598  {
1599  {
1600  switch ( LA(1) )
1601  {
1602  case LTHAN:
1603  {
1604  match(LTHAN);
1605  if (0==inputState.guessing)
1606  {
1607  op = RelationalOperator.LessThan;
1608  }
1609  break;
1610  }
1611  case GTHAN:
1612  {
1613  match(GTHAN);
1614  if (0==inputState.guessing)
1615  {
1616  op = RelationalOperator.GreaterThan;
1617  }
1618  break;
1619  }
1620  case LTE:
1621  {
1622  match(LTE);
1623  if (0==inputState.guessing)
1624  {
1625  op = RelationalOperator.LessThanOrEqual;
1626  }
1627  break;
1628  }
1629  case GTE:
1630  {
1631  match(GTE);
1632  if (0==inputState.guessing)
1633  {
1634  op = RelationalOperator.GreaterThanOrEqual;
1635  }
1636  break;
1637  }
1638  default:
1639  {
1640  throw new NoViableAltException(LT(1), getFilename());
1641  }
1642  }
1643  }
1644  exp2=additiveExpression();
1645  if (0==inputState.guessing)
1646  {
1647  exp1 = new RelationalExpression(exp1, exp2, op, exp1.Location);
1648  }
1649  }
1650  else
1651  {
1652  goto _loop46_breakloop;
1653  }
1654 
1655  }
1656 _loop46_breakloop: ;
1657  } // ( ... )*
1658  if (0==inputState.guessing)
1659  {
1660  exp = exp1;
1661  }
1662  break;
1663  }
1664  case IS:
1665  {
1666  i = LT(1);
1667  match(IS);
1668  typeExp=type();
1669  if (0==inputState.guessing)
1670  {
1671  exp = new IsExpression(exp1, typeExp, getLocation(i));
1672  }
1673  break;
1674  }
1675  default:
1676  {
1677  throw new NoViableAltException(LT(1), getFilename());
1678  }
1679  }
1680  }
1681  return exp;
1682  }
1683 
1684  public Expression shiftExpression() //throws RecognitionException, TokenStreamException
1685 {
1686  Expression exp = null;
1687 
1688  BitwiseOperator op = 0; Expression exp1 = null; Expression exp2 = null;
1689 
1690  exp1=additiveExpression();
1691  { // ( ... )*
1692  for (;;)
1693  {
1694  if ((LA(1)==SHIFTL||LA(1)==SHIFTR))
1695  {
1696  {
1697  switch ( LA(1) )
1698  {
1699  case SHIFTL:
1700  {
1701  match(SHIFTL);
1702  if (0==inputState.guessing)
1703  {
1704  op = BitwiseOperator.ShiftLeft;
1705  }
1706  break;
1707  }
1708  case SHIFTR:
1709  {
1710  match(SHIFTR);
1711  if (0==inputState.guessing)
1712  {
1713  op = BitwiseOperator.ShiftRight;
1714  }
1715  break;
1716  }
1717  default:
1718  {
1719  throw new NoViableAltException(LT(1), getFilename());
1720  }
1721  }
1722  }
1723  exp2=additiveExpression();
1724  if (0==inputState.guessing)
1725  {
1726  exp1 = new BitwiseExpression(exp1, exp2, op, exp1.Location);
1727  }
1728  }
1729  else
1730  {
1731  goto _loop50_breakloop;
1732  }
1733 
1734  }
1735 _loop50_breakloop: ;
1736  } // ( ... )*
1737  if (0==inputState.guessing)
1738  {
1739  exp = exp1;
1740  }
1741  return exp;
1742  }
1743 
1744  public Expression additiveExpression() //throws RecognitionException, TokenStreamException
1745 {
1746  Expression exp = null;
1747 
1748  ArithmeticOperator op = 0; Expression exp1 = null; Expression exp2 = null;
1749 
1750  exp1=multiplicativeExpression();
1751  { // ( ... )*
1752  for (;;)
1753  {
1754  if ((LA(1)==PLUS||LA(1)==MINUS))
1755  {
1756  {
1757  switch ( LA(1) )
1758  {
1759  case PLUS:
1760  {
1761  match(PLUS);
1762  if (0==inputState.guessing)
1763  {
1764  op = ArithmeticOperator.Plus;
1765  }
1766  break;
1767  }
1768  case MINUS:
1769  {
1770  match(MINUS);
1771  if (0==inputState.guessing)
1772  {
1773  op = ArithmeticOperator.Minus;
1774  }
1775  break;
1776  }
1777  default:
1778  {
1779  throw new NoViableAltException(LT(1), getFilename());
1780  }
1781  }
1782  }
1783  exp2=multiplicativeExpression();
1784  if (0==inputState.guessing)
1785  {
1786  exp1 = new ArithmeticExpression(exp1, exp2, op, exp1.Location);
1787  }
1788  }
1789  else
1790  {
1791  goto _loop54_breakloop;
1792  }
1793 
1794  }
1795 _loop54_breakloop: ;
1796  } // ( ... )*
1797  if (0==inputState.guessing)
1798  {
1799  exp = exp1;
1800  }
1801  return exp;
1802  }
1803 
1804  public Expression multiplicativeExpression() //throws RecognitionException, TokenStreamException
1805 {
1806  Expression exp = null;
1807 
1808  ArithmeticOperator op = 0; Expression exp1 = null; Expression exp2 = null;
1809 
1810  exp1=unaryExpression();
1811  { // ( ... )*
1812  for (;;)
1813  {
1814  if (((LA(1) >= STAR && LA(1) <= MOD)))
1815  {
1816  {
1817  switch ( LA(1) )
1818  {
1819  case STAR:
1820  {
1821  match(STAR);
1822  if (0==inputState.guessing)
1823  {
1824  op = ArithmeticOperator.Mult;
1825  }
1826  break;
1827  }
1828  case DIV:
1829  {
1830  match(DIV);
1831  if (0==inputState.guessing)
1832  {
1833  op = ArithmeticOperator.Div;
1834  }
1835  break;
1836  }
1837  case MOD:
1838  {
1839  match(MOD);
1840  if (0==inputState.guessing)
1841  {
1842  op = ArithmeticOperator.Mod;
1843  }
1844  break;
1845  }
1846  default:
1847  {
1848  throw new NoViableAltException(LT(1), getFilename());
1849  }
1850  }
1851  }
1852  exp2=unaryExpression();
1853  if (0==inputState.guessing)
1854  {
1855  exp1 = new ArithmeticExpression(exp1, exp2, op, exp1.Location);
1856  }
1857  }
1858  else
1859  {
1860  goto _loop58_breakloop;
1861  }
1862 
1863  }
1864 _loop58_breakloop: ;
1865  } // ( ... )*
1866  if (0==inputState.guessing)
1867  {
1868  exp = exp1;
1869  }
1870  return exp;
1871  }
1872 
1873  public Expression unaryExpression() //throws RecognitionException, TokenStreamException
1874 {
1875  Expression exp = null;
1876 
1877  IToken o = null;
1878  IToken i = null;
1879  IToken d = null;
1880  IToken p = null;
1881  IToken m = null;
1882  IToken l = null;
1883  IToken b = null;
1884  Expression e = null; string typeExp = "";
1885 
1886  switch ( LA(1) )
1887  {
1888  case INC:
1889  {
1890  i = LT(1);
1891  match(INC);
1892  e=unaryExpression();
1893  if (0==inputState.guessing)
1894  {
1895 
1896  // ++a -> a = a + 1;
1897  exp = new AssignmentExpression(e, new ArithmeticExpression(e.CloneInit(), new IntLiteralExpression(1, getLocation(i)), ArithmeticOperator.Plus, getLocation(i)), AssignmentOperator.Assign, getLocation(i));
1898 
1899  }
1900  break;
1901  }
1902  case DEC:
1903  {
1904  d = LT(1);
1905  match(DEC);
1906  e=unaryExpression();
1907  if (0==inputState.guessing)
1908  {
1909 
1910  // --a -> a = a - 1;
1911  exp = new AssignmentExpression(e, new ArithmeticExpression(e.CloneInit(), new IntLiteralExpression(1, getLocation(d)), ArithmeticOperator.Minus, getLocation(d)), AssignmentOperator.Assign, getLocation(d));
1912 
1913  }
1914  break;
1915  }
1916  case PLUS:
1917  {
1918  p = LT(1);
1919  match(PLUS);
1920  e=unaryExpression();
1921  if (0==inputState.guessing)
1922  {
1923  exp = new UnaryExpression(e, UnaryOperator.Plus, getLocation(p));
1924  }
1925  break;
1926  }
1927  case MINUS:
1928  {
1929  m = LT(1);
1930  match(MINUS);
1931  e=unaryExpression();
1932  if (0==inputState.guessing)
1933  {
1934  exp = new UnaryExpression(e, UnaryOperator.Minus, getLocation(m));
1935  }
1936  break;
1937  }
1938  case LOG_NOT:
1939  {
1940  l = LT(1);
1941  match(LOG_NOT);
1942  e=unaryExpression();
1943  if (0==inputState.guessing)
1944  {
1945  exp = new UnaryExpression(e, UnaryOperator.Not, getLocation(l));
1946  }
1947  break;
1948  }
1949  case BIN_NOT:
1950  {
1951  b = LT(1);
1952  match(BIN_NOT);
1953  e=unaryExpression();
1954  if (0==inputState.guessing)
1955  {
1956  exp = new UnaryExpression(e, UnaryOperator.BitwiseNot, getLocation(b));
1957  }
1958  break;
1959  }
1960  default:
1961  bool synPredMatched61 = false;
1962  if (((LA(1)==OPEN_PAREN) && (tokenSet_1_.member(LA(2)))))
1963  {
1964  int _m61 = mark();
1965  synPredMatched61 = true;
1966  inputState.guessing++;
1967  try {
1968  {
1969  match(OPEN_PAREN);
1970  type();
1971  match(CLOSE_PAREN);
1972  unaryExpression();
1973  }
1974  }
1975  catch (RecognitionException)
1976  {
1977  synPredMatched61 = false;
1978  }
1979  rewind(_m61);
1980  inputState.guessing--;
1981  }
1982  if ( synPredMatched61 )
1983  {
1984  o = LT(1);
1985  match(OPEN_PAREN);
1986  typeExp=type();
1987  match(CLOSE_PAREN);
1988  e=unaryExpression();
1989  if (0==inputState.guessing)
1990  {
1991  exp = new CastExpression(typeExp, e, getLocation(o));
1992  }
1993  }
1994  else if ((tokenSet_2_.member(LA(1))) && (tokenSet_3_.member(LA(2)))) {
1995  exp=primaryExpression();
1996  }
1997  else
1998  {
1999  throw new NoViableAltException(LT(1), getFilename());
2000  }
2001  break; }
2002  return exp;
2003  }
2004 
2005  public Expression primaryExpression() //throws RecognitionException, TokenStreamException
2006 {
2007  Expression exp = null;
2008 
2009  IToken o = null;
2010  IToken op = null;
2011  IToken d = null;
2012  IToken i = null;
2013  IToken de = null;
2014  Expression exp1 = null; CompoundExpression ce = null; Expression e = null; SingleIdentifierExpression id = null;
2015 
2017  { // ( ... )*
2018  for (;;)
2019  {
2020  if ((tokenSet_4_.member(LA(1))))
2021  {
2022  {
2023  switch ( LA(1) )
2024  {
2025  case OPEN_PAREN:
2026  {
2027  o = LT(1);
2028  match(OPEN_PAREN);
2029  {
2030  switch ( LA(1) )
2031  {
2032  case TRUE:
2033  case FALSE:
2034  case OPEN_PAREN:
2035  case LOG_NOT:
2036  case BASE:
2037  case NEW:
2038  case NULL:
2039  case THIS:
2040  case DOUBLE_LITERAL:
2041  case LITERAL_add:
2042  case LITERAL_remove:
2043  case LITERAL_get:
2044  case LITERAL_set:
2045  case LITERAL_assembly:
2046  case LITERAL_field:
2047  case LITERAL_method:
2048  case LITERAL_module:
2049  case LITERAL_param:
2050  case LITERAL_property:
2051  case LITERAL_type:
2052  case IDENTIFIER:
2053  case INT_LITERAL:
2054  case CHAR_LITERAL:
2055  case STRING_LITERAL:
2056  case PLUS:
2057  case MINUS:
2058  case BIN_NOT:
2059  case INC:
2060  case DEC:
2061  {
2062  ce=argumentList();
2063  break;
2064  }
2065  case CLOSE_PAREN:
2066  {
2067  break;
2068  }
2069  default:
2070  {
2071  throw new NoViableAltException(LT(1), getFilename());
2072  }
2073  }
2074  }
2075  match(CLOSE_PAREN);
2076  if (0==inputState.guessing)
2077  {
2078  e = new InvocationExpression(e, ce, getLocation(o));
2079  }
2080  break;
2081  }
2082  case OPEN_BRACK:
2083  {
2084  op = LT(1);
2085  match(OPEN_BRACK);
2086  exp1=expression();
2087  match(CLOSE_BRACK);
2088  if (0==inputState.guessing)
2089  {
2090  e = new ArrayAccessExpression(e, exp1, getLocation(op));
2091  }
2092  break;
2093  }
2094  case DOT:
2095  {
2096  d = LT(1);
2097  match(DOT);
2098  id=identifier();
2099  if (0==inputState.guessing)
2100  {
2101  e = new FieldAccessExpression(e, id, getLocation(d));
2102  }
2103  break;
2104  }
2105  case INC:
2106  {
2107  i = LT(1);
2108  match(INC);
2109  if (0==inputState.guessing)
2110  {
2111 
2112  // a++ -> (a = a + 1) - 1
2113  Location l = getLocation(i);
2114  e = new ArithmeticExpression(new AssignmentExpression(e, new ArithmeticExpression(e.CloneInit(), new IntLiteralExpression(1, l), ArithmeticOperator.Plus, l), AssignmentOperator.Assign, l), new IntLiteralExpression(1, l), ArithmeticOperator.Minus, l);
2115 
2116  }
2117  break;
2118  }
2119  case DEC:
2120  {
2121  de = LT(1);
2122  match(DEC);
2123  if (0==inputState.guessing)
2124  {
2125 
2126  // a-- -> (a = a - 1) + 1
2127  Location l = getLocation(de);
2128  e = new ArithmeticExpression(new AssignmentExpression(e, new ArithmeticExpression(e.CloneInit(), new IntLiteralExpression(1, l), ArithmeticOperator.Minus, l), AssignmentOperator.Assign, l), new IntLiteralExpression(1, l), ArithmeticOperator.Plus, l);
2129 
2130  }
2131  break;
2132  }
2133  default:
2134  {
2135  throw new NoViableAltException(LT(1), getFilename());
2136  }
2137  }
2138  }
2139  }
2140  else
2141  {
2142  goto _loop69_breakloop;
2143  }
2144 
2145  }
2146 _loop69_breakloop: ;
2147  } // ( ... )*
2148  if (0==inputState.guessing)
2149  {
2150  exp = e;
2151  }
2152  return exp;
2153  }
2154 
2155  public Expression basicPrimaryExpression() //throws RecognitionException, TokenStreamException
2156 {
2157  Expression exp = null;
2158 
2159  IToken t = null;
2160  IToken b = null;
2161  SingleIdentifierExpression id = null; Expression exp1 = null;
2162 
2163  {
2164  switch ( LA(1) )
2165  {
2166  case TRUE:
2167  case FALSE:
2168  case NULL:
2169  case DOUBLE_LITERAL:
2170  case INT_LITERAL:
2171  case CHAR_LITERAL:
2172  case STRING_LITERAL:
2173  {
2174  exp=literal();
2175  break;
2176  }
2177  case LITERAL_add:
2178  case LITERAL_remove:
2179  case LITERAL_get:
2180  case LITERAL_set:
2181  case LITERAL_assembly:
2182  case LITERAL_field:
2183  case LITERAL_method:
2184  case LITERAL_module:
2185  case LITERAL_param:
2186  case LITERAL_property:
2187  case LITERAL_type:
2188  case IDENTIFIER:
2189  {
2190  exp=identifier();
2191  break;
2192  }
2193  case OPEN_PAREN:
2194  {
2195  match(OPEN_PAREN);
2196  exp=assignmentExpression();
2197  match(CLOSE_PAREN);
2198  break;
2199  }
2200  case THIS:
2201  {
2202  t = LT(1);
2203  match(THIS);
2204  if (0==inputState.guessing)
2205  {
2206  exp = new ThisExpression(getLocation(t));
2207  }
2208  break;
2209  }
2210  case BASE:
2211  {
2212  b = LT(1);
2213  match(BASE);
2214  {
2215  switch ( LA(1) )
2216  {
2217  case DOT:
2218  {
2219  match(DOT);
2220  id=identifier();
2221  if (0==inputState.guessing)
2222  {
2223  exp = new FieldAccessExpression(new BaseExpression(getLocation(b)), id, getLocation(b));
2224  }
2225  break;
2226  }
2227  case OPEN_BRACK:
2228  {
2229  match(OPEN_BRACK);
2230  exp1=expression();
2231  match(CLOSE_BRACK);
2232  if (0==inputState.guessing)
2233  {
2234  exp = new ArrayAccessExpression(new BaseExpression(getLocation(b)), exp1, getLocation(b));
2235  }
2236  break;
2237  }
2238  default:
2239  {
2240  throw new NoViableAltException(LT(1), getFilename());
2241  }
2242  }
2243  }
2244  break;
2245  }
2246  case NEW:
2247  {
2248  exp=newExpression();
2249  break;
2250  }
2251  default:
2252  {
2253  throw new NoViableAltException(LT(1), getFilename());
2254  }
2255  }
2256  }
2257  return exp;
2258  }
2259 
2260  public Expression literal() //throws RecognitionException, TokenStreamException
2261 {
2262  Expression exp = null;
2263 
2264  IToken t = null;
2265  IToken f = null;
2266  IToken i = null;
2267  IToken d = null;
2268  IToken c = null;
2269  IToken s = null;
2270  IToken n = null;
2271 
2272  switch ( LA(1) )
2273  {
2274  case TRUE:
2275  {
2276  t = LT(1);
2277  match(TRUE);
2278  if (0==inputState.guessing)
2279  {
2280  exp = new BoolLiteralExpression(true, getLocation(t));
2281  }
2282  break;
2283  }
2284  case FALSE:
2285  {
2286  f = LT(1);
2287  match(FALSE);
2288  if (0==inputState.guessing)
2289  {
2290  exp = new BoolLiteralExpression(false, getLocation(f));
2291  }
2292  break;
2293  }
2294  case INT_LITERAL:
2295  {
2296  i = LT(1);
2297  match(INT_LITERAL);
2298  if (0==inputState.guessing)
2299  {
2300  exp = new IntLiteralExpression(Convert.ToInt32(i.getText()), getLocation(i));
2301  }
2302  break;
2303  }
2304  case DOUBLE_LITERAL:
2305  {
2306  d = LT(1);
2308  if (0==inputState.guessing)
2309  {
2310 
2311  NumberFormatInfo provider = new NumberFormatInfo();
2312  provider.NumberDecimalSeparator =".";
2313  exp = new DoubleLiteralExpression(Convert.ToDouble(d.getText(), provider), getLocation(d));
2314 
2315  }
2316  break;
2317  }
2318  case CHAR_LITERAL:
2319  {
2320  c = LT(1);
2322  if (0==inputState.guessing)
2323  {
2324 
2325  char literal = '\\';
2326  string aux = c.getText().Substring(1, c.getText().Length - 2);
2327  if (aux.Length == 1)
2328  {
2329  literal = aux[0];
2330  }
2331  else // Escape characters
2332  {
2333  switch (aux)
2334  {
2335  case "\\\'": literal = '\''; break;
2336  case "\\\"": literal = '\"'; break;
2337  case "\\\\": literal = '\\'; break;
2338  case "\\0": literal = '\0'; break;
2339  case "\\a": literal = '\a'; break;
2340  case "\\b": literal = '\b'; break;
2341  case "\\f": literal = '\f'; break;
2342  case "\\n": literal = '\n'; break;
2343  case "\\r": literal = '\r'; break;
2344  case "\\t": literal = '\t'; break;
2345  default: ErrorManager.Instance.NotifyError(new LexicalError("The character " + c.getText() + " is not allowed.", getLocation(c))); break;
2346  }
2347  }
2348  exp = new CharLiteralExpression(literal, getLocation(c));
2349 
2350  }
2351  break;
2352  }
2353  case STRING_LITERAL:
2354  {
2355  s = LT(1);
2357  if (0==inputState.guessing)
2358  {
2359  exp = new StringLiteralExpression(s.getText(), getLocation(s));
2360  }
2361  break;
2362  }
2363  case NULL:
2364  {
2365  n = LT(1);
2366  match(NULL);
2367  if (0==inputState.guessing)
2368  {
2369  exp = new NullExpression(getLocation(n));
2370  }
2371  break;
2372  }
2373  default:
2374  {
2375  throw new NoViableAltException(LT(1), getFilename());
2376  }
2377  }
2378  return exp;
2379  }
2380 
2381  public Expression newExpression() //throws RecognitionException, TokenStreamException
2382 {
2383  Expression exp = null;
2384 
2385  IToken n = null;
2386  CompoundExpression size = null; CompoundExpression ce = null; string typeExp = ""; int rank = 0;
2387 
2388  n = LT(1);
2389  match(NEW);
2390  typeExp=type();
2391  {
2392  switch ( LA(1) )
2393  {
2394  case OPEN_PAREN:
2395  {
2396  match(OPEN_PAREN);
2397  {
2398  switch ( LA(1) )
2399  {
2400  case TRUE:
2401  case FALSE:
2402  case OPEN_PAREN:
2403  case LOG_NOT:
2404  case BASE:
2405  case NEW:
2406  case NULL:
2407  case THIS:
2408  case DOUBLE_LITERAL:
2409  case LITERAL_add:
2410  case LITERAL_remove:
2411  case LITERAL_get:
2412  case LITERAL_set:
2413  case LITERAL_assembly:
2414  case LITERAL_field:
2415  case LITERAL_method:
2416  case LITERAL_module:
2417  case LITERAL_param:
2418  case LITERAL_property:
2419  case LITERAL_type:
2420  case IDENTIFIER:
2421  case INT_LITERAL:
2422  case CHAR_LITERAL:
2423  case STRING_LITERAL:
2424  case PLUS:
2425  case MINUS:
2426  case BIN_NOT:
2427  case INC:
2428  case DEC:
2429  {
2430  ce=argumentList();
2431  break;
2432  }
2433  case CLOSE_PAREN:
2434  {
2435  break;
2436  }
2437  default:
2438  {
2439  throw new NoViableAltException(LT(1), getFilename());
2440  }
2441  }
2442  }
2443  match(CLOSE_PAREN);
2444  if (0==inputState.guessing)
2445  {
2446  exp = new NewExpression(typeExp, ce, getLocation(n));
2447  }
2448  break;
2449  }
2450  case OPEN_CURLY:
2451  {
2452  ce=arrayInitializer();
2453  if (0==inputState.guessing)
2454  {
2455 
2456  exp = new NewArrayExpression(typeExp, getLocation(n)); ((NewArrayExpression)exp).Init = ce;
2457 
2458  string typeIdentifier = typeExp;
2459  while (typeIdentifier.Contains("[]"))
2460  {
2461  typeIdentifier = typeIdentifier.Substring(0, typeIdentifier.Length - 2);
2462  rank++;
2463  }
2464 
2465  ((NewArrayExpression)exp).Rank = rank;
2466 
2467  }
2468  break;
2469  }
2470  case OPEN_BRACK:
2471  {
2472  match(OPEN_BRACK);
2473  size=expressionList();
2474  match(CLOSE_BRACK);
2475  rank=rankSpecifiers();
2476  {
2477  switch ( LA(1) )
2478  {
2479  case OPEN_CURLY:
2480  {
2481  ce=arrayInitializer();
2482  break;
2483  }
2484  case OPEN_PAREN:
2485  case CLOSE_PAREN:
2486  case LOG_AND:
2487  case LOG_OR:
2488  case EQUAL:
2489  case NOT_EQUAL:
2490  case IS:
2491  case DOT:
2492  case CLOSE_CURLY:
2493  case OPEN_BRACK:
2494  case CLOSE_BRACK:
2495  case COMMA:
2496  case COLON:
2497  case SEMI:
2498  case PLUS:
2499  case MINUS:
2500  case STAR:
2501  case DIV:
2502  case MOD:
2503  case BIN_AND:
2504  case BIN_OR:
2505  case BIN_XOR:
2506  case ASSIGN:
2507  case LTHAN:
2508  case GTHAN:
2509  case QUESTION:
2510  case INC:
2511  case DEC:
2512  case SHIFTL:
2513  case SHIFTR:
2514  case LTE:
2515  case GTE:
2516  case PLUS_ASSIGN:
2517  case MINUS_ASSIGN:
2518  case STAR_ASSIGN:
2519  case DIV_ASSIGN:
2520  case MOD_ASSIGN:
2521  case BIN_AND_ASSIGN:
2522  case BIN_OR_ASSIGN:
2523  case BIN_XOR_ASSIGN:
2524  case SHIFTL_ASSIGN:
2525  case SHIFTR_ASSIGN:
2526  {
2527  break;
2528  }
2529  default:
2530  {
2531  throw new NoViableAltException(LT(1), getFilename());
2532  }
2533  }
2534  }
2535  if (0==inputState.guessing)
2536  {
2537 
2538  exp = new NewArrayExpression(typeExp, getLocation(n));
2539  if (size.ExpressionCount != 0)
2540  ((NewArrayExpression)exp).Size = size.GetExpressionElement(0);
2541  ((NewArrayExpression)exp).Init = ce; ((NewArrayExpression)exp).Rank = rank + 1;
2542 
2543  }
2544  break;
2545  }
2546  default:
2547  {
2548  throw new NoViableAltException(LT(1), getFilename());
2549  }
2550  }
2551  }
2552  return exp;
2553  }
2554 
2555  public CompoundExpression arrayInitializer() //throws RecognitionException, TokenStreamException
2556 {
2557  CompoundExpression ce = null;
2558 
2559 
2560  match(OPEN_CURLY);
2561  {
2562  switch ( LA(1) )
2563  {
2564  case CLOSE_CURLY:
2565  {
2566  match(CLOSE_CURLY);
2567  break;
2568  }
2569  case TRUE:
2570  case FALSE:
2571  case OPEN_PAREN:
2572  case LOG_NOT:
2573  case BASE:
2574  case NEW:
2575  case NULL:
2576  case THIS:
2577  case DOUBLE_LITERAL:
2578  case LITERAL_add:
2579  case LITERAL_remove:
2580  case LITERAL_get:
2581  case LITERAL_set:
2582  case LITERAL_assembly:
2583  case LITERAL_field:
2584  case LITERAL_method:
2585  case LITERAL_module:
2586  case LITERAL_param:
2587  case LITERAL_property:
2588  case LITERAL_type:
2589  case IDENTIFIER:
2590  case INT_LITERAL:
2591  case CHAR_LITERAL:
2592  case STRING_LITERAL:
2593  case OPEN_CURLY:
2594  case PLUS:
2595  case MINUS:
2596  case BIN_NOT:
2597  case INC:
2598  case DEC:
2599  {
2601  {
2602  switch ( LA(1) )
2603  {
2604  case COMMA:
2605  {
2606  match(COMMA);
2607  break;
2608  }
2609  case CLOSE_CURLY:
2610  {
2611  break;
2612  }
2613  default:
2614  {
2615  throw new NoViableAltException(LT(1), getFilename());
2616  }
2617  }
2618  }
2619  match(CLOSE_CURLY);
2620  break;
2621  }
2622  default:
2623  {
2624  throw new NoViableAltException(LT(1), getFilename());
2625  }
2626  }
2627  }
2628  return ce;
2629  }
2630 
2631  public void predefinedType() //throws RecognitionException, TokenStreamException
2632 {
2633 
2634 
2635  {
2636  switch ( LA(1) )
2637  {
2638  case BOOL:
2639  {
2640  match(BOOL);
2641  break;
2642  }
2643  case CHAR:
2644  {
2645  match(CHAR);
2646  break;
2647  }
2648  case DOUBLE:
2649  {
2650  match(DOUBLE);
2651  break;
2652  }
2653  case INT:
2654  {
2655  match(INT);
2656  break;
2657  }
2658  case OBJECT:
2659  {
2660  match(OBJECT);
2661  break;
2662  }
2663  case STRING:
2664  {
2665  match(STRING);
2666  break;
2667  }
2668  case VAR:
2669  {
2670  match(VAR);
2671  break;
2672  }
2673  default:
2674  {
2675  throw new NoViableAltException(LT(1), getFilename());
2676  }
2677  }
2678  }
2679  }
2680 
2681  public Statement statement() //throws RecognitionException, TokenStreamException
2682 {
2683  Statement stat = null;
2684 
2685 
2686  try { // for error handling
2687  if (((tokenSet_5_.member(LA(1))) && (tokenSet_6_.member(LA(2))))&&( ((LA(1) == CONST) && TypeRuleIsPredictedByLA(2) && IdentifierRuleIsPredictedByLA(3)) ||
2688  (TypeRuleIsPredictedByLA(1) && IdentifierRuleIsPredictedByLA(2)) ))
2689  {
2690  stat=declarationStatement();
2691  }
2692  else {
2693  bool synPredMatched81 = false;
2694  if (((tokenSet_5_.member(LA(1))) && (tokenSet_6_.member(LA(2)))))
2695  {
2696  int _m81 = mark();
2697  synPredMatched81 = true;
2698  inputState.guessing++;
2699  try {
2700  {
2701  {
2702  switch ( LA(1) )
2703  {
2704  case CONST:
2705  {
2706  match(CONST);
2707  break;
2708  }
2709  case BOOL:
2710  case CHAR:
2711  case DOUBLE:
2712  case INT:
2713  case OBJECT:
2714  case STRING:
2715  case VOID:
2716  case VAR:
2717  case LITERAL_add:
2718  case LITERAL_remove:
2719  case LITERAL_get:
2720  case LITERAL_set:
2721  case LITERAL_assembly:
2722  case LITERAL_field:
2723  case LITERAL_method:
2724  case LITERAL_module:
2725  case LITERAL_param:
2726  case LITERAL_property:
2727  case LITERAL_type:
2728  case IDENTIFIER:
2729  {
2730  break;
2731  }
2732  default:
2733  {
2734  throw new NoViableAltException(LT(1), getFilename());
2735  }
2736  }
2737  }
2738  type();
2739  identifier();
2740  }
2741  }
2742  catch (RecognitionException)
2743  {
2744  synPredMatched81 = false;
2745  }
2746  rewind(_m81);
2747  inputState.guessing--;
2748  }
2749  if ( synPredMatched81 )
2750  {
2751  stat=declarationStatement();
2752  }
2753  else if ((tokenSet_7_.member(LA(1))) && (tokenSet_8_.member(LA(2)))) {
2754  stat=embeddedStatement();
2755  }
2756  else
2757  {
2758  throw new NoViableAltException(LT(1), getFilename());
2759  }
2760  }
2761  }
2762  catch (RecognitionException ex)
2763  {
2764  if (0 == inputState.guessing)
2765  {
2766 
2767  ErrorManager.Instance.NotifyError(new ParserError(new Location(ex.fileName, ex.line, ex.column), ex.Message));
2768  // * We enter into panic mode (discarding tokens)
2769  if (this.errorState)
2770  this.match(NEWLINE);
2771  else
2772  this.errorState = true;
2773 
2774  }
2775  else
2776  {
2777  throw;
2778  }
2779  }
2780  return stat;
2781  }
2782 
2783  public DeclarationSet declarationStatement() //throws RecognitionException, TokenStreamException
2784 {
2785  DeclarationSet decls = null;
2786 
2787  List<Statement> ds = null;
2788 
2789  switch ( LA(1) )
2790  {
2791  case BOOL:
2792  case CHAR:
2793  case DOUBLE:
2794  case INT:
2795  case OBJECT:
2796  case STRING:
2797  case VOID:
2798  case VAR:
2799  case LITERAL_add:
2800  case LITERAL_remove:
2801  case LITERAL_get:
2802  case LITERAL_set:
2803  case LITERAL_assembly:
2804  case LITERAL_field:
2805  case LITERAL_method:
2806  case LITERAL_module:
2807  case LITERAL_param:
2808  case LITERAL_property:
2809  case LITERAL_type:
2810  case IDENTIFIER:
2811  {
2813  match(SEMI);
2814  if (0==inputState.guessing)
2815  {
2816  decls = new DeclarationSet(((Declaration)ds[0]).FullName, ds, ds[0].Location);
2817  }
2818  break;
2819  }
2820  case CONST:
2821  {
2823  match(SEMI);
2824  if (0==inputState.guessing)
2825  {
2826  decls = new DeclarationSet(((Declaration)ds[0]).FullName, ds, ds[0].Location);
2827  }
2828  break;
2829  }
2830  default:
2831  {
2832  throw new NoViableAltException(LT(1), getFilename());
2833  }
2834  }
2835  return decls;
2836  }
2837 
2838  public Statement embeddedStatement() //throws RecognitionException, TokenStreamException
2839 {
2840  Statement stat = null;
2841 
2842  IToken s = null;
2843 
2844  switch ( LA(1) )
2845  {
2846  case OPEN_CURLY:
2847  {
2848  stat=block();
2849  break;
2850  }
2851  case SEMI:
2852  {
2853  s = LT(1);
2854  match(SEMI);
2855  if (0==inputState.guessing)
2856  {
2857  stat = new Block(getLocation(s));
2858  }
2859  break;
2860  }
2861  case TRUE:
2862  case FALSE:
2863  case OPEN_PAREN:
2864  case LOG_NOT:
2865  case BASE:
2866  case NEW:
2867  case NULL:
2868  case THIS:
2869  case DOUBLE_LITERAL:
2870  case LITERAL_add:
2871  case LITERAL_remove:
2872  case LITERAL_get:
2873  case LITERAL_set:
2874  case LITERAL_assembly:
2875  case LITERAL_field:
2876  case LITERAL_method:
2877  case LITERAL_module:
2878  case LITERAL_param:
2879  case LITERAL_property:
2880  case LITERAL_type:
2881  case IDENTIFIER:
2882  case INT_LITERAL:
2883  case CHAR_LITERAL:
2884  case STRING_LITERAL:
2885  case PLUS:
2886  case MINUS:
2887  case BIN_NOT:
2888  case INC:
2889  case DEC:
2890  {
2891  stat=expressionStatement();
2892  break;
2893  }
2894  case IF:
2895  case SWITCH:
2896  {
2897  stat=selectionStatement();
2898  break;
2899  }
2900  case DO:
2901  case FOR:
2902  case FOREACH:
2903  case WHILE:
2904  {
2905  stat=iterationStatement();
2906  break;
2907  }
2908  case BREAK:
2909  case CONTINUE:
2910  case RETURN:
2911  case THROW:
2912  {
2913  stat=jumpStatement();
2914  break;
2915  }
2916  case TRY:
2917  {
2918  stat=tryStatement();
2919  break;
2920  }
2921  default:
2922  {
2923  throw new NoViableAltException(LT(1), getFilename());
2924  }
2925  }
2926  return stat;
2927  }
2928 
2929  public Block block() //throws RecognitionException, TokenStreamException
2930 {
2931  Block stat = null;
2932 
2933  IToken o = null;
2934  Statement s = null;
2935 
2936  o = LT(1);
2937  match(OPEN_CURLY);
2938  if (0==inputState.guessing)
2939  {
2940  stat = new Block(getLocation(o));
2941  }
2942  { // ( ... )*
2943  for (;;)
2944  {
2945  if ((tokenSet_9_.member(LA(1))))
2946  {
2947  s=statement();
2948  if (0==inputState.guessing)
2949  {
2950  stat.AddStatement(s);
2951  }
2952  }
2953  else
2954  {
2955  goto _loop86_breakloop;
2956  }
2957 
2958  }
2959 _loop86_breakloop: ;
2960  } // ( ... )*
2961  match(CLOSE_CURLY);
2962  return stat;
2963  }
2964 
2965  public Statement expressionStatement() //throws RecognitionException, TokenStreamException
2966 {
2967  Statement stat = null;
2968 
2969 
2970  stat=statementExpression();
2971  match(SEMI);
2972  return stat;
2973  }
2974 
2975  public Statement selectionStatement() //throws RecognitionException, TokenStreamException
2976 {
2977  Statement stat = null;
2978 
2979 
2980  switch ( LA(1) )
2981  {
2982  case IF:
2983  {
2984  stat=ifStatement();
2985  break;
2986  }
2987  case SWITCH:
2988  {
2989  stat=switchStatement();
2990  break;
2991  }
2992  default:
2993  {
2994  throw new NoViableAltException(LT(1), getFilename());
2995  }
2996  }
2997  return stat;
2998  }
2999 
3000  public Statement iterationStatement() //throws RecognitionException, TokenStreamException
3001 {
3002  Statement stat = null;
3003 
3004 
3005  switch ( LA(1) )
3006  {
3007  case WHILE:
3008  {
3009  stat=whileStatement();
3010  break;
3011  }
3012  case DO:
3013  {
3014  stat=doStatement();
3015  break;
3016  }
3017  case FOR:
3018  {
3019  stat=forStatement();
3020  break;
3021  }
3022  case FOREACH:
3023  {
3024  stat=foreachStatement();
3025  break;
3026  }
3027  default:
3028  {
3029  throw new NoViableAltException(LT(1), getFilename());
3030  }
3031  }
3032  return stat;
3033  }
3034 
3035  public Statement jumpStatement() //throws RecognitionException, TokenStreamException
3036 {
3037  Statement stat = null;
3038 
3039 
3040  switch ( LA(1) )
3041  {
3042  case BREAK:
3043  {
3044  stat=breakStatement();
3045  break;
3046  }
3047  case CONTINUE:
3048  {
3049  stat=continueStatement();
3050  break;
3051  }
3052  case RETURN:
3053  {
3054  stat=returnStatement();
3055  break;
3056  }
3057  case THROW:
3058  {
3059  stat=throwStatement();
3060  break;
3061  }
3062  default:
3063  {
3064  throw new NoViableAltException(LT(1), getFilename());
3065  }
3066  }
3067  return stat;
3068  }
3069 
3070  public Statement tryStatement() //throws RecognitionException, TokenStreamException
3071 {
3072  Statement stat = null;
3073 
3074  IToken t = null;
3075  ExceptionManagementStatement em = null; Block stats = null, f = null; CatchStatement c = null; List<CatchStatement> l = new List<CatchStatement>();
3076 
3077  t = LT(1);
3078  match(TRY);
3079  stats=block();
3080  { // ( ... )*
3081  for (;;)
3082  {
3083  if ((LA(1)==CATCH))
3084  {
3085  c=catchClause();
3086  if (0==inputState.guessing)
3087  {
3088  l.Add(c);
3089  }
3090  }
3091  else
3092  {
3093  goto _loop150_breakloop;
3094  }
3095 
3096  }
3097 _loop150_breakloop: ;
3098  } // ( ... )*
3099  {
3100  switch ( LA(1) )
3101  {
3102  case FINALLY:
3103  {
3104  f=finallyClause();
3105  break;
3106  }
3107  case TRUE:
3108  case FALSE:
3109  case DEFAULT:
3110  case OPEN_PAREN:
3111  case LOG_NOT:
3112  case BASE:
3113  case BOOL:
3114  case BREAK:
3115  case CASE:
3116  case CHAR:
3117  case CONST:
3118  case CONTINUE:
3119  case DO:
3120  case DOUBLE:
3121  case ELSE:
3122  case FOR:
3123  case FOREACH:
3124  case IF:
3125  case INT:
3126  case NEW:
3127  case NULL:
3128  case OBJECT:
3129  case RETURN:
3130  case STRING:
3131  case SWITCH:
3132  case THIS:
3133  case THROW:
3134  case TRY:
3135  case VOID:
3136  case WHILE:
3137  case VAR:
3138  case DOUBLE_LITERAL:
3139  case LITERAL_add:
3140  case LITERAL_remove:
3141  case LITERAL_get:
3142  case LITERAL_set:
3143  case LITERAL_assembly:
3144  case LITERAL_field:
3145  case LITERAL_method:
3146  case LITERAL_module:
3147  case LITERAL_param:
3148  case LITERAL_property:
3149  case LITERAL_type:
3150  case IDENTIFIER:
3151  case INT_LITERAL:
3152  case CHAR_LITERAL:
3153  case STRING_LITERAL:
3154  case OPEN_CURLY:
3155  case CLOSE_CURLY:
3156  case SEMI:
3157  case PLUS:
3158  case MINUS:
3159  case BIN_NOT:
3160  case INC:
3161  case DEC:
3162  {
3163  break;
3164  }
3165  default:
3166  {
3167  throw new NoViableAltException(LT(1), getFilename());
3168  }
3169  }
3170  }
3171  if (0==inputState.guessing)
3172  {
3173  stat = em = new ExceptionManagementStatement (stats, l, f, getLocation(t));
3174  }
3175  return stat;
3176  }
3177 
3178  public Block body() //throws RecognitionException, TokenStreamException
3179 {
3180  Block stat = null;
3181 
3182  IToken s = null;
3183 
3184  switch ( LA(1) )
3185  {
3186  case OPEN_CURLY:
3187  {
3188  stat=block();
3189  break;
3190  }
3191  case SEMI:
3192  {
3193  s = LT(1);
3194  match(SEMI);
3195  if (0==inputState.guessing)
3196  {
3197  stat = new Block(getLocation(s));
3198  }
3199  break;
3200  }
3201  default:
3202  {
3203  throw new NoViableAltException(LT(1), getFilename());
3204  }
3205  }
3206  return stat;
3207  }
3208 
3209  public List<Statement> statementList() //throws RecognitionException, TokenStreamException
3210 {
3211  List<Statement> stats = new List<Statement>();
3212 
3213  Statement stat = null;
3214 
3215  { // ( ... )+
3216  int _cnt89=0;
3217  for (;;)
3218  {
3219  if ((tokenSet_9_.member(LA(1))))
3220  {
3221  stat=statement();
3222  if (0==inputState.guessing)
3223  {
3224  stats.Add(stat);
3225  }
3226  }
3227  else
3228  {
3229  if (_cnt89 >= 1) { goto _loop89_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
3230  }
3231 
3232  _cnt89++;
3233  }
3234 _loop89_breakloop: ;
3235  } // ( ... )+
3236  return stats;
3237  }
3238 
3239  public List<Statement> localVariableDeclaration() //throws RecognitionException, TokenStreamException
3240 {
3241  List<Statement> statList = null;
3242 
3243  string typeExp = "";
3244 
3245  typeExp=type();
3246  statList=localVariableDeclarators(typeExp);
3247  return statList;
3248  }
3249 
3250  public List<Statement> localConstantDeclaration() //throws RecognitionException, TokenStreamException
3251 {
3252  List<Statement> statList = null;
3253 
3254  string typeExp = "";
3255 
3256  match(CONST);
3257  typeExp=type();
3258  statList=localConstantDeclarators(typeExp);
3259  return statList;
3260  }
3261 
3262  public List<Statement> localVariableDeclarators(
3263  string type
3264  ) //throws RecognitionException, TokenStreamException
3265 {
3266  List<Statement> statList = new List<Statement>();
3267 
3268  Statement s1 = null;
3269 
3270  s1=localVariableDeclarator(type);
3271  if (0==inputState.guessing)
3272  {
3273  statList.Add(s1);
3274  }
3275  { // ( ... )*
3276  for (;;)
3277  {
3278  if ((LA(1)==COMMA))
3279  {
3280  if (0==inputState.guessing)
3281  {
3282  // Creates a new VariableType.
3283  type = TypeSystem.TypeTable.ObtainNewType(type);
3284  }
3285  match(COMMA);
3286  s1=localVariableDeclarator(type);
3287  if (0==inputState.guessing)
3288  {
3289  statList.Add(s1);
3290  }
3291  }
3292  else
3293  {
3294  goto _loop94_breakloop;
3295  }
3296 
3297  }
3298 _loop94_breakloop: ;
3299  } // ( ... )*
3300  return statList;
3301  }
3302 
3304  string type
3305  ) //throws RecognitionException, TokenStreamException
3306 {
3307  Declaration decl = null;
3308 
3309  SingleIdentifierExpression id = null; Expression exp = null;
3310 
3311  id=identifier();
3312  {
3313  switch ( LA(1) )
3314  {
3315  case ASSIGN:
3316  {
3317  match(ASSIGN);
3319  break;
3320  }
3321  case COMMA:
3322  case SEMI:
3323  {
3324  break;
3325  }
3326  default:
3327  {
3328  throw new NoViableAltException(LT(1), getFilename());
3329  }
3330  }
3331  }
3332  if (0==inputState.guessing)
3333  {
3334 
3335  if (exp == null)
3336  decl = new IdDeclaration(id, type, id.Location);
3337  else
3338  decl = new Definition(id, type, exp, id.Location);
3339 
3340  }
3341  return decl;
3342  }
3343 
3344  public Expression localVariableInitializer() //throws RecognitionException, TokenStreamException
3345 {
3346  Expression exp = null;;
3347 
3348 
3349  {
3350  switch ( LA(1) )
3351  {
3352  case TRUE:
3353  case FALSE:
3354  case OPEN_PAREN:
3355  case LOG_NOT:
3356  case BASE:
3357  case NEW:
3358  case NULL:
3359  case THIS:
3360  case DOUBLE_LITERAL:
3361  case LITERAL_add:
3362  case LITERAL_remove:
3363  case LITERAL_get:
3364  case LITERAL_set:
3365  case LITERAL_assembly:
3366  case LITERAL_field:
3367  case LITERAL_method:
3368  case LITERAL_module:
3369  case LITERAL_param:
3370  case LITERAL_property:
3371  case LITERAL_type:
3372  case IDENTIFIER:
3373  case INT_LITERAL:
3374  case CHAR_LITERAL:
3375  case STRING_LITERAL:
3376  case PLUS:
3377  case MINUS:
3378  case BIN_NOT:
3379  case INC:
3380  case DEC:
3381  {
3382  exp=expression();
3383  break;
3384  }
3385  case OPEN_CURLY:
3386  {
3387  exp=arrayInitializer();
3388  break;
3389  }
3390  default:
3391  {
3392  throw new NoViableAltException(LT(1), getFilename());
3393  }
3394  }
3395  }
3396  return exp;
3397  }
3398 
3399  public List<Statement> localConstantDeclarators(
3400  string type
3401  ) //throws RecognitionException, TokenStreamException
3402 {
3403  List<Statement> statList = new List<Statement>();
3404 
3405  Statement s1 = null;
3406 
3407  s1=localConstantDeclarator(type);
3408  if (0==inputState.guessing)
3409  {
3410  statList.Add(s1);
3411  }
3412  { // ( ... )*
3413  for (;;)
3414  {
3415  if ((LA(1)==COMMA))
3416  {
3417  if (0==inputState.guessing)
3418  {
3419  // Creates a new VariableType.
3420  type = TypeSystem.TypeTable.ObtainNewType(type);
3421  }
3422  match(COMMA);
3423  s1=localConstantDeclarator(type);
3424  if (0==inputState.guessing)
3425  {
3426  statList.Add(s1);
3427  }
3428  }
3429  else
3430  {
3431  goto _loop102_breakloop;
3432  }
3433 
3434  }
3435 _loop102_breakloop: ;
3436  } // ( ... )*
3437  return statList;
3438  }
3439 
3441  string type
3442  ) //throws RecognitionException, TokenStreamException
3443 {
3444  ConstantDefinition cd = null;
3445 
3446  SingleIdentifierExpression id = null; Expression exp = null;
3447 
3448  id=identifier();
3449  match(ASSIGN);
3450  exp=constantExpression();
3451  if (0==inputState.guessing)
3452  {
3453  cd = new ConstantDefinition(id, type, exp, id.Location);
3454  }
3455  return cd;
3456  }
3457 
3458  public List<FieldDeclaration> constantDeclarators(
3459  string type, List<Modifier> mods
3460  ) //throws RecognitionException, TokenStreamException
3461 {
3462  List<FieldDeclaration> decls = new List<FieldDeclaration>();
3463 
3464  FieldDeclaration decl = null;
3465 
3466  decl=constantDeclarator(type, mods);
3467  if (0==inputState.guessing)
3468  {
3469  decls.Add(decl);
3470  }
3471  { // ( ... )*
3472  for (;;)
3473  {
3474  if ((LA(1)==COMMA))
3475  {
3476  if (0==inputState.guessing)
3477  {
3478  // Creates a new VariableType.
3479  type = TypeSystem.TypeTable.ObtainNewType(type);
3480  }
3481  match(COMMA);
3482  decl=constantDeclarator(type, mods);
3483  if (0==inputState.guessing)
3484  {
3485  decls.Add(decl);
3486  }
3487  }
3488  else
3489  {
3490  goto _loop106_breakloop;
3491  }
3492 
3493  }
3494 _loop106_breakloop: ;
3495  } // ( ... )*
3496  return decls;
3497  }
3498 
3500  string type, List<Modifier> mods
3501  ) //throws RecognitionException, TokenStreamException
3502 {
3503  ConstantFieldDefinition cd = null;
3504 
3505  SingleIdentifierExpression id = null; Expression exp = null;
3506 
3507  id=identifier();
3508  match(ASSIGN);
3509  exp=constantExpression();
3510  if (0==inputState.guessing)
3511  {
3512  cd = new ConstantFieldDefinition(id, type, exp, mods, id.Location);
3513  }
3514  return cd;
3515  }
3516 
3517  public Expression statementExpression() //throws RecognitionException, TokenStreamException
3518 {
3519  Expression exp = null;
3520 
3521 
3522  exp=assignmentExpression();
3523  return exp;
3524  }
3525 
3526  public Statement ifStatement() //throws RecognitionException, TokenStreamException
3527 {
3528  Statement st = null;
3529 
3530  IToken i = null;
3531  Statement stat1 = null; Statement stat2 = null; Expression exp = null;
3532 
3533  i = LT(1);
3534  match(IF);
3535  match(OPEN_PAREN);
3536  exp=booleanExpression();
3537  match(CLOSE_PAREN);
3538  stat1=embeddedStatement();
3539  {
3540  if ((LA(1)==ELSE) && (tokenSet_7_.member(LA(2))))
3541  {
3542  stat2=elseStatement();
3543  }
3544  else if ((tokenSet_10_.member(LA(1))) && (tokenSet_11_.member(LA(2)))) {
3545  }
3546  else
3547  {
3548  throw new NoViableAltException(LT(1), getFilename());
3549  }
3550 
3551  }
3552  if (0==inputState.guessing)
3553  {
3554 
3555  if (stat2 == null)
3556  st = new IfElseStatement(exp, stat1, getLocation(i));
3557  else
3558  st = new IfElseStatement(exp, stat1, stat2, getLocation(i));
3559 
3560  }
3561  return st;
3562  }
3563 
3564  public SwitchStatement switchStatement() //throws RecognitionException, TokenStreamException
3565 {
3566  SwitchStatement stat = null;
3567 
3568  IToken s = null;
3569  Expression exp = null; List<SwitchSection> block = null;
3570 
3571  s = LT(1);
3572  match(SWITCH);
3573  match(OPEN_PAREN);
3574  exp=expression();
3575  match(CLOSE_PAREN);
3576  block=switchBlock();
3577  if (0==inputState.guessing)
3578  {
3579  stat = new SwitchStatement(exp, block, getLocation(s));
3580  }
3581  return stat;
3582  }
3583 
3584  public Statement elseStatement() //throws RecognitionException, TokenStreamException
3585 {
3586  Statement st = null;
3587 
3588 
3589  match(ELSE);
3590  st=embeddedStatement();
3591  return st;
3592  }
3593 
3594  public List<SwitchSection> switchBlock() //throws RecognitionException, TokenStreamException
3595 {
3596  List<SwitchSection> sections = new List<SwitchSection>();
3597 
3598 
3599  match(OPEN_CURLY);
3600  {
3601  switch ( LA(1) )
3602  {
3603  case DEFAULT:
3604  case CASE:
3605  {
3606  sections=switchSections();
3607  break;
3608  }
3609  case CLOSE_CURLY:
3610  {
3611  break;
3612  }
3613  default:
3614  {
3615  throw new NoViableAltException(LT(1), getFilename());
3616  }
3617  }
3618  }
3619  match(CLOSE_CURLY);
3620  return sections;
3621  }
3622 
3623  public List<SwitchSection> switchSections() //throws RecognitionException, TokenStreamException
3624 {
3625  List<SwitchSection> sections = new List<SwitchSection>();
3626 
3627  SwitchSection section = null;
3628 
3629  { // ( ... )+
3630  int _cnt119=0;
3631  for (;;)
3632  {
3633  if ((LA(1)==DEFAULT||LA(1)==CASE))
3634  {
3635  section=switchSection();
3636  if (0==inputState.guessing)
3637  {
3638  sections.Add(section);
3639  }
3640  }
3641  else
3642  {
3643  if (_cnt119 >= 1) { goto _loop119_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
3644  }
3645 
3646  _cnt119++;
3647  }
3648 _loop119_breakloop: ;
3649  } // ( ... )+
3650  return sections;
3651  }
3652 
3653  public SwitchSection switchSection() //throws RecognitionException, TokenStreamException
3654 {
3655  SwitchSection section = null;
3656 
3657  List<SwitchLabel> labels = null; List<Statement> stats = null;
3658 
3659  labels=switchLabels();
3660  stats=statementList();
3661  if (0==inputState.guessing)
3662  {
3663  section = new SwitchSection(labels, stats, labels[0].Location);
3664  }
3665  return section;
3666  }
3667 
3668  public List<SwitchLabel> switchLabels() //throws RecognitionException, TokenStreamException
3669 {
3670  List<SwitchLabel> labels = new List<SwitchLabel>();
3671 
3672  SwitchLabel label = null;
3673 
3674  { // ( ... )+
3675  int _cnt123=0;
3676  for (;;)
3677  {
3678  if ((LA(1)==DEFAULT||LA(1)==CASE))
3679  {
3680  label=switchLabel();
3681  if (0==inputState.guessing)
3682  {
3683  labels.Add(label);
3684  }
3685  }
3686  else
3687  {
3688  if (_cnt123 >= 1) { goto _loop123_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
3689  }
3690 
3691  _cnt123++;
3692  }
3693 _loop123_breakloop: ;
3694  } // ( ... )+
3695  return labels;
3696  }
3697 
3698  public SwitchLabel switchLabel() //throws RecognitionException, TokenStreamException
3699 {
3700  SwitchLabel label = null;
3701 
3702  IToken c = null;
3703  IToken d = null;
3704  Expression exp = null;
3705 
3706  switch ( LA(1) )
3707  {
3708  case CASE:
3709  {
3710  c = LT(1);
3711  match(CASE);
3712  exp=constantExpression();
3713  match(COLON);
3714  if (0==inputState.guessing)
3715  {
3716  label = new SwitchLabel(exp, getLocation(c));
3717  }
3718  break;
3719  }
3720  case DEFAULT:
3721  {
3722  d = LT(1);
3723  match(DEFAULT);
3724  match(COLON);
3725  if (0==inputState.guessing)
3726  {
3727  label = new SwitchLabel(getLocation(d));
3728  }
3729  break;
3730  }
3731  default:
3732  {
3733  throw new NoViableAltException(LT(1), getFilename());
3734  }
3735  }
3736  return label;
3737  }
3738 
3739  public Statement whileStatement() //throws RecognitionException, TokenStreamException
3740 {
3741  Statement s = null;
3742 
3743  IToken w = null;
3744  Expression exp = null; Statement stat = null;
3745 
3746  w = LT(1);
3747  match(WHILE);
3748  match(OPEN_PAREN);
3749  exp=booleanExpression();
3750  match(CLOSE_PAREN);
3751  stat=embeddedStatement();
3752  if (0==inputState.guessing)
3753  {
3754  s = new WhileStatement(exp, stat, getLocation(w));
3755  }
3756  return s;
3757  }
3758 
3759  public Statement doStatement() //throws RecognitionException, TokenStreamException
3760 {
3761  Statement s = null;
3762 
3763  IToken d = null;
3764  Expression exp = null; Statement stat = null;
3765 
3766  d = LT(1);
3767  match(DO);
3768  stat=embeddedStatement();
3769  match(WHILE);
3770  match(OPEN_PAREN);
3771  exp=booleanExpression();
3772  match(CLOSE_PAREN);
3773  match(SEMI);
3774  if (0==inputState.guessing)
3775  {
3776  s = new DoStatement(stat, exp, getLocation(d));
3777  }
3778  return s;
3779  }
3780 
3781  public Statement forStatement() //throws RecognitionException, TokenStreamException
3782 {
3783  Statement s = null;
3784 
3785  IToken f = null;
3786  Statement stat = null; Expression cond = null; List<Statement> stats1 = null; List<Statement> stats2 = null;
3787 
3788  f = LT(1);
3789  match(FOR);
3790  match(OPEN_PAREN);
3791  stats1=forInitializer();
3792  match(SEMI);
3793  cond=forCondition();
3794  match(SEMI);
3795  stats2=forIterator();
3796  match(CLOSE_PAREN);
3797  stat=embeddedStatement();
3798  if (0==inputState.guessing)
3799  {
3800  s = new ForStatement(stats1, cond, stats2, stat, getLocation(f));
3801  }
3802  return s;
3803  }
3804 
3805  public Statement foreachStatement() //throws RecognitionException, TokenStreamException
3806 {
3807  Statement s = null;
3808 
3809  IToken f = null;
3810  string typeExp = ""; SingleIdentifierExpression id = null; Expression e = null; Statement stat = null;
3811 
3812  f = LT(1);
3813  match(FOREACH);
3814  match(OPEN_PAREN);
3815  typeExp=type();
3816  id=identifier();
3817  match(IN);
3818  e=expression();
3819  match(CLOSE_PAREN);
3820  stat=embeddedStatement();
3821  if (0==inputState.guessing)
3822  {
3823  s = new ForeachStatement(typeExp, id, e, stat, getLocation(f));
3824  }
3825  return s;
3826  }
3827 
3828  public List<Statement> forInitializer() //throws RecognitionException, TokenStreamException
3829 {
3830  List<Statement> stat = null;
3831 
3832 
3833  {
3834  if (((tokenSet_1_.member(LA(1))) && (tokenSet_12_.member(LA(2))))&&( (TypeRuleIsPredictedByLA(1) && IdentifierRuleIsPredictedByLA(2)) ))
3835  {
3836  stat=localVariableDeclaration();
3837  }
3838  else {
3839  bool synPredMatched132 = false;
3840  if (((tokenSet_1_.member(LA(1))) && (tokenSet_12_.member(LA(2)))))
3841  {
3842  int _m132 = mark();
3843  synPredMatched132 = true;
3844  inputState.guessing++;
3845  try {
3846  {
3847  type();
3848  identifier();
3849  }
3850  }
3851  catch (RecognitionException)
3852  {
3853  synPredMatched132 = false;
3854  }
3855  rewind(_m132);
3856  inputState.guessing--;
3857  }
3858  if ( synPredMatched132 )
3859  {
3860  stat=localVariableDeclaration();
3861  }
3862  else if ((tokenSet_13_.member(LA(1))) && (tokenSet_14_.member(LA(2)))) {
3863  stat=statementExpressionList();
3864  }
3865  else if ((LA(1)==SEMI)) {
3866  }
3867  else
3868  {
3869  throw new NoViableAltException(LT(1), getFilename());
3870  }
3871  }
3872  }
3873  return stat;
3874  }
3875 
3876  public Expression forCondition() //throws RecognitionException, TokenStreamException
3877 {
3878  Expression exp = null;
3879 
3880 
3881  {
3882  switch ( LA(1) )
3883  {
3884  case TRUE:
3885  case FALSE:
3886  case OPEN_PAREN:
3887  case LOG_NOT:
3888  case BASE:
3889  case NEW:
3890  case NULL:
3891  case THIS:
3892  case DOUBLE_LITERAL:
3893  case LITERAL_add:
3894  case LITERAL_remove:
3895  case LITERAL_get:
3896  case LITERAL_set:
3897  case LITERAL_assembly:
3898  case LITERAL_field:
3899  case LITERAL_method:
3900  case LITERAL_module:
3901  case LITERAL_param:
3902  case LITERAL_property:
3903  case LITERAL_type:
3904  case IDENTIFIER:
3905  case INT_LITERAL:
3906  case CHAR_LITERAL:
3907  case STRING_LITERAL:
3908  case PLUS:
3909  case MINUS:
3910  case BIN_NOT:
3911  case INC:
3912  case DEC:
3913  {
3914  exp=booleanExpression();
3915  break;
3916  }
3917  case SEMI:
3918  {
3919  break;
3920  }
3921  default:
3922  {
3923  throw new NoViableAltException(LT(1), getFilename());
3924  }
3925  }
3926  }
3927  return exp;
3928  }
3929 
3930  public List<Statement> forIterator() //throws RecognitionException, TokenStreamException
3931 {
3932  List<Statement> statList = null;
3933 
3934 
3935  {
3936  switch ( LA(1) )
3937  {
3938  case TRUE:
3939  case FALSE:
3940  case OPEN_PAREN:
3941  case LOG_NOT:
3942  case BASE:
3943  case NEW:
3944  case NULL:
3945  case THIS:
3946  case DOUBLE_LITERAL:
3947  case LITERAL_add:
3948  case LITERAL_remove:
3949  case LITERAL_get:
3950  case LITERAL_set:
3951  case LITERAL_assembly:
3952  case LITERAL_field:
3953  case LITERAL_method:
3954  case LITERAL_module:
3955  case LITERAL_param:
3956  case LITERAL_property:
3957  case LITERAL_type:
3958  case IDENTIFIER:
3959  case INT_LITERAL:
3960  case CHAR_LITERAL:
3961  case STRING_LITERAL:
3962  case PLUS:
3963  case MINUS:
3964  case BIN_NOT:
3965  case INC:
3966  case DEC:
3967  {
3968  statList=statementExpressionList();
3969  break;
3970  }
3971  case CLOSE_PAREN:
3972  {
3973  break;
3974  }
3975  default:
3976  {
3977  throw new NoViableAltException(LT(1), getFilename());
3978  }
3979  }
3980  }
3981  return statList;
3982  }
3983 
3984  public List<Statement> statementExpressionList() //throws RecognitionException, TokenStreamException
3985 {
3986  List<Statement> statList = null;
3987 
3988  Statement st1 = null;
3989 
3990  st1=statementExpression();
3991  if (0==inputState.guessing)
3992  {
3993  statList = new List<Statement>(); statList.Add(st1);
3994  }
3995  { // ( ... )*
3996  for (;;)
3997  {
3998  if ((LA(1)==COMMA))
3999  {
4000  match(COMMA);
4001  st1=statementExpression();
4002  if (0==inputState.guessing)
4003  {
4004  statList.Add(st1);
4005  }
4006  }
4007  else
4008  {
4009  goto _loop139_breakloop;
4010  }
4011 
4012  }
4013 _loop139_breakloop: ;
4014  } // ( ... )*
4015  return statList;
4016  }
4017 
4018  public Statement breakStatement() //throws RecognitionException, TokenStreamException
4019 {
4020  Statement stat = null;
4021 
4022  IToken b = null;
4023 
4024  b = LT(1);
4025  match(BREAK);
4026  match(SEMI);
4027  if (0==inputState.guessing)
4028  {
4029  stat = new BreakStatement(getLocation(b));
4030  }
4031  return stat;
4032  }
4033 
4034  public Statement continueStatement() //throws RecognitionException, TokenStreamException
4035 {
4036  Statement stat = null;
4037 
4038  IToken c = null;
4039 
4040  c = LT(1);
4041  match(CONTINUE);
4042  match(SEMI);
4043  if (0==inputState.guessing)
4044  {
4045  stat = new ContinueStatement(getLocation(c));
4046  }
4047  return stat;
4048  }
4049 
4050  public Statement returnStatement() //throws RecognitionException, TokenStreamException
4051 {
4052  Statement stat = null;
4053 
4054  IToken r = null;
4055  Expression exp = null;
4056 
4057  r = LT(1);
4058  match(RETURN);
4059  {
4060  switch ( LA(1) )
4061  {
4062  case TRUE:
4063  case FALSE:
4064  case OPEN_PAREN:
4065  case LOG_NOT:
4066  case BASE:
4067  case NEW:
4068  case NULL:
4069  case THIS:
4070  case DOUBLE_LITERAL:
4071  case LITERAL_add:
4072  case LITERAL_remove:
4073  case LITERAL_get:
4074  case LITERAL_set:
4075  case LITERAL_assembly:
4076  case LITERAL_field:
4077  case LITERAL_method:
4078  case LITERAL_module:
4079  case LITERAL_param:
4080  case LITERAL_property:
4081  case LITERAL_type:
4082  case IDENTIFIER:
4083  case INT_LITERAL:
4084  case CHAR_LITERAL:
4085  case STRING_LITERAL:
4086  case PLUS:
4087  case MINUS:
4088  case BIN_NOT:
4089  case INC:
4090  case DEC:
4091  {
4092  exp=expression();
4093  break;
4094  }
4095  case SEMI:
4096  {
4097  break;
4098  }
4099  default:
4100  {
4101  throw new NoViableAltException(LT(1), getFilename());
4102  }
4103  }
4104  }
4105  match(SEMI);
4106  if (0==inputState.guessing)
4107  {
4108  stat = new ReturnStatement(exp, getLocation(r));
4109  }
4110  return stat;
4111  }
4112 
4113  public Statement throwStatement() //throws RecognitionException, TokenStreamException
4114 {
4115  Statement stat = null;
4116 
4117  IToken t = null;
4118  Expression exp = null;
4119 
4120  t = LT(1);
4121  match(THROW);
4122  {
4123  switch ( LA(1) )
4124  {
4125  case TRUE:
4126  case FALSE:
4127  case OPEN_PAREN:
4128  case LOG_NOT:
4129  case BASE:
4130  case NEW:
4131  case NULL:
4132  case THIS:
4133  case DOUBLE_LITERAL:
4134  case LITERAL_add:
4135  case LITERAL_remove:
4136  case LITERAL_get:
4137  case LITERAL_set:
4138  case LITERAL_assembly:
4139  case LITERAL_field:
4140  case LITERAL_method:
4141  case LITERAL_module:
4142  case LITERAL_param:
4143  case LITERAL_property:
4144  case LITERAL_type:
4145  case IDENTIFIER:
4146  case INT_LITERAL:
4147  case CHAR_LITERAL:
4148  case STRING_LITERAL:
4149  case PLUS:
4150  case MINUS:
4151  case BIN_NOT:
4152  case INC:
4153  case DEC:
4154  {
4155  exp=expression();
4156  break;
4157  }
4158  case SEMI:
4159  {
4160  break;
4161  }
4162  default:
4163  {
4164  throw new NoViableAltException(LT(1), getFilename());
4165  }
4166  }
4167  }
4168  match(SEMI);
4169  if (0==inputState.guessing)
4170  {
4171  stat = new ThrowStatement(exp, getLocation(t));
4172  }
4173  return stat;
4174  }
4175 
4176  public CatchStatement catchClause() //throws RecognitionException, TokenStreamException
4177 {
4178  CatchStatement catchStatement = null;
4179 
4180  SingleIdentifierExpression id = null; Block stats = null; IdentifierExpression e = null;
4181 
4182  match(CATCH);
4183  match(OPEN_PAREN);
4184  e=qualifiedIdentifier();
4185  {
4186  switch ( LA(1) )
4187  {
4188  case LITERAL_add:
4189  case LITERAL_remove:
4190  case LITERAL_get:
4191  case LITERAL_set:
4192  case LITERAL_assembly:
4193  case LITERAL_field:
4194  case LITERAL_method:
4195  case LITERAL_module:
4196  case LITERAL_param:
4197  case LITERAL_property:
4198  case LITERAL_type:
4199  case IDENTIFIER:
4200  {
4201  id=identifier();
4202  break;
4203  }
4204  case CLOSE_PAREN:
4205  {
4206  break;
4207  }
4208  default:
4209  {
4210  throw new NoViableAltException(LT(1), getFilename());
4211  }
4212  }
4213  }
4214  match(CLOSE_PAREN);
4215  stats=block();
4216  if (0==inputState.guessing)
4217  {
4218 
4219  catchStatement = new CatchStatement(new IdDeclaration(id, e.Identifier, id.Location), stats, id.Location ) ;
4220 
4221  }
4222  return catchStatement;
4223  }
4224 
4225  public Block finallyClause() //throws RecognitionException, TokenStreamException
4226 {
4227  Block finallyBlock = null;
4228 
4229 
4230  match(FINALLY);
4231  finallyBlock=block();
4232  return finallyBlock;
4233  }
4234 
4235  public SourceFile compilationUnit() //throws RecognitionException, TokenStreamException
4236 {
4237  SourceFile sf = new SourceFile(new Location(fileinfo_.FullName, 0, 0));
4238 
4239 
4240  usingDirectives(sf);
4242  match(Token.EOF_TYPE);
4243  return sf;
4244  }
4245 
4246  public void usingDirectives(
4247  SourceFile sf
4248  ) //throws RecognitionException, TokenStreamException
4249 {
4250 
4251  IdentifierExpression e = null;
4252 
4253  { // ( ... )*
4254  for (;;)
4255  {
4256  if (((LA(1)==USING))&&( !PPDirectiveIsPredictedByLA(1) ))
4257  {
4258  e=usingDirective();
4259  if (0==inputState.guessing)
4260  {
4261  sf.AddUsing(e.Identifier);
4262  }
4263  }
4264  else
4265  {
4266  goto _loop158_breakloop;
4267  }
4268 
4269  }
4270 _loop158_breakloop: ;
4271  } // ( ... )*
4272  }
4273 
4275  SourceFile sf
4276  ) //throws RecognitionException, TokenStreamException
4277 {
4278 
4279 
4280  { // ( ... )*
4281  for (;;)
4282  {
4283  if ((tokenSet_15_.member(LA(1))))
4284  {
4286  }
4287  else
4288  {
4289  goto _loop162_breakloop;
4290  }
4291 
4292  }
4293 _loop162_breakloop: ;
4294  } // ( ... )*
4295  }
4296 
4297  public IdentifierExpression usingDirective() //throws RecognitionException, TokenStreamException
4298 {
4299  IdentifierExpression e = null;
4300 
4301 
4302  match(USING);
4303  e=qualifiedIdentifier();
4304  match(SEMI);
4305  return e;
4306  }
4307 
4309  SourceFile sf
4310  ) //throws RecognitionException, TokenStreamException
4311 {
4312 
4313  Declaration decl = null; List<Modifier> mods = null;
4314 
4315  switch ( LA(1) )
4316  {
4317  case NAMESPACE:
4318  {
4320  break;
4321  }
4322  case ABSTRACT:
4323  case CLASS:
4324  case INTERFACE:
4325  case INTERNAL:
4326  case NEW:
4327  case OVERRIDE:
4328  case PRIVATE:
4329  case PROTECTED:
4330  case PUBLIC:
4331  case STATIC:
4332  case VIRTUAL:
4333  {
4334  mods=modifiers();
4335  decl=typeDeclaration(mods);
4336  if (0==inputState.guessing)
4337  {
4338  sf.AddDeclaration(decl);
4339  }
4340  break;
4341  }
4342  default:
4343  {
4344  throw new NoViableAltException(LT(1), getFilename());
4345  }
4346  }
4347  }
4348 
4350  SourceFile sf
4351  ) //throws RecognitionException, TokenStreamException
4352 {
4353 
4354  IdentifierExpression qid = null; List<Declaration> decls = null;
4355 
4356  match(NAMESPACE);
4357  qid=qualifiedIdentifier();
4358  decls=namespaceBody();
4359  {
4360  switch ( LA(1) )
4361  {
4362  case SEMI:
4363  {
4364  match(SEMI);
4365  break;
4366  }
4367  case EOF:
4368  case ABSTRACT:
4369  case CLASS:
4370  case INTERFACE:
4371  case INTERNAL:
4372  case NAMESPACE:
4373  case NEW:
4374  case OVERRIDE:
4375  case PRIVATE:
4376  case PROTECTED:
4377  case PUBLIC:
4378  case STATIC:
4379  case VIRTUAL:
4380  {
4381  break;
4382  }
4383  default:
4384  {
4385  throw new NoViableAltException(LT(1), getFilename());
4386  }
4387  }
4388  }
4389  if (0==inputState.guessing)
4390  {
4391  sf.AddNamespace(qid, decls);
4392  }
4393  }
4394 
4395  public List<Modifier> modifiers() //throws RecognitionException, TokenStreamException
4396 {
4397  List<Modifier> mods = new List<Modifier>();
4398 
4399  Modifier m;
4400 
4401  { // ( ... )*
4402  for (;;)
4403  {
4404  if ((tokenSet_16_.member(LA(1))))
4405  {
4406  m=modifier();
4407  if (0==inputState.guessing)
4408  {
4409  mods.Add(m);
4410  }
4411  }
4412  else
4413  {
4414  goto _loop172_breakloop;
4415  }
4416 
4417  }
4418 _loop172_breakloop: ;
4419  } // ( ... )*
4420  return mods;
4421  }
4422 
4424  List<Modifier> mods
4425  ) //throws RecognitionException, TokenStreamException
4426 {
4427  Declaration d = null;
4428 
4429 
4430  switch ( LA(1) )
4431  {
4432  case CLASS:
4433  {
4434  d=classDeclaration(mods);
4435  break;
4436  }
4437  case INTERFACE:
4438  {
4439  d=interfaceDeclaration(mods);
4440  break;
4441  }
4442  default:
4443  {
4444  throw new NoViableAltException(LT(1), getFilename());
4445  }
4446  }
4447  return d;
4448  }
4449 
4451  List<Modifier> mods
4452  ) //throws RecognitionException, TokenStreamException
4453 {
4454  Declaration decl = null;
4455 
4456  IToken c = null;
4457  SingleIdentifierExpression id = null; List<string> bases = null; List<Declaration> decls = null;
4458 
4459  c = LT(1);
4460  match(CLASS);
4461  id=identifier();
4462  bases=classBase();
4463  decls=classBody();
4464  {
4465  switch ( LA(1) )
4466  {
4467  case SEMI:
4468  {
4469  match(SEMI);
4470  break;
4471  }
4472  case EOF:
4473  case ABSTRACT:
4474  case CLASS:
4475  case INTERFACE:
4476  case INTERNAL:
4477  case NAMESPACE:
4478  case NEW:
4479  case OVERRIDE:
4480  case PRIVATE:
4481  case PROTECTED:
4482  case PUBLIC:
4483  case STATIC:
4484  case VIRTUAL:
4485  case CLOSE_CURLY:
4486  {
4487  break;
4488  }
4489  default:
4490  {
4491  throw new NoViableAltException(LT(1), getFilename());
4492  }
4493  }
4494  }
4495  if (0==inputState.guessing)
4496  {
4497  decl = new ClassDefinition(id, mods, bases, decls, getLocation(c));
4498  }
4499  return decl;
4500  }
4501 
4503  List<Modifier> mods
4504  ) //throws RecognitionException, TokenStreamException
4505 {
4506  Declaration decl = null;
4507 
4508  IToken i = null;
4509  SingleIdentifierExpression id = null; List<string> bases = null; List<Declaration> decls = null;
4510 
4511  i = LT(1);
4512  match(INTERFACE);
4513  id=identifier();
4514  bases=interfaceBase();
4515  decls=interfaceBody();
4516  {
4517  switch ( LA(1) )
4518  {
4519  case SEMI:
4520  {
4521  match(SEMI);
4522  break;
4523  }
4524  case EOF:
4525  case ABSTRACT:
4526  case CLASS:
4527  case INTERFACE:
4528  case INTERNAL:
4529  case NAMESPACE:
4530  case NEW:
4531  case OVERRIDE:
4532  case PRIVATE:
4533  case PROTECTED:
4534  case PUBLIC:
4535  case STATIC:
4536  case VIRTUAL:
4537  case CLOSE_CURLY:
4538  {
4539  break;
4540  }
4541  default:
4542  {
4543  throw new NoViableAltException(LT(1), getFilename());
4544  }
4545  }
4546  }
4547  if (0==inputState.guessing)
4548  {
4549  decl = new InterfaceDefinition(id, mods, bases, decls, getLocation(i));
4550  }
4551  return decl;
4552  }
4553 
4554  public List<Declaration> namespaceBody() //throws RecognitionException, TokenStreamException
4555 {
4556  List<Declaration> decls = new List<Declaration>();
4557 
4558  Declaration decl = null; List<Modifier> mods = null;
4559 
4560  match(OPEN_CURLY);
4561  { // ( ... )*
4562  for (;;)
4563  {
4564  if ((tokenSet_17_.member(LA(1))))
4565  {
4566  mods=modifiers();
4567  decl=typeDeclaration(mods);
4568  if (0==inputState.guessing)
4569  {
4570  decls.Add(decl);
4571  }
4572  }
4573  else
4574  {
4575  goto _loop169_breakloop;
4576  }
4577 
4578  }
4579 _loop169_breakloop: ;
4580  } // ( ... )*
4581  match(CLOSE_CURLY);
4582  return decls;
4583  }
4584 
4585  public Modifier modifier() //throws RecognitionException, TokenStreamException
4586 {
4587  Modifier mod = 0;;
4588 
4589 
4590  {
4591  switch ( LA(1) )
4592  {
4593  case ABSTRACT:
4594  {
4595  match(ABSTRACT);
4596  if (0==inputState.guessing)
4597  {
4598  mod = Modifier.Abstract;
4599  }
4600  break;
4601  }
4602  case NEW:
4603  {
4604  match(NEW);
4605  if (0==inputState.guessing)
4606  {
4607  mod = Modifier.New;
4608  }
4609  break;
4610  }
4611  case OVERRIDE:
4612  {
4613  match(OVERRIDE);
4614  if (0==inputState.guessing)
4615  {
4616  mod = Modifier.Override;
4617  }
4618  break;
4619  }
4620  case PUBLIC:
4621  {
4622  match(PUBLIC);
4623  if (0==inputState.guessing)
4624  {
4625  mod = Modifier.Public;
4626  }
4627  break;
4628  }
4629  case PROTECTED:
4630  {
4631  match(PROTECTED);
4632  if (0==inputState.guessing)
4633  {
4634  mod = Modifier.Protected;
4635  }
4636  break;
4637  }
4638  case INTERNAL:
4639  {
4640  match(INTERNAL);
4641  if (0==inputState.guessing)
4642  {
4643  mod = Modifier.Internal;
4644  }
4645  break;
4646  }
4647  case PRIVATE:
4648  {
4649  match(PRIVATE);
4650  if (0==inputState.guessing)
4651  {
4652  mod = Modifier.Private;
4653  }
4654  break;
4655  }
4656  case STATIC:
4657  {
4658  match(STATIC);
4659  if (0==inputState.guessing)
4660  {
4661  mod = Modifier.Static;
4662  }
4663  break;
4664  }
4665  case VIRTUAL:
4666  {
4667  match(VIRTUAL);
4668  if (0==inputState.guessing)
4669  {
4670  mod = Modifier.Virtual;
4671  }
4672  break;
4673  }
4674  default:
4675  {
4676  throw new NoViableAltException(LT(1), getFilename());
4677  }
4678  }
4679  }
4680  return mod;
4681  }
4682 
4683  public List<string> classBase() //throws RecognitionException, TokenStreamException
4684 {
4685  List<string> bases = new List<string>();
4686 
4687  string typeExp = "";
4688 
4689  {
4690  switch ( LA(1) )
4691  {
4692  case COLON:
4693  {
4694  match(COLON);
4695  typeExp=type();
4696  if (0==inputState.guessing)
4697  {
4698  bases.Add(typeExp);
4699  }
4700  { // ( ... )*
4701  for (;;)
4702  {
4703  if ((LA(1)==COMMA))
4704  {
4705  match(COMMA);
4706  typeExp=type();
4707  if (0==inputState.guessing)
4708  {
4709  bases.Add(typeExp);
4710  }
4711  }
4712  else
4713  {
4714  goto _loop180_breakloop;
4715  }
4716 
4717  }
4718 _loop180_breakloop: ;
4719  } // ( ... )*
4720  break;
4721  }
4722  case OPEN_CURLY:
4723  {
4724  break;
4725  }
4726  default:
4727  {
4728  throw new NoViableAltException(LT(1), getFilename());
4729  }
4730  }
4731  }
4732  return bases;
4733  }
4734 
4735  public List<Declaration> classBody() //throws RecognitionException, TokenStreamException
4736 {
4737  List<Declaration> decls = new List<Declaration>();
4738 
4739 
4740  match(OPEN_CURLY);
4741  decls=classMemberDeclarations();
4742  match(CLOSE_CURLY);
4743  return decls;
4744  }
4745 
4746  public List<Declaration> classMemberDeclarations() //throws RecognitionException, TokenStreamException
4747 {
4748  List<Declaration> decls = new List<Declaration>();
4749 
4750  Declaration d = null;
4751 
4752  { // ( ... )*
4753  for (;;)
4754  {
4755  if ((tokenSet_18_.member(LA(1))))
4756  {
4758  if (0==inputState.guessing)
4759  {
4760 
4761  if (!(d is FieldDeclarationSet))
4762  {
4763  decls.Add(d);
4764  }
4765  else
4766  {
4767  for (int i = 0; i < ((FieldDeclarationSet)d).Count; i++)
4768  {
4769  decls.Add(((FieldDeclarationSet)d).GetDeclarationElement(i));
4770  }
4771  }
4772 
4773  }
4774  }
4775  else
4776  {
4777  goto _loop184_breakloop;
4778  }
4779 
4780  }
4781 _loop184_breakloop: ;
4782  } // ( ... )*
4783  return decls;
4784  }
4785 
4786  public Declaration classMemberDeclaration() //throws RecognitionException, TokenStreamException
4787 {
4788  Declaration decl = null;
4789 
4790  List<Modifier> mods = null;
4791 
4792  mods=modifiers();
4793  {
4794  decl=typeMemberDeclaration(mods);
4795  }
4796  return decl;
4797  }
4798 
4800  List<Modifier> mods
4801  ) //throws RecognitionException, TokenStreamException
4802 {
4803  Declaration decl = null;
4804 
4805  IToken c = null;
4806  Block stat = null; SingleIdentifierExpression id = null; string typeExp = ""; List<Parameter> pars = null; List<FieldDeclaration> decls = null; Statement []accessors = null; InvocationExpression iexp = null;
4807 
4808  if ((LA(1)==CONST))
4809  {
4810  c = LT(1);
4811  match(CONST);
4812  typeExp=type();
4813  decls=constantDeclarators(typeExp, mods);
4814  match(SEMI);
4815  if (0==inputState.guessing)
4816  {
4817  decl = new FieldDeclarationSet(typeExp, decls, getLocation(c));
4818  }
4819  }
4820  else if ((tokenSet_19_.member(LA(1))) && (LA(2)==OPEN_PAREN)) {
4821  id=identifier();
4822  match(OPEN_PAREN);
4823  {
4824  switch ( LA(1) )
4825  {
4826  case BOOL:
4827  case CHAR:
4828  case DOUBLE:
4829  case INT:
4830  case OBJECT:
4831  case STRING:
4832  case VOID:
4833  case VAR:
4834  case LITERAL_add:
4835  case LITERAL_remove:
4836  case LITERAL_get:
4837  case LITERAL_set:
4838  case LITERAL_assembly:
4839  case LITERAL_field:
4840  case LITERAL_method:
4841  case LITERAL_module:
4842  case LITERAL_param:
4843  case LITERAL_property:
4844  case LITERAL_type:
4845  case IDENTIFIER:
4846  {
4847  pars=formalParameterList();
4848  break;
4849  }
4850  case CLOSE_PAREN:
4851  {
4852  break;
4853  }
4854  default:
4855  {
4856  throw new NoViableAltException(LT(1), getFilename());
4857  }
4858  }
4859  }
4860  match(CLOSE_PAREN);
4861  {
4862  switch ( LA(1) )
4863  {
4864  case COLON:
4865  {
4866  iexp=constructorInitializer();
4867  break;
4868  }
4869  case OPEN_CURLY:
4870  case SEMI:
4871  {
4872  break;
4873  }
4874  default:
4875  {
4876  throw new NoViableAltException(LT(1), getFilename());
4877  }
4878  }
4879  }
4880  stat=constructorBody();
4881  if (0==inputState.guessing)
4882  {
4883  decl = new ConstructorDefinition(id, mods, pars, iexp, stat, id.Location);
4884  }
4885  }
4886  else if (((LA(1)==VOID) && (tokenSet_19_.member(LA(2))))&&( ((LA(1) == VOID) && (LA(2) != STAR)) )) {
4887  typeExp=voidAsType();
4888  id=identifier();
4889  match(OPEN_PAREN);
4890  {
4891  switch ( LA(1) )
4892  {
4893  case BOOL:
4894  case CHAR:
4895  case DOUBLE:
4896  case INT:
4897  case OBJECT:
4898  case STRING:
4899  case VOID:
4900  case VAR:
4901  case LITERAL_add:
4902  case LITERAL_remove:
4903  case LITERAL_get:
4904  case LITERAL_set:
4905  case LITERAL_assembly:
4906  case LITERAL_field:
4907  case LITERAL_method:
4908  case LITERAL_module:
4909  case LITERAL_param:
4910  case LITERAL_property:
4911  case LITERAL_type:
4912  case IDENTIFIER:
4913  {
4914  pars=formalParameterList();
4915  break;
4916  }
4917  case CLOSE_PAREN:
4918  {
4919  break;
4920  }
4921  default:
4922  {
4923  throw new NoViableAltException(LT(1), getFilename());
4924  }
4925  }
4926  }
4927  match(CLOSE_PAREN);
4928  stat=methodBody();
4929  if (0==inputState.guessing)
4930  {
4931  decl = new MethodDefinition(id, stat, typeExp, pars, mods, id.Location);
4932  }
4933  }
4934  else if ((tokenSet_1_.member(LA(1))) && (tokenSet_12_.member(LA(2)))) {
4935  typeExp=type();
4936  {
4937  if (((tokenSet_19_.member(LA(1))) && (LA(2)==COMMA||LA(2)==SEMI||LA(2)==ASSIGN))&&( IdentifierRuleIsPredictedByLA(1) && (LA(2)==ASSIGN || LA(2)==SEMI ||LA(2)==COMMA) ))
4938  {
4939  decl=variableDeclarators(typeExp, mods);
4940  match(SEMI);
4941  }
4942  else if ((tokenSet_19_.member(LA(1))) && (LA(2)==OPEN_PAREN||LA(2)==OPEN_CURLY)) {
4943  id=identifier();
4944  {
4945  switch ( LA(1) )
4946  {
4947  case OPEN_CURLY:
4948  {
4949  match(OPEN_CURLY);
4950  accessors=accessorDeclarations();
4951  match(CLOSE_CURLY);
4952  if (0==inputState.guessing)
4953  {
4954  decl = new PropertyDefinition(id, typeExp, accessors[0], accessors[1], id.Location);
4955  }
4956  break;
4957  }
4958  case OPEN_PAREN:
4959  {
4960  match(OPEN_PAREN);
4961  {
4962  switch ( LA(1) )
4963  {
4964  case BOOL:
4965  case CHAR:
4966  case DOUBLE:
4967  case INT:
4968  case OBJECT:
4969  case STRING:
4970  case VOID:
4971  case VAR:
4972  case LITERAL_add:
4973  case LITERAL_remove:
4974  case LITERAL_get:
4975  case LITERAL_set:
4976  case LITERAL_assembly:
4977  case LITERAL_field:
4978  case LITERAL_method:
4979  case LITERAL_module:
4980  case LITERAL_param:
4981  case LITERAL_property:
4982  case LITERAL_type:
4983  case IDENTIFIER:
4984  {
4985  pars=formalParameterList();
4986  break;
4987  }
4988  case CLOSE_PAREN:
4989  {
4990  break;
4991  }
4992  default:
4993  {
4994  throw new NoViableAltException(LT(1), getFilename());
4995  }
4996  }
4997  }
4998  match(CLOSE_PAREN);
4999  stat=methodBody();
5000  if (0==inputState.guessing)
5001  {
5002  decl = new MethodDefinition(id, stat, typeExp, pars, mods, id.Location);
5003  }
5004  break;
5005  }
5006  default:
5007  {
5008  throw new NoViableAltException(LT(1), getFilename());
5009  }
5010  }
5011  }
5012  }
5013  else
5014  {
5015  throw new NoViableAltException(LT(1), getFilename());
5016  }
5017 
5018  }
5019  }
5020  else
5021  {
5022  throw new NoViableAltException(LT(1), getFilename());
5023  }
5024 
5025  return decl;
5026  }
5027 
5028  public List<Parameter> formalParameterList() //throws RecognitionException, TokenStreamException
5029 {
5030  List<Parameter> pars = null;
5031 
5032 
5033  {
5034  pars=fixedParameters();
5035  }
5036  return pars;
5037  }
5038 
5039  public InvocationExpression constructorInitializer() //throws RecognitionException, TokenStreamException
5040 {
5041  InvocationExpression e = null;
5042 
5043  IToken c = null;
5044  IToken b = null;
5045  IToken t = null;
5046  CompoundExpression ce = null;
5047 
5048  c = LT(1);
5049  match(COLON);
5050  {
5051  switch ( LA(1) )
5052  {
5053  case BASE:
5054  {
5055  b = LT(1);
5056  match(BASE);
5057  match(OPEN_PAREN);
5058  {
5059  switch ( LA(1) )
5060  {
5061  case TRUE:
5062  case FALSE:
5063  case OPEN_PAREN:
5064  case LOG_NOT:
5065  case BASE:
5066  case NEW:
5067  case NULL:
5068  case THIS:
5069  case DOUBLE_LITERAL:
5070  case LITERAL_add:
5071  case LITERAL_remove:
5072  case LITERAL_get:
5073  case LITERAL_set:
5074  case LITERAL_assembly:
5075  case LITERAL_field:
5076  case LITERAL_method:
5077  case LITERAL_module:
5078  case LITERAL_param:
5079  case LITERAL_property:
5080  case LITERAL_type:
5081  case IDENTIFIER:
5082  case INT_LITERAL:
5083  case CHAR_LITERAL:
5084  case STRING_LITERAL:
5085  case PLUS:
5086  case MINUS:
5087  case BIN_NOT:
5088  case INC:
5089  case DEC:
5090  {
5091  ce=argumentList();
5092  break;
5093  }
5094  case CLOSE_PAREN:
5095  {
5096  break;
5097  }
5098  default:
5099  {
5100  throw new NoViableAltException(LT(1), getFilename());
5101  }
5102  }
5103  }
5104  match(CLOSE_PAREN);
5105  if (0==inputState.guessing)
5106  {
5107  e = new InvocationExpression(new BaseExpression(getLocation(b)), ce, getLocation(c));
5108  }
5109  break;
5110  }
5111  case THIS:
5112  {
5113  t = LT(1);
5114  match(THIS);
5115  match(OPEN_PAREN);
5116  {
5117  switch ( LA(1) )
5118  {
5119  case TRUE:
5120  case FALSE:
5121  case OPEN_PAREN:
5122  case LOG_NOT:
5123  case BASE:
5124  case NEW:
5125  case NULL:
5126  case THIS:
5127  case DOUBLE_LITERAL:
5128  case LITERAL_add:
5129  case LITERAL_remove:
5130  case LITERAL_get:
5131  case LITERAL_set:
5132  case LITERAL_assembly:
5133  case LITERAL_field:
5134  case LITERAL_method:
5135  case LITERAL_module:
5136  case LITERAL_param:
5137  case LITERAL_property:
5138  case LITERAL_type:
5139  case IDENTIFIER:
5140  case INT_LITERAL:
5141  case CHAR_LITERAL:
5142  case STRING_LITERAL:
5143  case PLUS:
5144  case MINUS:
5145  case BIN_NOT:
5146  case INC:
5147  case DEC:
5148  {
5149  ce=argumentList();
5150  break;
5151  }
5152  case CLOSE_PAREN:
5153  {
5154  break;
5155  }
5156  default:
5157  {
5158  throw new NoViableAltException(LT(1), getFilename());
5159  }
5160  }
5161  }
5162  match(CLOSE_PAREN);
5163  if (0==inputState.guessing)
5164  {
5165  e = new InvocationExpression(new ThisExpression(getLocation(t)), ce, getLocation(c));
5166  }
5167  break;
5168  }
5169  default:
5170  {
5171  throw new NoViableAltException(LT(1), getFilename());
5172  }
5173  }
5174  }
5175  return e;
5176  }
5177 
5178  public Block constructorBody() //throws RecognitionException, TokenStreamException
5179 {
5180  Block stat = null;
5181 
5182 
5183  stat=body();
5184  return stat;
5185  }
5186 
5187  public string voidAsType() //throws RecognitionException, TokenStreamException
5188 {
5189  string name = "";
5190 
5191 
5192  match(VOID);
5193  if (0==inputState.guessing)
5194  {
5195  name = "void";
5196  }
5197  return name;
5198  }
5199 
5200  public Block methodBody() //throws RecognitionException, TokenStreamException
5201 {
5202  Block stat = null;
5203 
5204 
5205  stat=body();
5206  return stat;
5207  }
5208 
5210  string type, List<Modifier> mods
5211  ) //throws RecognitionException, TokenStreamException
5212 {
5213  Declaration fields = null;
5214 
5215  IToken c = null;
5216  List<FieldDeclaration> decls = new List<FieldDeclaration>(); FieldDeclaration d = null;
5217 
5218  d=variableDeclarator(type, mods);
5219  if (0==inputState.guessing)
5220  {
5221  decls.Add(d);
5222  }
5223  { // ( ... )*
5224  for (;;)
5225  {
5226  if ((LA(1)==COMMA))
5227  {
5228  if (0==inputState.guessing)
5229  {
5230  // Creates a new VariableType.
5231  type = TypeSystem.TypeTable.ObtainNewType(type);
5232 
5233  }
5234  c = LT(1);
5235  match(COMMA);
5236  d=variableDeclarator(type, mods);
5237  if (0==inputState.guessing)
5238  {
5239  decls.Add(d);
5240  }
5241  }
5242  else
5243  {
5244  goto _loop196_breakloop;
5245  }
5246 
5247  }
5248 _loop196_breakloop: ;
5249  } // ( ... )*
5250  if (0==inputState.guessing)
5251  {
5252 
5253  if (c == null)
5254  fields = d;
5255  else
5256  fields = new FieldDeclarationSet(type, decls, getLocation(c));
5257 
5258  }
5259  return fields;
5260  }
5261 
5262  public Statement [] accessorDeclarations() //throws RecognitionException, TokenStreamException
5263 {
5264  Statement []accessors = new Statement[2];
5265 
5266  Statement setStat = null; Statement getStat = null;
5267 
5268  {
5269  switch ( LA(1) )
5270  {
5271  case LITERAL_get:
5272  {
5273  getStat=getAccessorDeclaration();
5274  {
5275  switch ( LA(1) )
5276  {
5277  case LITERAL_set:
5278  {
5279  setStat=setAccessorDeclaration();
5280  break;
5281  }
5282  case CLOSE_CURLY:
5283  {
5284  break;
5285  }
5286  default:
5287  {
5288  throw new NoViableAltException(LT(1), getFilename());
5289  }
5290  }
5291  }
5292  if (0==inputState.guessing)
5293  {
5294  accessors[0] = getStat; accessors[1] = setStat;
5295  }
5296  break;
5297  }
5298  case LITERAL_set:
5299  {
5300  setStat=setAccessorDeclaration();
5301  {
5302  switch ( LA(1) )
5303  {
5304  case LITERAL_get:
5305  {
5306  getStat=getAccessorDeclaration();
5307  break;
5308  }
5309  case CLOSE_CURLY:
5310  {
5311  break;
5312  }
5313  default:
5314  {
5315  throw new NoViableAltException(LT(1), getFilename());
5316  }
5317  }
5318  }
5319  if (0==inputState.guessing)
5320  {
5321  accessors[0] = getStat; accessors[1] = setStat;
5322  }
5323  break;
5324  }
5325  default:
5326  {
5327  throw new NoViableAltException(LT(1), getFilename());
5328  }
5329  }
5330  }
5331  return accessors;
5332  }
5333 
5335  string type, List<Modifier> mods
5336  ) //throws RecognitionException, TokenStreamException
5337 {
5338  FieldDeclaration d = null;
5339 
5340  Expression e = null; SingleIdentifierExpression id = null;
5341 
5342  id=identifier();
5343  {
5344  switch ( LA(1) )
5345  {
5346  case ASSIGN:
5347  {
5348  match(ASSIGN);
5349  e=variableInitializer();
5350  break;
5351  }
5352  case COMMA:
5353  case SEMI:
5354  {
5355  break;
5356  }
5357  default:
5358  {
5359  throw new NoViableAltException(LT(1), getFilename());
5360  }
5361  }
5362  }
5363  if (0==inputState.guessing)
5364  {
5365 
5366  if (e == null)
5367  d = new FieldDeclaration(id, type, mods, id.Location);
5368  else
5369  d = new FieldDefinition(id, e, type, mods, id.Location);
5370 
5371  }
5372  return d;
5373  }
5374 
5375  public Expression variableInitializer() //throws RecognitionException, TokenStreamException
5376 {
5377  Expression exp = null;
5378 
5379 
5380  {
5381  switch ( LA(1) )
5382  {
5383  case TRUE:
5384  case FALSE:
5385  case OPEN_PAREN:
5386  case LOG_NOT:
5387  case BASE:
5388  case NEW:
5389  case NULL:
5390  case THIS:
5391  case DOUBLE_LITERAL:
5392  case LITERAL_add:
5393  case LITERAL_remove:
5394  case LITERAL_get:
5395  case LITERAL_set:
5396  case LITERAL_assembly:
5397  case LITERAL_field:
5398  case LITERAL_method:
5399  case LITERAL_module:
5400  case LITERAL_param:
5401  case LITERAL_property:
5402  case LITERAL_type:
5403  case IDENTIFIER:
5404  case INT_LITERAL:
5405  case CHAR_LITERAL:
5406  case STRING_LITERAL:
5407  case PLUS:
5408  case MINUS:
5409  case BIN_NOT:
5410  case INC:
5411  case DEC:
5412  {
5413  exp=expression();
5414  break;
5415  }
5416  case OPEN_CURLY:
5417  {
5418  exp=arrayInitializer();
5419  break;
5420  }
5421  default:
5422  {
5423  throw new NoViableAltException(LT(1), getFilename());
5424  }
5425  }
5426  }
5427  return exp;
5428  }
5429 
5430  public string returnType() //throws RecognitionException, TokenStreamException
5431 {
5432  string typeExp = ""; ;
5433 
5434 
5435  if (((LA(1)==VOID) && (LA(2)==EOF))&&( ((LA(1) == VOID) && (LA(2) != STAR)) ))
5436  {
5437  typeExp=voidAsType();
5438  }
5439  else if ((tokenSet_1_.member(LA(1))) && (LA(2)==EOF||LA(2)==DOT||LA(2)==OPEN_BRACK)) {
5440  typeExp=type();
5441  }
5442  else
5443  {
5444  throw new NoViableAltException(LT(1), getFilename());
5445  }
5446 
5447  return typeExp;
5448  }
5449 
5450  public List<Parameter> fixedParameters() //throws RecognitionException, TokenStreamException
5451 {
5452  List<Parameter> pars = new List<Parameter>();
5453 
5454  Parameter p;
5455 
5456  p=fixedParameter();
5457  if (0==inputState.guessing)
5458  {
5459  pars.Add(p);
5460  }
5461  { // ( ... )*
5462  for (;;)
5463  {
5464  if ((LA(1)==COMMA))
5465  {
5466  match(COMMA);
5467  p=fixedParameter();
5468  if (0==inputState.guessing)
5469  {
5470  pars.Add(p);
5471  }
5472  }
5473  else
5474  {
5475  goto _loop207_breakloop;
5476  }
5477 
5478  }
5479 _loop207_breakloop: ;
5480  } // ( ... )*
5481  return pars;
5482  }
5483 
5484  public Parameter fixedParameter() //throws RecognitionException, TokenStreamException
5485 {
5486  Parameter param = new Parameter();
5487 
5488  SingleIdentifierExpression id = null; string typeExp = "";
5489 
5490  typeExp=type();
5491  id=identifier();
5492  if (0==inputState.guessing)
5493  {
5494  param.Identifier = id.Identifier; param.ParamType = typeExp; param.Line = id.Location.Line; param.Column = id.Location.Column;
5495  }
5496  return param;
5497  }
5498 
5499  public Statement getAccessorDeclaration() //throws RecognitionException, TokenStreamException
5500 {
5501  Statement stat = null;
5502 
5503 
5504  match(LITERAL_get);
5505  stat=accessorBody();
5506  return stat;
5507  }
5508 
5509  public Statement setAccessorDeclaration() //throws RecognitionException, TokenStreamException
5510 {
5511  Statement stat = null;
5512 
5513 
5514  match(LITERAL_set);
5515  stat=accessorBody();
5516  return stat;
5517  }
5518 
5519  public Statement accessorBody() //throws RecognitionException, TokenStreamException
5520 {
5521  Statement stat = null;
5522 
5523 
5524  stat=body();
5525  return stat;
5526  }
5527 
5528  public string nonArrayType() //throws RecognitionException, TokenStreamException
5529 {
5530  string typeExp = "";;
5531 
5532 
5533  typeExp=type();
5534  return typeExp;
5535  }
5536 
5537  public void rankSpecifier() //throws RecognitionException, TokenStreamException
5538 {
5539 
5540 
5541  match(OPEN_BRACK);
5542  { // ( ... )*
5543  for (;;)
5544  {
5545  if ((LA(1)==COMMA))
5546  {
5547  match(COMMA);
5548  }
5549  else
5550  {
5551  goto _loop227_breakloop;
5552  }
5553 
5554  }
5555 _loop227_breakloop: ;
5556  } // ( ... )*
5557  match(CLOSE_BRACK);
5558  }
5559 
5560  public CompoundExpression variableInitializerList() //throws RecognitionException, TokenStreamException
5561 {
5562  CompoundExpression ce = null;
5563 
5564  Expression e1 = null;
5565 
5566  e1=variableInitializer();
5567  if (0==inputState.guessing)
5568  {
5569  ce = new CompoundExpression(e1.Location); ce.AddExpression(e1);
5570  }
5571  { // ( ... )*
5572  for (;;)
5573  {
5574  if ((LA(1)==COMMA) && (tokenSet_20_.member(LA(2))))
5575  {
5576  match(COMMA);
5577  e1=variableInitializer();
5578  if (0==inputState.guessing)
5579  {
5580  ce.AddExpression(e1);
5581  }
5582  }
5583  else
5584  {
5585  goto _loop233_breakloop;
5586  }
5587 
5588  }
5589 _loop233_breakloop: ;
5590  } // ( ... )*
5591  return ce;
5592  }
5593 
5594  public List<string> interfaceBase() //throws RecognitionException, TokenStreamException
5595 {
5596  List<string> bases = new List<string>();
5597 
5598  string typeExp = "";
5599 
5600  {
5601  switch ( LA(1) )
5602  {
5603  case COLON:
5604  {
5605  match(COLON);
5606  typeExp=type();
5607  if (0==inputState.guessing)
5608  {
5609  bases.Add(typeExp);
5610  }
5611  { // ( ... )*
5612  for (;;)
5613  {
5614  if ((LA(1)==COMMA))
5615  {
5616  match(COMMA);
5617  typeExp=type();
5618  if (0==inputState.guessing)
5619  {
5620  bases.Add(typeExp);
5621  }
5622  }
5623  else
5624  {
5625  goto _loop239_breakloop;
5626  }
5627 
5628  }
5629 _loop239_breakloop: ;
5630  } // ( ... )*
5631  break;
5632  }
5633  case OPEN_CURLY:
5634  {
5635  break;
5636  }
5637  default:
5638  {
5639  throw new NoViableAltException(LT(1), getFilename());
5640  }
5641  }
5642  }
5643  return bases;
5644  }
5645 
5646  public List<Declaration> interfaceBody() //throws RecognitionException, TokenStreamException
5647 {
5648  List<Declaration> decls = new List<Declaration>();
5649 
5650 
5651  match(OPEN_CURLY);
5653  match(CLOSE_CURLY);
5654  return decls;
5655  }
5656 
5657  public List<Declaration> interfaceMemberDeclarations() //throws RecognitionException, TokenStreamException
5658 {
5659  List<Declaration> decls = new List<Declaration>();
5660 
5661  Declaration d = null;
5662 
5663  { // ( ... )*
5664  for (;;)
5665  {
5666  if ((tokenSet_21_.member(LA(1))))
5667  {
5669  if (0==inputState.guessing)
5670  {
5671  decls.Add(d);
5672  }
5673  }
5674  else
5675  {
5676  goto _loop243_breakloop;
5677  }
5678 
5679  }
5680 _loop243_breakloop: ;
5681  } // ( ... )*
5682  return decls;
5683  }
5684 
5685  public Declaration interfaceMemberDeclaration() //throws RecognitionException, TokenStreamException
5686 {
5687  Declaration decl = null;
5688 
5689  SingleIdentifierExpression id = null; string typeExp = ""; List<Parameter> pars = null; List<Modifier> mod = new List<Modifier>(); Statement []accessors = null;
5690 
5691  {
5692  switch ( LA(1) )
5693  {
5694  case NEW:
5695  {
5696  match(NEW);
5697  if (0==inputState.guessing)
5698  {
5699  mod.Add(Modifier.New);
5700  }
5701  break;
5702  }
5703  case BOOL:
5704  case CHAR:
5705  case DOUBLE:
5706  case INT:
5707  case OBJECT:
5708  case STRING:
5709  case VOID:
5710  case VAR:
5711  case LITERAL_add:
5712  case LITERAL_remove:
5713  case LITERAL_get:
5714  case LITERAL_set:
5715  case LITERAL_assembly:
5716  case LITERAL_field:
5717  case LITERAL_method:
5718  case LITERAL_module:
5719  case LITERAL_param:
5720  case LITERAL_property:
5721  case LITERAL_type:
5722  case IDENTIFIER:
5723  {
5724  break;
5725  }
5726  default:
5727  {
5728  throw new NoViableAltException(LT(1), getFilename());
5729  }
5730  }
5731  }
5732  {
5733  if (((LA(1)==VOID) && (tokenSet_19_.member(LA(2))))&&( ((LA(1) == VOID) && (LA(2) != STAR)) ))
5734  {
5735  typeExp=voidAsType();
5736  id=identifier();
5737  match(OPEN_PAREN);
5738  {
5739  switch ( LA(1) )
5740  {
5741  case BOOL:
5742  case CHAR:
5743  case DOUBLE:
5744  case INT:
5745  case OBJECT:
5746  case STRING:
5747  case VOID:
5748  case VAR:
5749  case LITERAL_add:
5750  case LITERAL_remove:
5751  case LITERAL_get:
5752  case LITERAL_set:
5753  case LITERAL_assembly:
5754  case LITERAL_field:
5755  case LITERAL_method:
5756  case LITERAL_module:
5757  case LITERAL_param:
5758  case LITERAL_property:
5759  case LITERAL_type:
5760  case IDENTIFIER:
5761  {
5762  pars=formalParameterList();
5763  break;
5764  }
5765  case CLOSE_PAREN:
5766  {
5767  break;
5768  }
5769  default:
5770  {
5771  throw new NoViableAltException(LT(1), getFilename());
5772  }
5773  }
5774  }
5775  match(CLOSE_PAREN);
5776  match(SEMI);
5777  if (0==inputState.guessing)
5778  {
5779  decl = new MethodDeclaration(id, typeExp, pars, mod, id.Location);
5780  }
5781  }
5782  else if ((tokenSet_1_.member(LA(1))) && (tokenSet_12_.member(LA(2)))) {
5783  typeExp=type();
5784  {
5785  id=identifier();
5786  {
5787  switch ( LA(1) )
5788  {
5789  case OPEN_PAREN:
5790  {
5791  match(OPEN_PAREN);
5792  {
5793  switch ( LA(1) )
5794  {
5795  case BOOL:
5796  case CHAR:
5797  case DOUBLE:
5798  case INT:
5799  case OBJECT:
5800  case STRING:
5801  case VOID:
5802  case VAR:
5803  case LITERAL_add:
5804  case LITERAL_remove:
5805  case LITERAL_get:
5806  case LITERAL_set:
5807  case LITERAL_assembly:
5808  case LITERAL_field:
5809  case LITERAL_method:
5810  case LITERAL_module:
5811  case LITERAL_param:
5812  case LITERAL_property:
5813  case LITERAL_type:
5814  case IDENTIFIER:
5815  {
5816  pars=formalParameterList();
5817  break;
5818  }
5819  case CLOSE_PAREN:
5820  {
5821  break;
5822  }
5823  default:
5824  {
5825  throw new NoViableAltException(LT(1), getFilename());
5826  }
5827  }
5828  }
5829  match(CLOSE_PAREN);
5830  match(SEMI);
5831  if (0==inputState.guessing)
5832  {
5833  decl = new MethodDeclaration(id, typeExp, pars, mod, id.Location);
5834  }
5835  break;
5836  }
5837  case OPEN_CURLY:
5838  {
5839  match(OPEN_CURLY);
5840  accessors=interfaceAccessors();
5841  match(CLOSE_CURLY);
5842  if (0==inputState.guessing)
5843  {
5844  decl = new PropertyDefinition(id, typeExp, accessors[0], accessors[1], id.Location);
5845  }
5846  break;
5847  }
5848  default:
5849  {
5850  throw new NoViableAltException(LT(1), getFilename());
5851  }
5852  }
5853  }
5854  }
5855  }
5856  else
5857  {
5858  throw new NoViableAltException(LT(1), getFilename());
5859  }
5860 
5861  }
5862  return decl;
5863  }
5864 
5865  public Statement [] interfaceAccessors() //throws RecognitionException, TokenStreamException
5866 {
5867  Statement []accessors = new Statement[2];
5868 
5869  Statement setStat = null; Statement getStat = null;
5870 
5871  {
5872  switch ( LA(1) )
5873  {
5874  case LITERAL_get:
5875  {
5876  getStat=getAccessorDeclaration();
5877  {
5878  switch ( LA(1) )
5879  {
5880  case LITERAL_set:
5881  {
5882  setStat=setAccessorDeclaration();
5883  break;
5884  }
5885  case CLOSE_CURLY:
5886  {
5887  break;
5888  }
5889  default:
5890  {
5891  throw new NoViableAltException(LT(1), getFilename());
5892  }
5893  }
5894  }
5895  if (0==inputState.guessing)
5896  {
5897  accessors[0] = getStat; accessors[1] = setStat;
5898  }
5899  break;
5900  }
5901  case LITERAL_set:
5902  {
5903  setStat=setAccessorDeclaration();
5904  {
5905  switch ( LA(1) )
5906  {
5907  case LITERAL_get:
5908  {
5909  getStat=getAccessorDeclaration();
5910  break;
5911  }
5912  case CLOSE_CURLY:
5913  {
5914  break;
5915  }
5916  default:
5917  {
5918  throw new NoViableAltException(LT(1), getFilename());
5919  }
5920  }
5921  }
5922  if (0==inputState.guessing)
5923  {
5924  accessors[0] = getStat; accessors[1] = setStat;
5925  }
5926  break;
5927  }
5928  default:
5929  {
5930  throw new NoViableAltException(LT(1), getFilename());
5931  }
5932  }
5933  }
5934  return accessors;
5935  }
5936 
5937  private void initializeFactory()
5938  {
5939  }
5940 
5941  public static readonly string[] tokenNames_ = new string[] {
5942  @"""<0>""",
5943  @"""EOF""",
5944  @"""<2>""",
5945  @"""NULL_TREE_LOOKAHEAD""",
5946  @"""UNICODE_CLASS_Nl""",
5947  @"""UNICODE_CLASS_Lt""",
5948  @"""UNICODE_CLASS_Zs""",
5949  @"""UNICODE_CLASS_Ll""",
5950  @"""UNICODE_CLASS_Lu""",
5951  @"""UNICODE_CLASS_Lo""",
5952  @"""UNICODE_CLASS_Lm""",
5953  @"""UNICODE_CLASS_Mn""",
5954  @"""UNICODE_CLASS_Mc""",
5955  @"""UNICODE_CLASS_Nd""",
5956  @"""UNICODE_CLASS_Pc""",
5957  @"""UNICODE_CLASS_Cf""",
5958  @"""true""",
5959  @"""false""",
5960  @"""default""",
5961  @"""PP_DEFINE""",
5962  @"""PP_UNDEFINE""",
5963  @"""PP_COND_IF""",
5964  @"""PP_COND_ELIF""",
5965  @"""PP_COND_ELSE""",
5966  @"""PP_COND_ENDIF""",
5967  @"""PP_LINE""",
5968  @"""PP_ERROR""",
5969  @"""PP_WARNING""",
5970  @"""PP_REGION""",
5971  @"""PP_ENDREGION""",
5972  @"""PP_FILENAME""",
5973  @"""PP_IDENT""",
5974  @"""PP_STRING""",
5975  @"""PP_NUMBER""",
5976  @"""WHITESPACE""",
5977  @"""QUOTE""",
5978  @"""OPEN_PAREN""",
5979  @"""CLOSE_PAREN""",
5980  @"""LOG_NOT""",
5981  @"""LOG_AND""",
5982  @"""LOG_OR""",
5983  @"""EQUAL""",
5984  @"""NOT_EQUAL""",
5985  @"""SL_COMMENT""",
5986  @"""NEWLINE""",
5987  @"""NOT_NEWLINE""",
5988  @"""NON_NEWLINE_WHITESPACE""",
5989  @"""UNICODE_ESCAPE_SEQUENCE""",
5990  @"""DECIMAL_DIGIT""",
5991  @"""HEX_DIGIT""",
5992  @"""LETTER_CHARACTER""",
5993  @"""DECIMAL_DIGIT_CHARACTER""",
5994  @"""CONNECTING_CHARACTER""",
5995  @"""COMBINING_CHARACTER""",
5996  @"""FORMATTING_CHARACTER""",
5997  @"""abstract""",
5998  @"""as""",
5999  @"""base""",
6000  @"""bool""",
6001  @"""break""",
6002  @"""byte""",
6003  @"""case""",
6004  @"""catch""",
6005  @"""char""",
6006  @"""checked""",
6007  @"""class""",
6008  @"""const""",
6009  @"""continue""",
6010  @"""decimal""",
6011  @"""delegate""",
6012  @"""do""",
6013  @"""double""",
6014  @"""else""",
6015  @"""enum""",
6016  @"""event""",
6017  @"""explicit""",
6018  @"""extern""",
6019  @"""finally""",
6020  @"""fixed""",
6021  @"""float""",
6022  @"""for""",
6023  @"""foreach""",
6024  @"""goto""",
6025  @"""if""",
6026  @"""implicit""",
6027  @"""in""",
6028  @"""int""",
6029  @"""interface""",
6030  @"""internal""",
6031  @"""is""",
6032  @"""lock""",
6033  @"""long""",
6034  @"""namespace""",
6035  @"""new""",
6036  @"""null""",
6037  @"""object""",
6038  @"""operator""",
6039  @"""out""",
6040  @"""override""",
6041  @"""params""",
6042  @"""private""",
6043  @"""protected""",
6044  @"""public""",
6045  @"""readonly""",
6046  @"""ref""",
6047  @"""return""",
6048  @"""sbyte""",
6049  @"""sealed""",
6050  @"""short""",
6051  @"""sizeof""",
6052  @"""stackalloc""",
6053  @"""static""",
6054  @"""string""",
6055  @"""struct""",
6056  @"""switch""",
6057  @"""this""",
6058  @"""throw""",
6059  @"""try""",
6060  @"""typeof""",
6061  @"""uint""",
6062  @"""ulong""",
6063  @"""unchecked""",
6064  @"""unsafe""",
6065  @"""ushort""",
6066  @"""using""",
6067  @"""virtual""",
6068  @"""void""",
6069  @"""volatile""",
6070  @"""while""",
6071  @"""var""",
6072  @"""DOT""",
6073  @"""UINT_LITERAL""",
6074  @"""LONG_LITERAL""",
6075  @"""ULONG_LITERAL""",
6076  @"""DECIMAL_LITERAL""",
6077  @"""FLOAT_LITERAL""",
6078  @"""DOUBLE_LITERAL""",
6079  @"""add""",
6080  @"""remove""",
6081  @"""get""",
6082  @"""set""",
6083  @"""assembly""",
6084  @"""field""",
6085  @"""method""",
6086  @"""module""",
6087  @"""param""",
6088  @"""property""",
6089  @"""type""",
6090  @"""ML_COMMENT""",
6091  @"""IDENTIFIER""",
6092  @"""INT_LITERAL""",
6093  @"""CHAR_LITERAL""",
6094  @"""STRING_LITERAL""",
6095  @"""ESCAPED_LITERAL""",
6096  @"""OPEN_CURLY""",
6097  @"""CLOSE_CURLY""",
6098  @"""OPEN_BRACK""",
6099  @"""CLOSE_BRACK""",
6100  @"""COMMA""",
6101  @"""COLON""",
6102  @"""SEMI""",
6103  @"""PLUS""",
6104  @"""MINUS""",
6105  @"""STAR""",
6106  @"""DIV""",
6107  @"""MOD""",
6108  @"""BIN_AND""",
6109  @"""BIN_OR""",
6110  @"""BIN_XOR""",
6111  @"""BIN_NOT""",
6112  @"""ASSIGN""",
6113  @"""LTHAN""",
6114  @"""GTHAN""",
6115  @"""QUESTION""",
6116  @"""INC""",
6117  @"""DEC""",
6118  @"""SHIFTL""",
6119  @"""SHIFTR""",
6120  @"""LTE""",
6121  @"""GTE""",
6122  @"""PLUS_ASSIGN""",
6123  @"""MINUS_ASSIGN""",
6124  @"""STAR_ASSIGN""",
6125  @"""DIV_ASSIGN""",
6126  @"""MOD_ASSIGN""",
6127  @"""BIN_AND_ASSIGN""",
6128  @"""BIN_OR_ASSIGN""",
6129  @"""BIN_XOR_ASSIGN""",
6130  @"""SHIFTL_ASSIGN""",
6131  @"""SHIFTR_ASSIGN""",
6132  @"""DEREF""",
6133  @"""PP_DIRECTIVE""",
6134  @"""COMPILATION_UNIT""",
6135  @"""USING_DIRECTIVES""",
6136  @"""USING_ALIAS_DIRECTIVE""",
6137  @"""USING_NAMESPACE_DIRECTIVE""",
6138  @"""GLOBAL_ATTRIBUTE_SECTIONS""",
6139  @"""GLOBAL_ATTRIBUTE_SECTION""",
6140  @"""ATTRIBUTE_SECTIONS""",
6141  @"""ATTRIBUTE_SECTION""",
6142  @"""ATTRIBUTE""",
6143  @"""QUALIFIED_IDENTIFIER""",
6144  @"""POSITIONAL_ARGLIST""",
6145  @"""POSITIONAL_ARG""",
6146  @"""NAMED_ARGLIST""",
6147  @"""NAMED_ARG""",
6148  @"""ARG_LIST""",
6149  @"""FORMAL_PARAMETER_LIST""",
6150  @"""PARAMETER_FIXED""",
6151  @"""PARAMETER_ARRAY""",
6152  @"""ATTRIB_ARGUMENT_EXPR""",
6153  @"""UNARY_MINUS""",
6154  @"""UNARY_PLUS""",
6155  @"""CLASS_BASE""",
6156  @"""STRUCT_BASE""",
6157  @"""INTERFACE_BASE""",
6158  @"""ENUM_BASE""",
6159  @"""TYPE_BODY""",
6160  @"""MEMBER_LIST""",
6161  @"""CONST_DECLARATOR""",
6162  @"""CTOR_DECL""",
6163  @"""STATIC_CTOR_DECL""",
6164  @"""DTOR_DECL""",
6165  @"""FIELD_DECL""",
6166  @"""METHOD_DECL""",
6167  @"""PROPERTY_DECL""",
6168  @"""INDEXER_DECL""",
6169  @"""UNARY_OP_DECL""",
6170  @"""BINARY_OP_DECL""",
6171  @"""CONV_OP_DECL""",
6172  @"""TYPE""",
6173  @"""STARS""",
6174  @"""ARRAY_RANK""",
6175  @"""ARRAY_RANKS""",
6176  @"""ARRAY_INIT""",
6177  @"""VAR_INIT""",
6178  @"""VAR_INIT_LIST""",
6179  @"""VAR_DECLARATOR""",
6180  @"""LOCVAR_INIT""",
6181  @"""LOCVAR_INIT_LIST""",
6182  @"""LOCVAR_DECLS""",
6183  @"""LOCAL_CONST""",
6184  @"""EXPR""",
6185  @"""EXPR_LIST""",
6186  @"""MEMBER_ACCESS_EXPR""",
6187  @"""ELEMENT_ACCESS_EXPR""",
6188  @"""INVOCATION_EXPR""",
6189  @"""POST_INC_EXPR""",
6190  @"""POST_DEC_EXPR""",
6191  @"""PAREN_EXPR""",
6192  @"""OBJ_CREATE_EXPR""",
6193  @"""DLG_CREATE_EXPR""",
6194  @"""ARRAY_CREATE_EXPR""",
6195  @"""CAST_EXPR""",
6196  @"""PTR_ELEMENT_ACCESS_EXPR""",
6197  @"""PTR_INDIRECTION_EXPR""",
6198  @"""PTR_DECLARATOR""",
6199  @"""PTR_INIT""",
6200  @"""ADDRESS_OF_EXPR""",
6201  @"""MODIFIERS""",
6202  @"""NAMESPACE_BODY""",
6203  @"""BLOCK""",
6204  @"""STMT_LIST""",
6205  @"""EMPTY_STMT""",
6206  @"""LABEL_STMT""",
6207  @"""EXPR_STMT""",
6208  @"""FOR_INIT""",
6209  @"""FOR_COND""",
6210  @"""FOR_ITER""",
6211  @"""SWITCH_SECTION""",
6212  @"""SWITCH_LABELS""",
6213  @"""SWITCH_LABEL""",
6214  @"""PP_DIRECTIVES""",
6215  @"""PP_EXPR""",
6216  @"""PP_MESSAGE""",
6217  @"""PP_BLOCK"""
6218  };
6219 
6220  private static long[] mk_tokenSet_0_()
6221  {
6222  long[] data = { 0L, 0L, 3404087999594496L, 0L, 0L, 0L};
6223  return data;
6224  }
6225  public static readonly BitSet tokenSet_0_ = new BitSet(mk_tokenSet_0_());
6226  private static long[] mk_tokenSet_1_()
6227  {
6228  long[] data = { -8935141660703064064L, 4611967495555776640L, 3145218L, 0L, 0L, 0L};
6229  return data;
6230  }
6231  public static readonly BitSet tokenSet_1_ = new BitSet(mk_tokenSet_1_());
6232  private static long[] mk_tokenSet_2_()
6233  {
6234  long[] data = { 144115256795529216L, 2251801424297984L, 32505600L, 0L, 0L, 0L};
6235  return data;
6236  }
6237  public static readonly BitSet tokenSet_2_ = new BitSet(mk_tokenSet_2_());
6238  private static long[] mk_tokenSet_3_()
6239  {
6240  long[] data = { -8791017745253466112L, 4614219297013629056L, 4611686018325675782L, 0L, 0L, 0L};
6241  return data;
6242  }
6243  public static readonly BitSet tokenSet_3_ = new BitSet(mk_tokenSet_3_());
6244  private static long[] mk_tokenSet_4_()
6245  {
6246  long[] data = { 68719476736L, 0L, 211106500968452L, 0L, 0L, 0L};
6247  return data;
6248  }
6249  public static readonly BitSet tokenSet_4_ = new BitSet(mk_tokenSet_4_());
6250  private static long[] mk_tokenSet_5_()
6251  {
6252  long[] data = { -8935141660703064064L, 4611967495555776644L, 3145218L, 0L, 0L, 0L};
6253  return data;
6254  }
6255  public static readonly BitSet tokenSet_5_ = new BitSet(mk_tokenSet_5_());
6256  private static long[] mk_tokenSet_6_()
6257  {
6258  long[] data = { -8935141660703064064L, 4611967495555776640L, 271580678L, 0L, 0L, 0L};
6259  return data;
6260  }
6261  public static readonly BitSet tokenSet_6_ = new BitSet(mk_tokenSet_6_());
6262  private static long[] mk_tokenSet_7_()
6263  {
6264  long[] data = { 720576283976859648L, 16890699237228616L, 213335420174081L, 0L, 0L, 0L};
6265  return data;
6266  }
6267  public static readonly BitSet tokenSet_7_ = new BitSet(mk_tokenSet_7_());
6268  private static long[] mk_tokenSet_8_()
6269  {
6270  long[] data = { -5908714121175040000L, 4628858194826559692L, 4611686014634688263L, 0L, 0L, 0L};
6271  return data;
6272  }
6273  public static readonly BitSet tokenSet_8_ = new BitSet(mk_tokenSet_8_());
6274  private static long[] mk_tokenSet_9_()
6275  {
6276  long[] data = { -8214565376726204416L, 4628858194793005260L, 213335420174083L, 0L, 0L, 0L};
6277  return data;
6278  }
6279  public static readonly BitSet tokenSet_9_ = new BitSet(mk_tokenSet_9_());
6280  private static long[] mk_tokenSet_10_()
6281  {
6282  long[] data = { -5908722367512248320L, 4628858194793005516L, 213335554391811L, 0L, 0L, 0L};
6283  return data;
6284  }
6285  public static readonly BitSet tokenSet_10_ = new BitSet(mk_tokenSet_10_());
6286  private static long[] mk_tokenSet_11_()
6287  {
6288  long[] data = { -1260999305728688128L, 6934842439761600972L, 4611686016782171911L, 0L, 0L, 0L};
6289  return data;
6290  }
6291  public static readonly BitSet tokenSet_11_ = new BitSet(mk_tokenSet_11_());
6292  private static long[] mk_tokenSet_12_()
6293  {
6294  long[] data = { 0L, 0L, 271580676L, 0L, 0L, 0L};
6295  return data;
6296  }
6297  public static readonly BitSet tokenSet_12_ = new BitSet(mk_tokenSet_12_());
6298  private static long[] mk_tokenSet_13_()
6299  {
6300  long[] data = { 144115531673436160L, 2251801424297984L, 213331058097920L, 0L, 0L, 0L};
6301  return data;
6302  }
6303  public static readonly BitSet tokenSet_13_ = new BitSet(mk_tokenSet_13_());
6304  private static long[] mk_tokenSet_14_()
6305  {
6306  long[] data = { -8791017882692419584L, 4614219297013629056L, 4611686015507103494L, 0L, 0L, 0L};
6307  return data;
6308  }
6309  public static readonly BitSet tokenSet_14_ = new BitSet(mk_tokenSet_14_());
6310  private static long[] mk_tokenSet_15_()
6311  {
6312  long[] data = { 36028797018963968L, 2305984245748727810L, 0L, 0L, 0L};
6313  return data;
6314  }
6315  public static readonly BitSet tokenSet_15_ = new BitSet(mk_tokenSet_15_());
6316  private static long[] mk_tokenSet_16_()
6317  {
6318  long[] data = { 36028797018963968L, 2305984245471903744L, 0L, 0L, 0L};
6319  return data;
6320  }
6321  public static readonly BitSet tokenSet_16_ = new BitSet(mk_tokenSet_16_());
6322  private static long[] mk_tokenSet_17_()
6323  {
6324  long[] data = { 36028797018963968L, 2305984245480292354L, 0L, 0L, 0L};
6325  return data;
6326  }
6327  public static readonly BitSet tokenSet_17_ = new BitSet(mk_tokenSet_17_());
6328  private static long[] mk_tokenSet_18_()
6329  {
6330  long[] data = { -8899112863684100096L, 6917951741027680388L, 3145218L, 0L, 0L, 0L};
6331  return data;
6332  }
6333  public static readonly BitSet tokenSet_18_ = new BitSet(mk_tokenSet_18_());
6334  private static long[] mk_tokenSet_19_()
6335  {
6336  long[] data = { 0L, 0L, 3145216L, 0L, 0L, 0L};
6337  return data;
6338  }
6339  public static readonly BitSet tokenSet_19_ = new BitSet(mk_tokenSet_19_());
6340  private static long[] mk_tokenSet_20_()
6341  {
6342  long[] data = { 144115531673436160L, 2251801424297984L, 213331125206784L, 0L, 0L, 0L};
6343  return data;
6344  }
6345  public static readonly BitSet tokenSet_20_ = new BitSet(mk_tokenSet_20_());
6346  private static long[] mk_tokenSet_21_()
6347  {
6348  long[] data = { -8935141660703064064L, 4611967496092647552L, 3145218L, 0L, 0L, 0L};
6349  return data;
6350  }
6351  public static readonly BitSet tokenSet_21_ = new BitSet(mk_tokenSet_21_());
6352 
6353 }
6354 }
Encapsulates a Return statement of our programming languages.
Encapsulates a &#39;base&#39; expression.
Encapsulates a definition of a concrete method.
List< Statement > statementList()
static readonly BitSet tokenSet_11_
Declaration typeDeclaration(List< Modifier > mods)
const int POSITIONAL_ARGLIST
Expression conditionalOrExpression()
Encapsulates a Break statement of our programming languages.
CodeMaskEnums
Bit masks for specifying valid CSharp syntax constructs in Parser productions.
Expression relationalExpression()
const int ELEMENT_ACCESS_EXPR
List< SwitchSection > switchBlock()
List< Declaration > namespaceBody()
Statement jumpStatement()
antlr.collections.impl.BitSet BitSet
Definition: CSharpLexer.cs:36
const int BIN_XOR_ASSIGN
static readonly BitSet tokenSet_9_
Statement embeddedStatement()
Abstract class encapsulate a programming language expression.
Definition: Expression.cs:37
Encapsulates a name expression of our programming language.
List< Statement > localConstantDeclarators(string type)
Encapsulates the qualified name expression.
CSharpParser(TokenStream lexer)
CompoundExpression argumentList()
Encapsulates a Case statement of our programming languages.
List< Parameter > formalParameterList()
const int PP_COND_ELSE
Encapsulates a Do statement of our programming language.
Definition: DoStatement.cs:34
const int UNICODE_CLASS_Zs
Encapsulates a string literal expression.
Encapsulates the expression to access a field.
Statement selectionStatement()
const int PP_COND_ELIF
const int FORMATTING_CHARACTER
Encapsulates a block of statements.
Definition: Block.cs:34
Expression conditionalExpression()
antlr.LLkParser LLkParser
Definition: CSharpParser.cs:91
Expression shiftExpression()
SingleIdentifierExpression nonKeywordLiterals()
static readonly BitSet tokenSet_2_
const int STATIC_CTOR_DECL
List< Statement > localConstantDeclaration()
static readonly BitSet tokenSet_6_
const int DOUBLE_LITERAL
Declaration typeMemberDeclaration(List< Modifier > mods)
SingleIdentifierExpression identifier()
const int NAMESPACE_BODY
static readonly BitSet tokenSet_8_
Statement continueStatement()
static readonly BitSet tokenSet_5_
System.IO.FileInfo FileInfo
const int LOCVAR_DECLS
const int CHAR_LITERAL
const int MINUS_ASSIGN
static readonly BitSet tokenSet_18_
Encapsulates a Catch statement of our programming languages.
Encapsulates a logical binary expression.
static readonly BitSet tokenSet_3_
Encapsulates a invocation expression.
Encapsulates a boolean literal expression.
Encapsulates a cast expression.
Encapsulates a definition of a concrete field.
const int PP_COND_ENDIF
This class encapsulates a location in a specific file. Implements an Inmutable pattern. So it can be used in any context, that is his internal fields never change.
Definition: Location.cs:24
Abstract class represents a programming language statement.
Definition: Statement.cs:30
InvocationExpression constructorInitializer()
CSharpParser(TokenBuffer tokenBuf)
void usingDirectives(SourceFile sf)
const int CONST_DECLARATOR
SwitchStatement switchStatement()
Statement breakStatement()
const int SWITCH_LABEL
ConstantDefinition localConstantDeclarator(string type)
const int UINT_LITERAL
const int BIN_OR_ASSIGN
antlr.NoViableAltException NoViableAltException
Definition: CSharpParser.cs:96
SwitchSection switchSection()
const int UNICODE_CLASS_Lt
Location Location
Definition: AstNode.cs:45
IdentifierExpression usingDirective()
const int ARRAY_CREATE_EXPR
Expression localVariableInitializer()
Statement foreachStatement()
static readonly BitSet tokenSet_16_
Encapsulates a constant field definition.
Expression newExpression()
const int PARAMETER_FIXED
Statement forStatement()
Encapsulates a definition.
Definition: Definition.cs:36
Statement elseStatement()
Statement returnStatement()
const int NULL_TREE_LOOKAHEAD
DeclarationSet declarationStatement()
Encapsulates arithmetic binary expressions.
CSharpParser(ParserSharedInputState state)
void namespaceMemberDeclarations(SourceFile sf)
const int DECIMAL_DIGIT_CHARACTER
List< Declaration > interfaceMemberDeclarations()
Encapsulates a For statement of our programming languages.
Definition: ForStatement.cs:34
Declaration classMemberDeclaration()
const int LITERAL_module
Encapsulates a While statement of our programming languages.
Expression unaryExpression()
System.Text.StringBuilder StringBuilder
Definition: CSharpParser.cs:4
const int UNICODE_CLASS_Mn
List< SwitchSection > switchSections()
antlr.SemanticException SemanticException
Definition: CSharpLexer.cs:30
Encapsulates a null expression.
RelationalOperator
Relational binary operators
Encapsulates a Is expression.
Definition: IsExpression.cs:35
Expression booleanExpression()
System.IO.FileInfo FileInfo
Definition: CSharpParser.cs:5
const int BINARY_OP_DECL
Encapsulates a definition of a concrete interface.
const int COMBINING_CHARACTER
const int NON_NEWLINE_WHITESPACE
antlr.TokenStream TokenStream
Definition: CSharpLexer.cs:34
Encapsulates a switch label (Case + condition or Default section).
Definition: SwitchLabel.cs:47
List< Statement > forIterator()
static readonly BitSet tokenSet_21_
Encapsulates a identifier expression of our programming language.
Encapsulates a statement with several declarations.
Parameter fixedParameter()
CSharpParser(TokenBuffer tokenBuf, int k)
Encapsulates a declaration of a concrete method.
LogicalOperator
Logical binary operators
Declaration interfaceDeclaration(List< Modifier > mods)
int ExpressionCount
Gets the number of expressions.
const int UNICODE_CLASS_Nl
const int NAMED_ARGLIST
ArgumentExpression argument()
const int ULONG_LITERAL
Expression assignmentExpression()
Encapsulates a set of expressions.
override void match(int token)
Overrides the behavior of match. Discards tokens when the parser is in panic mode ...
const int SWITCH_SECTION
ConstantFieldDefinition constantDeclarator(string type, List< Modifier > mods)
const int USING_DIRECTIVES
Expression forCondition()
const int PP_DIRECTIVES
CompoundExpression expressionList()
Expression CloneInit()
Clones the initialization of the current object.
Definition: Expression.cs:130
Statement getAccessorDeclaration()
CatchStatement catchClause()
Encapsulates a relational binary expression.
Encapsulates a bitwise binary expression.
Declaration localVariableDeclarator(string type)
ArithmeticOperator
Arithmetic binary operators
antlr.Token Token
Definition: CSharpLexer.cs:27
const int USING_NAMESPACE_DIRECTIVE
static readonly BitSet tokenSet_20_
Expression constantExpression()
void namespaceDeclaration(SourceFile sf)
Encapsulates assignment binary expressions.
List< Declaration > classMemberDeclarations()
Statement ifStatement()
Represents the error occurred while the source code is parsing.
Definition: ParserError.cs:23
const int LITERAL_field
const int ESCAPED_LITERAL
static readonly BitSet tokenSet_12_
static readonly BitSet tokenSet_7_
Encapsulates a ternary expression of our programming language.
antlr.RecognitionException RecognitionException
Definition: CSharpLexer.cs:31
const int POST_DEC_EXPR
const int LITERAL_type
const int COMPILATION_UNIT
Encapsulates a If-Else statement of our programming language.
const int PROPERTY_DECL
Statement throwStatement()
antlr.ParserSharedInputState ParserSharedInputState
Definition: CSharpParser.cs:99
List< Statement > statementExpressionList()
List< Statement > forInitializer()
Encapsulates a new array expression.
Encapsulates a definition of a concrete constructor.
List< string > classBase()
Statement tryStatement()
const int CONV_OP_DECL
Expression basicPrimaryExpression()
const int DECIMAL_LITERAL
antlr.TokenBuffer TokenBuffer
Definition: CSharpParser.cs:87
const int BIN_AND_ASSIGN
Encapsulates a parameter declaration.
Definition: Parameter.cs:26
Encapsulates the source code.
Definition: SourceFile.cs:35
const int PTR_ELEMENT_ACCESS_EXPR
const int PTR_INDIRECTION_EXPR
const int UNICODE_CLASS_Nd
CompoundExpression variableInitializerList()
const int SWITCH_LABELS
List< Statement > localVariableDeclarators(string type)
Expression variableInitializer()
override void setFilename(string filename)
Encapsulates a Try-Catch-finally statement of our programming languages. As C# states catch blcok and...
Declaration variableDeclarators(string type, List< Modifier > mods)
const int UNARY_OP_DECL
const int UNICODE_CLASS_Mc
List< SwitchLabel > switchLabels()
Expression exclusiveOrExpression()
const int ATTRIBUTE_SECTIONS
const int DLG_CREATE_EXPR
const int OBJ_CREATE_EXPR
Encapsulates a string literal expression.
Statement whileStatement()
Expression literal()
static readonly BitSet tokenSet_15_
Encapsulates a declaration of a concrete type.
Definition: Declaration.cs:34
List< Declaration > interfaceBody()
antlr.MismatchedTokenException MismatchedTokenException
Definition: CSharpParser.cs:97
const int LETTER_CHARACTER
Encapsulates a declaration.
Encapsulates a argument expression of our programming language.
const int UNICODE_CLASS_Lu
const int FLOAT_LITERAL
static readonly BitSet tokenSet_1_
Encapsulates a &#39;this&#39; expression.
const int POSITIONAL_ARG
Statement iterationStatement()
Encapsulates a unary expression of our programming language.
const int UNICODE_ESCAPE_SEQUENCE
Modifier
Indicates differents modifiers to use in class (only public, internal or static), fields or methods...
static readonly BitSet tokenSet_14_
const int UNICODE_CLASS_Lo
Statement statement()
UnaryOperator
Unary operators
static readonly BitSet tokenSet_0_
Expression equalityExpression()
const int UNICODE_CLASS_Ll
Statement doStatement()
const int QUALIFIED_IDENTIFIER
antlr.IToken IToken
Definition: CSharpLexer.cs:28
Statement[] accessorDeclarations()
SwitchLabel switchLabel()
const int LITERAL_param
Expression primaryExpression()
Encapsulates a integer literal expression.
Encapsulates a set of field declarations.
const int LITERAL_assembly
antlr.TokenStreamIOException TokenStreamIOException
Definition: CSharpLexer.cs:18
Encapsulates a declaration of a concrete field.
Encapsulates a constant definition.
Expression conditionalAndExpression()
Encapsulates the array expression to access the concrete position.
const int UNICODE_CLASS_Cf
Expression inclusiveOrExpression()
static readonly string[] tokenNames_
Expression expression()
Statement[] interfaceAccessors()
IdentifierExpression qualifiedIdentifier()
const int INVOCATION_EXPR
const int LOCVAR_INIT_LIST
List< Modifier > modifiers()
antlr.TokenStreamException TokenStreamException
Definition: CSharpLexer.cs:17
BitwiseOperator
Bitwise binary operators
const int POST_INC_EXPR
Statement setAccessorDeclaration()
const int USING_ALIAS_DIRECTIVE
const int MEMBER_ACCESS_EXPR
const int LITERAL_method
const int INDEXER_DECL
Expression additiveExpression()
List< Declaration > classBody()
const int GLOBAL_ATTRIBUTE_SECTION
Represents the error occurred while the source code is lexing.
Definition: LexicalError.cs:23
const int LITERAL_remove
Encapsulates a Continue statement of our programming languages.
static readonly BitSet tokenSet_13_
const int UNICODE_CLASS_Lm
const int STRING_LITERAL
string Identifier
Gets the name name.
Expression multiplicativeExpression()
const int VAR_INIT_LIST
Statement accessorBody()
const int SHIFTL_ASSIGN
const int PTR_DECLARATOR
static readonly BitSet tokenSet_10_
const int FORMAL_PARAMETER_LIST
CompoundExpression arrayInitializer()
Encapsulates a Throw statement of our programming languages.
const int PP_ENDREGION
const int ATTRIB_ARGUMENT_EXPR
string predefinedTypeName()
Statement expressionStatement()
antlr.ANTLRException ANTLRException
Definition: CSharpLexer.cs:22
const int DECIMAL_DIGIT
void namespaceMemberDeclaration(SourceFile sf)
const int LONG_LITERAL
CSharpParser(TokenStream lexer, int k)
List< Parameter > fixedParameters()
TernaryOperator
Ternary operators
AssignmentOperator
Assignment binary operators
Declaration classDeclaration(List< Modifier > mods)
const int LITERAL_property
Encapsulates a Foreach statement of our programming languages.
Expression statementExpression()
SourceFile compilationUnit()
Encapsulates a new expression.
Encapsulates a property definition.
Encapsulates a definition of a concrete class.
const int GLOBAL_ATTRIBUTE_SECTIONS
const int ADDRESS_OF_EXPR
List< Statement > localVariableDeclaration()
Expression andExpression()
Declaration interfaceMemberDeclaration()
FieldDeclaration variableDeclarator(string type, List< Modifier > mods)
const int PARAMETER_ARRAY
List< FieldDeclaration > constantDeclarators(string type, List< Modifier > mods)
Encapsulates a Switch statement of our programming languages.
const int PP_DIRECTIVE
const int SHIFTR_ASSIGN
List< string > interfaceBase()
const int INTERFACE_BASE
const int ATTRIBUTE_SECTION
static readonly BitSet tokenSet_17_
static readonly BitSet tokenSet_19_
const int VAR_DECLARATOR
static readonly BitSet tokenSet_4_
const int UNICODE_CLASS_Pc
const int CONNECTING_CHARACTER