public void CheckRewriteRuleTokenStreamConstructors() {
			RewriteRuleTokenStream tokenTest1 = new RewriteRuleTokenStream(CreateTreeAdaptor(),
				"RewriteRuleTokenStream test1");

			RewriteRuleTokenStream tokenTest2 = new RewriteRuleTokenStream(CreateTreeAdaptor(),
				"RewriteRuleTokenStream test2", CreateToken(1,
				"test token without any real context"));

			RewriteRuleTokenStream tokenTest3 = new RewriteRuleTokenStream(CreateTreeAdaptor(),
				"RewriteRuleTokenStream test3", CreateTokenList(4));
		}
		// $ANTLR start "assignmentOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:224:1: assignmentOp : x= '=' -> OP_ASSIGN[$x] ;
		public assignmentOp_return assignmentOp() // throws RecognitionException [1]
		{
			var retval = new assignmentOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_68 = new RewriteRuleTokenStream( adaptor, "token 68" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:225:2: (x= '=' -> OP_ASSIGN[$x] )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:225:4: x= '='
				{
					x = (IToken)Match( input, 68, FOLLOW_68_in_assignmentOp1201 );
					stream_68.Add( x );


					// AST REWRITE
					// elements:          
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 225:10: -> OP_ASSIGN[$x]
					{
						adaptor.AddChild( root_0, adaptor.Create( OP_ASSIGN, x ) );
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "equalsOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:189:1: equalsOp : (x= '==' -> OP_EQ[$x] | x= '=' -> OP_EQ[$x] );
		public equalsOp_return equalsOp() // throws RecognitionException [1]
		{
			var retval = new equalsOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_79 = new RewriteRuleTokenStream( adaptor, "token 79" );
			var stream_68 = new RewriteRuleTokenStream( adaptor, "token 68" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:190:2: (x= '==' -> OP_EQ[$x] | x= '=' -> OP_EQ[$x] )
				int alt26 = 2;
				int LA26_0 = input.LA( 1 );

				if ( ( LA26_0 == 79 ) )
					alt26 = 1;
				else if ( ( LA26_0 == 68 ) )
					alt26 = 2;
				else
				{
					var nvae_d26s0 =
							new NoViableAltException( "", 26, 0, input );

					throw nvae_d26s0;
				}
				switch ( alt26 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:190:4: x= '=='
						{
							x = (IToken)Match( input, 79, FOLLOW_79_in_equalsOp988 );
							stream_79.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 190:11: -> OP_EQ[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_EQ, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:191:4: x= '='
						{
							x = (IToken)Match( input, 68, FOLLOW_68_in_equalsOp1001 );
							stream_68.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 191:11: -> OP_EQ[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_EQ, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "andOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:181:1: andOp : (x= 'and' -> OP_AND[$x] | x= '&&' -> OP_AND[$x] );
		public andOp_return andOp() // throws RecognitionException [1]
		{
			var retval = new andOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_75 = new RewriteRuleTokenStream( adaptor, "token 75" );
			var stream_76 = new RewriteRuleTokenStream( adaptor, "token 76" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:182:2: (x= 'and' -> OP_AND[$x] | x= '&&' -> OP_AND[$x] )
				int alt24 = 2;
				int LA24_0 = input.LA( 1 );

				if ( ( LA24_0 == 75 ) )
					alt24 = 1;
				else if ( ( LA24_0 == 76 ) )
					alt24 = 2;
				else
				{
					var nvae_d24s0 =
							new NoViableAltException( "", 24, 0, input );

					throw nvae_d24s0;
				}
				switch ( alt24 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:182:4: x= 'and'
						{
							x = (IToken)Match( input, 75, FOLLOW_75_in_andOp927 );
							stream_75.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 182:12: -> OP_AND[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_AND, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:183:4: x= '&&'
						{
							x = (IToken)Match( input, 76, FOLLOW_76_in_andOp939 );
							stream_76.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 183:12: -> OP_AND[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_AND, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "formulaDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:125:1: formulaDeclaration : entityChainNoFilter assignmentOp expression ';' -> ^( FORMULA ^( assignmentOp entityChainNoFilter expression ) ) ;
		public formulaDeclaration_return formulaDeclaration() // throws RecognitionException [1]
		{
			var retval = new formulaDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken char_literal36 = null;
			entityChainNoFilter_return entityChainNoFilter33 = default( entityChainNoFilter_return );

			assignmentOp_return assignmentOp34 = default( assignmentOp_return );

			expression_return expression35 = default( expression_return );


			CommonTree char_literal36_tree = null;
			var stream_63 = new RewriteRuleTokenStream( adaptor, "token 63" );
			var stream_entityChainNoFilter = new RewriteRuleSubtreeStream( adaptor, "rule entityChainNoFilter" );
			var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
			var stream_assignmentOp = new RewriteRuleSubtreeStream( adaptor, "rule assignmentOp" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:126:2: ( entityChainNoFilter assignmentOp expression ';' -> ^( FORMULA ^( assignmentOp entityChainNoFilter expression ) ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:126:4: entityChainNoFilter assignmentOp expression ';'
				{
					PushFollow( FOLLOW_entityChainNoFilter_in_formulaDeclaration558 );
					entityChainNoFilter33 = entityChainNoFilter();
					state.followingStackPointer--;

					stream_entityChainNoFilter.Add( entityChainNoFilter33.Tree );
					PushFollow( FOLLOW_assignmentOp_in_formulaDeclaration560 );
					assignmentOp34 = assignmentOp();
					state.followingStackPointer--;

					stream_assignmentOp.Add( assignmentOp34.Tree );
					PushFollow( FOLLOW_expression_in_formulaDeclaration562 );
					expression35 = expression();
					state.followingStackPointer--;

					stream_expression.Add( expression35.Tree );
					char_literal36 = (IToken)Match( input, 63, FOLLOW_63_in_formulaDeclaration564 );
					stream_63.Add( char_literal36 );


					// AST REWRITE
					// elements:          assignmentOp, entityChainNoFilter, expression
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 126:52: -> ^( FORMULA ^( assignmentOp entityChainNoFilter expression ) )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:126:55: ^( FORMULA ^( assignmentOp entityChainNoFilter expression ) )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( FORMULA, "FORMULA" ), root_1 );

							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:126:66: ^( assignmentOp entityChainNoFilter expression )
							{
								var root_2 = (CommonTree)adaptor.GetNilNode();
								root_2 = (CommonTree)adaptor.BecomeRoot( stream_assignmentOp.NextNode(), root_2 );

								adaptor.AddChild( root_2, stream_entityChainNoFilter.NextTree() );
								adaptor.AddChild( root_2, stream_expression.NextTree() );

								adaptor.AddChild( root_1, root_2 );
							}

							adaptor.AddChild( root_0, root_1 );
						}
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "relationshipDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:113:1: relationshipDeclaration : 'relationship' name '=' relationshipJoinDeclaration ';' -> ^( RELATIONSHIP name relationshipJoinDeclaration ) ;
		public relationshipDeclaration_return relationshipDeclaration() // throws RecognitionException [1]
		{
			var retval = new relationshipDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken string_literal25 = null;
			IToken char_literal27 = null;
			IToken char_literal29 = null;
			name_return name26 = default( name_return );

			relationshipJoinDeclaration_return relationshipJoinDeclaration28 = default( relationshipJoinDeclaration_return );


			CommonTree string_literal25_tree = null;
			CommonTree char_literal27_tree = null;
			CommonTree char_literal29_tree = null;
			var stream_67 = new RewriteRuleTokenStream( adaptor, "token 67" );
			var stream_68 = new RewriteRuleTokenStream( adaptor, "token 68" );
			var stream_63 = new RewriteRuleTokenStream( adaptor, "token 63" );
			var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
			var stream_relationshipJoinDeclaration = new RewriteRuleSubtreeStream( adaptor, "rule relationshipJoinDeclaration" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:114:2: ( 'relationship' name '=' relationshipJoinDeclaration ';' -> ^( RELATIONSHIP name relationshipJoinDeclaration ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:114:4: 'relationship' name '=' relationshipJoinDeclaration ';'
				{
					string_literal25 = (IToken)Match( input, 67, FOLLOW_67_in_relationshipDeclaration484 );
					stream_67.Add( string_literal25 );

					PushFollow( FOLLOW_name_in_relationshipDeclaration486 );
					name26 = name();
					state.followingStackPointer--;

					stream_name.Add( name26.Tree );
					char_literal27 = (IToken)Match( input, 68, FOLLOW_68_in_relationshipDeclaration488 );
					stream_68.Add( char_literal27 );

					PushFollow( FOLLOW_relationshipJoinDeclaration_in_relationshipDeclaration490 );
					relationshipJoinDeclaration28 = relationshipJoinDeclaration();
					state.followingStackPointer--;

					stream_relationshipJoinDeclaration.Add( relationshipJoinDeclaration28.Tree );
					char_literal29 = (IToken)Match( input, 63, FOLLOW_63_in_relationshipDeclaration492 );
					stream_63.Add( char_literal29 );


					// AST REWRITE
					// elements:          name, relationshipJoinDeclaration
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 114:60: -> ^( RELATIONSHIP name relationshipJoinDeclaration )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:114:63: ^( RELATIONSHIP name relationshipJoinDeclaration )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( RELATIONSHIP, "RELATIONSHIP" ), root_1 );

							adaptor.AddChild( root_1, stream_name.NextTree() );
							adaptor.AddChild( root_1, stream_relationshipJoinDeclaration.NextTree() );

							adaptor.AddChild( root_0, root_1 );
						}
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 7
0
        private AstParserRuleReturnScope <object, IToken> plain_elem()
        {
            EnterRule_plain_elem();
            EnterRule("plain_elem", 5);
            TraceIn("plain_elem", 5);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken i1       = default(IToken);
            IToken i2       = default(IToken);
            IToken al       = default(IToken);
            IToken ID12     = default(IToken);
            IToken FROM13   = default(IToken);
            IToken TO14     = default(IToken);
            IToken ID15     = default(IToken);
            IToken LENGTH16 = default(IToken);

            object i1_tree       = default(object);
            object i2_tree       = default(object);
            object al_tree       = default(object);
            object ID12_tree     = default(object);
            object FROM13_tree   = default(object);
            object TO14_tree     = default(object);
            object ID15_tree     = default(object);
            object LENGTH16_tree = default(object);
            RewriteRuleITokenStream stream_INT         = new RewriteRuleITokenStream(adaptor, "token INT");
            RewriteRuleITokenStream stream_ALIGN_RIGHT = new RewriteRuleITokenStream(adaptor, "token ALIGN_RIGHT");
            RewriteRuleITokenStream stream_ID          = new RewriteRuleITokenStream(adaptor, "token ID");
            RewriteRuleITokenStream stream_FROM        = new RewriteRuleITokenStream(adaptor, "token FROM");
            RewriteRuleITokenStream stream_TO          = new RewriteRuleITokenStream(adaptor, "token TO");
            RewriteRuleITokenStream stream_ALIGN_LEFT  = new RewriteRuleITokenStream(adaptor, "token ALIGN_LEFT");
            RewriteRuleITokenStream stream_LENGTH      = new RewriteRuleITokenStream(adaptor, "token LENGTH");

            try { DebugEnterRule(GrammarFileName, "plain_elem");
                  DebugLocation(47, 2);
                  try
                  {
                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:47:11: ( ID FROM i1= INT TO i2= INT (al= ALIGN_LEFT |al= ALIGN_RIGHT )? -> ^( ID $i1 $i2 ( $al)? ) | ID LENGTH i1= INT (al= ALIGN_LEFT |al= ALIGN_RIGHT )? -> ^( ID $i1 ( $al)? ) )
                      int alt5 = 2;
                      try { DebugEnterDecision(5, false);
                            int LA5_0 = input.LA(1);

                            if ((LA5_0 == ID))
                            {
                                int LA5_1 = input.LA(2);

                                if ((LA5_1 == FROM))
                                {
                                    alt5 = 1;
                                }
                                else if ((LA5_1 == LENGTH))
                                {
                                    alt5 = 2;
                                }
                                else
                                {
                                    NoViableAltException nvae = new NoViableAltException("", 5, 1, input);
                                    DebugRecognitionException(nvae);
                                    throw nvae;
                                }
                            }
                            else
                            {
                                NoViableAltException nvae = new NoViableAltException("", 5, 0, input);
                                DebugRecognitionException(nvae);
                                throw nvae;
                            } } finally { DebugExitDecision(5); }
                      switch (alt5)
                      {
                      case 1:
                          DebugEnterAlt(1);
                          // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:3: ID FROM i1= INT TO i2= INT (al= ALIGN_LEFT |al= ALIGN_RIGHT )?
                          {
                              DebugLocation(48, 3);
                              ID12 = (IToken)Match(input, ID, Follow._ID_in_plain_elem181);
                              stream_ID.Add(ID12);

                              DebugLocation(48, 6);
                              FROM13 = (IToken)Match(input, FROM, Follow._FROM_in_plain_elem183);
                              stream_FROM.Add(FROM13);

                              DebugLocation(48, 13);
                              i1 = (IToken)Match(input, INT, Follow._INT_in_plain_elem187);
                              stream_INT.Add(i1);

                              DebugLocation(48, 18);
                              TO14 = (IToken)Match(input, TO, Follow._TO_in_plain_elem189);
                              stream_TO.Add(TO14);

                              DebugLocation(48, 23);
                              i2 = (IToken)Match(input, INT, Follow._INT_in_plain_elem193);
                              stream_INT.Add(i2);

                              DebugLocation(48, 28);
                              // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:28: (al= ALIGN_LEFT |al= ALIGN_RIGHT )?
                              int alt3 = 3;
                              try { DebugEnterSubRule(3);
                                    try { DebugEnterDecision(3, false);
                                          int LA3_0 = input.LA(1);

                                          if ((LA3_0 == ALIGN_LEFT))
                                          {
                                              alt3 = 1;
                                          }
                                          else if ((LA3_0 == ALIGN_RIGHT))
                                          {
                                              alt3 = 2;
                                          }
                                    } finally { DebugExitDecision(3); }
                                    switch (alt3)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:29: al= ALIGN_LEFT
                                        {
                                            DebugLocation(48, 31);
                                            al = (IToken)Match(input, ALIGN_LEFT, Follow._ALIGN_LEFT_in_plain_elem198);
                                            stream_ALIGN_LEFT.Add(al);
                                        }
                                        break;

                                    case 2:
                                        DebugEnterAlt(2);
                                        // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:45: al= ALIGN_RIGHT
                                        {
                                            DebugLocation(48, 47);
                                            al = (IToken)Match(input, ALIGN_RIGHT, Follow._ALIGN_RIGHT_in_plain_elem204);
                                            stream_ALIGN_RIGHT.Add(al);
                                        }
                                        break;
                                    }
                              } finally { DebugExitSubRule(3); }



                              {
                                  // AST REWRITE
                                  // elements: i2, ID, al, i1
                                  // token labels: al, i2, i1
                                  // rule labels: retval
                                  // token list labels:
                                  // rule list labels:
                                  // wildcard labels:
                                  retval.Tree = root_0;
                                  RewriteRuleITokenStream  stream_al     = new RewriteRuleITokenStream(adaptor, "token al", al);
                                  RewriteRuleITokenStream  stream_i2     = new RewriteRuleITokenStream(adaptor, "token i2", i2);
                                  RewriteRuleITokenStream  stream_i1     = new RewriteRuleITokenStream(adaptor, "token i1", i1);
                                  RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                                  root_0 = (object)adaptor.Nil();
                                  // 48:62: -> ^( ID $i1 $i2 ( $al)? )
                                  {
                                      DebugLocation(48, 65);
                                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:65: ^( ID $i1 $i2 ( $al)? )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(48, 67);
                                          root_1 = (object)adaptor.BecomeRoot(stream_ID.NextNode(), root_1);

                                          DebugLocation(48, 71);
                                          adaptor.AddChild(root_1, stream_i1.NextNode());
                                          DebugLocation(48, 75);
                                          adaptor.AddChild(root_1, stream_i2.NextNode());
                                          DebugLocation(48, 79);
                                          // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:48:79: ( $al)?
                                          if (stream_al.HasNext)
                                          {
                                              DebugLocation(48, 79);
                                              adaptor.AddChild(root_1, stream_al.NextNode());
                                          }
                                          stream_al.Reset();

                                          adaptor.AddChild(root_0, root_1);
                                      }
                                  }

                                  retval.Tree = root_0;
                              }
                          }
                          break;

                      case 2:
                          DebugEnterAlt(2);
                          // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:3: ID LENGTH i1= INT (al= ALIGN_LEFT |al= ALIGN_RIGHT )?
                          {
                              DebugLocation(50, 3);
                              ID15 = (IToken)Match(input, ID, Follow._ID_in_plain_elem230);
                              stream_ID.Add(ID15);

                              DebugLocation(50, 6);
                              LENGTH16 = (IToken)Match(input, LENGTH, Follow._LENGTH_in_plain_elem232);
                              stream_LENGTH.Add(LENGTH16);

                              DebugLocation(50, 15);
                              i1 = (IToken)Match(input, INT, Follow._INT_in_plain_elem236);
                              stream_INT.Add(i1);

                              DebugLocation(50, 20);
                              // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:20: (al= ALIGN_LEFT |al= ALIGN_RIGHT )?
                              int alt4 = 3;
                              try { DebugEnterSubRule(4);
                                    try { DebugEnterDecision(4, false);
                                          int LA4_0 = input.LA(1);

                                          if ((LA4_0 == ALIGN_LEFT))
                                          {
                                              alt4 = 1;
                                          }
                                          else if ((LA4_0 == ALIGN_RIGHT))
                                          {
                                              alt4 = 2;
                                          }
                                    } finally { DebugExitDecision(4); }
                                    switch (alt4)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:21: al= ALIGN_LEFT
                                        {
                                            DebugLocation(50, 23);
                                            al = (IToken)Match(input, ALIGN_LEFT, Follow._ALIGN_LEFT_in_plain_elem241);
                                            stream_ALIGN_LEFT.Add(al);
                                        }
                                        break;

                                    case 2:
                                        DebugEnterAlt(2);
                                        // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:37: al= ALIGN_RIGHT
                                        {
                                            DebugLocation(50, 39);
                                            al = (IToken)Match(input, ALIGN_RIGHT, Follow._ALIGN_RIGHT_in_plain_elem247);
                                            stream_ALIGN_RIGHT.Add(al);
                                        }
                                        break;
                                    }
                              } finally { DebugExitSubRule(4); }



                              {
                                  // AST REWRITE
                                  // elements: i1, al, ID
                                  // token labels: al, i1
                                  // rule labels: retval
                                  // token list labels:
                                  // rule list labels:
                                  // wildcard labels:
                                  retval.Tree = root_0;
                                  RewriteRuleITokenStream  stream_al     = new RewriteRuleITokenStream(adaptor, "token al", al);
                                  RewriteRuleITokenStream  stream_i1     = new RewriteRuleITokenStream(adaptor, "token i1", i1);
                                  RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                                  root_0 = (object)adaptor.Nil();
                                  // 50:54: -> ^( ID $i1 ( $al)? )
                                  {
                                      DebugLocation(50, 57);
                                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:57: ^( ID $i1 ( $al)? )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(50, 59);
                                          root_1 = (object)adaptor.BecomeRoot(stream_ID.NextNode(), root_1);

                                          DebugLocation(50, 63);
                                          adaptor.AddChild(root_1, stream_i1.NextNode());
                                          DebugLocation(50, 67);
                                          // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:50:67: ( $al)?
                                          if (stream_al.HasNext)
                                          {
                                              DebugLocation(50, 67);
                                              adaptor.AddChild(root_1, stream_al.NextNode());
                                          }
                                          stream_al.Reset();

                                          adaptor.AddChild(root_0, root_1);
                                      }
                                  }

                                  retval.Tree = root_0;
                              }
                          }
                          break;
                      }
                      retval.Stop = (IToken)input.LT(-1);

                      retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                      adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("plain_elem", 5);
                      LeaveRule("plain_elem", 5);
                      LeaveRule_plain_elem();
                  }
                  DebugLocation(51, 2); } finally { DebugExitRule(GrammarFileName, "plain_elem"); }
            return(retval);
        }
		// $ANTLR start "baseClassDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:82:1: baseClassDeclaration : ':' name 'where' expression -> ^( BASE_CLASS name ^( DISCRIMINATOR expression ) ) ;
		public baseClassDeclaration_return baseClassDeclaration() // throws RecognitionException [1]
		{
			var retval = new baseClassDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken char_literal8 = null;
			IToken string_literal10 = null;
			name_return name9 = default( name_return );

			expression_return expression11 = default( expression_return );


			CommonTree char_literal8_tree = null;
			CommonTree string_literal10_tree = null;
			var stream_59 = new RewriteRuleTokenStream( adaptor, "token 59" );
			var stream_58 = new RewriteRuleTokenStream( adaptor, "token 58" );
			var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
			var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:83:2: ( ':' name 'where' expression -> ^( BASE_CLASS name ^( DISCRIMINATOR expression ) ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:83:4: ':' name 'where' expression
				{
					char_literal8 = (IToken)Match( input, 58, FOLLOW_58_in_baseClassDeclaration294 );
					stream_58.Add( char_literal8 );

					PushFollow( FOLLOW_name_in_baseClassDeclaration296 );
					name9 = name();
					state.followingStackPointer--;

					stream_name.Add( name9.Tree );
					string_literal10 = (IToken)Match( input, 59, FOLLOW_59_in_baseClassDeclaration298 );
					stream_59.Add( string_literal10 );

					PushFollow( FOLLOW_expression_in_baseClassDeclaration300 );
					expression11 = expression();
					state.followingStackPointer--;

					stream_expression.Add( expression11.Tree );


					// AST REWRITE
					// elements:          name, expression
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 83:32: -> ^( BASE_CLASS name ^( DISCRIMINATOR expression ) )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:83:35: ^( BASE_CLASS name ^( DISCRIMINATOR expression ) )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( BASE_CLASS, "BASE_CLASS" ), root_1 );

							adaptor.AddChild( root_1, stream_name.NextTree() );
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:83:54: ^( DISCRIMINATOR expression )
							{
								var root_2 = (CommonTree)adaptor.GetNilNode();
								root_2 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( DISCRIMINATOR, "DISCRIMINATOR" ), root_2 );

								adaptor.AddChild( root_2, stream_expression.NextTree() );

								adaptor.AddChild( root_1, root_2 );
							}

							adaptor.AddChild( root_0, root_1 );
						}
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 9
0
        private PointcutParser.atom_return atom()
        {
            Enter_atom();
            EnterRule("atom", 6);
            TraceIn("atom", 6);
            PointcutParser.atom_return retval = new PointcutParser.atom_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal15 = null;
            IToken Identifier16   = null;
            IToken Value17        = null;
            IToken char_literal18 = null;
            IToken char_literal20 = null;

            PointcutParser.compound_return compound19 = default(PointcutParser.compound_return);

            object char_literal15_tree                = default(object);
            object Identifier16_tree                  = default(object);
            object Value17_tree                       = default(object);
            object char_literal18_tree                = default(object);
            object char_literal20_tree                = default(object);
            RewriteRuleITokenStream stream_16         = new RewriteRuleITokenStream(adaptor, "token 16");
            RewriteRuleITokenStream stream_Identifier = new RewriteRuleITokenStream(adaptor, "token Identifier");

            try { DebugEnterRule(GrammarFileName, "atom");
                  DebugLocation(33, 22);
                  try
                  {
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:33:6: ( '@' Identifier -> ^( POINTCUTREF Identifier ) | Value | '(' compound ')' )
                      int alt8 = 3;
                      try { DebugEnterDecision(8, decisionCanBacktrack[8]);
                            switch (input.LA(1))
                            {
                            case 16:
                            {
                                alt8 = 1;
                            }
                            break;

                            case Value:
                            {
                                alt8 = 2;
                            }
                            break;

                            case 17:
                            {
                                alt8 = 3;
                            }
                            break;

                            default:
                            {
                                NoViableAltException nvae = new NoViableAltException("", 8, 0, input);

                                DebugRecognitionException(nvae);
                                throw nvae;
                            }
                            }
                      } finally { DebugExitDecision(8); }
                      switch (alt8)
                      {
                      case 1:
                          DebugEnterAlt(1);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:33:8: '@' Identifier
                          {
                              DebugLocation(33, 8);
                              char_literal15 = (IToken)Match(input, 16, Follow._16_in_atom190);
                              stream_16.Add(char_literal15);

                              DebugLocation(33, 12);
                              Identifier16 = (IToken)Match(input, Identifier, Follow._Identifier_in_atom192);
                              stream_Identifier.Add(Identifier16);



                              {
                                  // AST REWRITE
                                  // elements: Identifier
                                  // token labels:
                                  // rule labels: retval
                                  // token list labels:
                                  // rule list labels:
                                  // wildcard labels:
                                  retval.Tree = root_0;
                                  RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                                  root_0 = (object)adaptor.Nil();
                                  // 33:23: -> ^( POINTCUTREF Identifier )
                                  {
                                      DebugLocation(33, 26);
                                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:33:26: ^( POINTCUTREF Identifier )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(33, 28);
                                          root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(POINTCUTREF, "POINTCUTREF"), root_1);

                                          DebugLocation(33, 40);
                                          adaptor.AddChild(root_1, stream_Identifier.NextNode());

                                          adaptor.AddChild(root_0, root_1);
                                      }
                                  }

                                  retval.Tree = root_0;
                              }
                          }
                          break;

                      case 2:
                          DebugEnterAlt(2);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:34:5: Value
                          {
                              root_0 = (object)adaptor.Nil();

                              DebugLocation(34, 5);
                              Value17      = (IToken)Match(input, Value, Follow._Value_in_atom206);
                              Value17_tree = (object)adaptor.Create(Value17);
                              adaptor.AddChild(root_0, Value17_tree);
                          }
                          break;

                      case 3:
                          DebugEnterAlt(3);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:35:5: '(' compound ')'
                          {
                              root_0 = (object)adaptor.Nil();

                              DebugLocation(35, 8);
                              char_literal18 = (IToken)Match(input, 17, Follow._17_in_atom213);
                              DebugLocation(35, 10);
                              PushFollow(Follow._compound_in_atom216);
                              compound19 = compound();
                              PopFollow();

                              adaptor.AddChild(root_0, compound19.Tree);
                              DebugLocation(35, 22);
                              char_literal20 = (IToken)Match(input, 18, Follow._18_in_atom218);
                          }
                          break;
                      }
                      retval.Stop = (IToken)input.LT(-1);

                      retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                      adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("atom", 6);
                      LeaveRule("atom", 6);
                      Leave_atom();
                  }
                  DebugLocation(35, 22); } finally { DebugExitRule(GrammarFileName, "atom"); }
            return(retval);
        }
Ejemplo n.º 10
0
        private PointcutParser.criteria_return criteria()
        {
            Enter_criteria();
            EnterRule("criteria", 5);
            TraceIn("criteria", 5);
            PointcutParser.criteria_return retval = new PointcutParser.criteria_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken Identifier12   = null;
            IToken char_literal13 = null;

            PointcutParser.atom_return  atom11  = default(PointcutParser.atom_return);
            PointcutParser.array_return array14 = default(PointcutParser.array_return);

            object Identifier12_tree                   = default(object);
            object char_literal13_tree                 = default(object);
            RewriteRuleITokenStream  stream_15         = new RewriteRuleITokenStream(adaptor, "token 15");
            RewriteRuleITokenStream  stream_Identifier = new RewriteRuleITokenStream(adaptor, "token Identifier");
            RewriteRuleSubtreeStream stream_array      = new RewriteRuleSubtreeStream(adaptor, "rule array");

            try { DebugEnterRule(GrammarFileName, "criteria");
                  DebugLocation(30, 60);
                  try
                  {
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:30:10: ( atom | ( Identifier ( ':' array )? ) -> ^( CRITERIA Identifier ( array )? ) )
                      int alt7 = 2;
                      try { DebugEnterDecision(7, decisionCanBacktrack[7]);
                            int LA7_0 = input.LA(1);

                            if ((LA7_0 == Value || (LA7_0 >= 16 && LA7_0 <= 17)))
                            {
                                alt7 = 1;
                            }
                            else if ((LA7_0 == Identifier))
                            {
                                alt7 = 2;
                            }
                            else
                            {
                                NoViableAltException nvae = new NoViableAltException("", 7, 0, input);

                                DebugRecognitionException(nvae);
                                throw nvae;
                            } } finally { DebugExitDecision(7); }
                      switch (alt7)
                      {
                      case 1:
                          DebugEnterAlt(1);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:30:12: atom
                          {
                              root_0 = (object)adaptor.Nil();

                              DebugLocation(30, 12);
                              PushFollow(Follow._atom_in_criteria157);
                              atom11 = atom();
                              PopFollow();

                              adaptor.AddChild(root_0, atom11.Tree);
                          }
                          break;

                      case 2:
                          DebugEnterAlt(2);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:4: ( Identifier ( ':' array )? )
                          {
                              DebugLocation(31, 4);
                              // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:4: ( Identifier ( ':' array )? )
                              DebugEnterAlt(1);
                              // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:5: Identifier ( ':' array )?
                              {
                                  DebugLocation(31, 5);
                                  Identifier12 = (IToken)Match(input, Identifier, Follow._Identifier_in_criteria163);
                                  stream_Identifier.Add(Identifier12);

                                  DebugLocation(31, 16);
                                  // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:16: ( ':' array )?
                                  int alt6 = 2;
                                  try { DebugEnterSubRule(6);
                                        try { DebugEnterDecision(6, decisionCanBacktrack[6]);
                                              int LA6_0 = input.LA(1);

                                              if ((LA6_0 == 15))
                                              {
                                                  alt6 = 1;
                                              }
                                        } finally { DebugExitDecision(6); }
                                        switch (alt6)
                                        {
                                        case 1:
                                            DebugEnterAlt(1);
                                            // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:17: ':' array
                                            {
                                                DebugLocation(31, 17);
                                                char_literal13 = (IToken)Match(input, 15, Follow._15_in_criteria166);
                                                stream_15.Add(char_literal13);

                                                DebugLocation(31, 21);
                                                PushFollow(Follow._array_in_criteria168);
                                                array14 = array();
                                                PopFollow();

                                                stream_array.Add(array14.Tree);
                                            }
                                            break;
                                        }
                                  } finally { DebugExitSubRule(6); }
                              }



                              {
                                  // AST REWRITE
                                  // elements: array, Identifier
                                  // token labels:
                                  // rule labels: retval
                                  // token list labels:
                                  // rule list labels:
                                  // wildcard labels:
                                  retval.Tree = root_0;
                                  RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                                  root_0 = (object)adaptor.Nil();
                                  // 31:29: -> ^( CRITERIA Identifier ( array )? )
                                  {
                                      DebugLocation(31, 32);
                                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:32: ^( CRITERIA Identifier ( array )? )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(31, 34);
                                          root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(CRITERIA, "CRITERIA"), root_1);

                                          DebugLocation(31, 43);
                                          adaptor.AddChild(root_1, stream_Identifier.NextNode());
                                          DebugLocation(31, 54);
                                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:31:54: ( array )?
                                          if (stream_array.HasNext)
                                          {
                                              DebugLocation(31, 54);
                                              adaptor.AddChild(root_1, stream_array.NextTree());
                                          }
                                          stream_array.Reset();

                                          adaptor.AddChild(root_0, root_1);
                                      }
                                  }

                                  retval.Tree = root_0;
                              }
                          }
                          break;
                      }
                      retval.Stop = (IToken)input.LT(-1);

                      retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                      adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("criteria", 5);
                      LeaveRule("criteria", 5);
                      Leave_criteria();
                  }
                  DebugLocation(31, 60); } finally { DebugExitRule(GrammarFileName, "criteria"); }
            return(retval);
        }
Ejemplo n.º 11
0
        private PointcutParser.array_return array()
        {
            Enter_array();
            EnterRule("array", 3);
            TraceIn("array", 3);
            PointcutParser.array_return retval = new PointcutParser.array_return();
            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal7 = null;

            PointcutParser.negation_return negation6 = default(PointcutParser.negation_return);
            PointcutParser.negation_return negation8 = default(PointcutParser.negation_return);

            object char_literal7_tree                = default(object);
            RewriteRuleITokenStream  stream_14       = new RewriteRuleITokenStream(adaptor, "token 14");
            RewriteRuleSubtreeStream stream_negation = new RewriteRuleSubtreeStream(adaptor, "rule negation");

            try { DebugEnterRule(GrammarFileName, "array");
                  DebugLocation(23, 3);
                  try
                  {
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:23:7: ( negation ( ( ',' negation )+ -> ^( ARRAY ( negation )* ) | -> negation ) )
                      DebugEnterAlt(1);
                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:23:9: negation ( ( ',' negation )+ -> ^( ARRAY ( negation )* ) | -> negation )
                      {
                          DebugLocation(23, 9);
                          PushFollow(Follow._negation_in_array100);
                          negation6 = negation();
                          PopFollow();

                          stream_negation.Add(negation6.Tree);
                          DebugLocation(23, 18);
                          // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:23:18: ( ( ',' negation )+ -> ^( ARRAY ( negation )* ) | -> negation )
                          int alt4 = 2;
                          try { DebugEnterSubRule(4);
                                try { DebugEnterDecision(4, decisionCanBacktrack[4]);
                                      int LA4_0 = input.LA(1);

                                      if ((LA4_0 == 14))
                                      {
                                          alt4 = 1;
                                      }
                                      else if ((LA4_0 == EOF || (LA4_0 >= And && LA4_0 <= Or) || LA4_0 == 18))
                                      {
                                          alt4 = 2;
                                      }
                                      else
                                      {
                                          NoViableAltException nvae = new NoViableAltException("", 4, 0, input);

                                          DebugRecognitionException(nvae);
                                          throw nvae;
                                      } } finally { DebugExitDecision(4); }
                                switch (alt4)
                                {
                                case 1:
                                    DebugEnterAlt(1);
                                    // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:24:4: ( ',' negation )+
                                    {
                                        DebugLocation(24, 4);
                                        // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:24:4: ( ',' negation )+
                                        int cnt3 = 0;
                                        try { DebugEnterSubRule(3);
                                              while (true)
                                              {
                                                  int alt3 = 2;
                                                  try { DebugEnterDecision(3, decisionCanBacktrack[3]);
                                                        int LA3_0 = input.LA(1);

                                                        if ((LA3_0 == 14))
                                                        {
                                                            alt3 = 1;
                                                        }
                                                  } finally { DebugExitDecision(3); }
                                                  switch (alt3)
                                                  {
                                                  case 1:
                                                      DebugEnterAlt(1);
                                                      // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:24:5: ',' negation
                                                      {
                                                          DebugLocation(24, 5);
                                                          char_literal7 = (IToken)Match(input, 14, Follow._14_in_array108);
                                                          stream_14.Add(char_literal7);

                                                          DebugLocation(24, 9);
                                                          PushFollow(Follow._negation_in_array110);
                                                          negation8 = negation();
                                                          PopFollow();

                                                          stream_negation.Add(negation8.Tree);
                                                      }
                                                      break;

                                                  default:
                                                      if (cnt3 >= 1)
                                                      {
                                                          goto loop3;
                                                      }

                                                      EarlyExitException eee3 = new EarlyExitException(3, input);
                                                      DebugRecognitionException(eee3);
                                                      throw eee3;
                                                  }
                                                  cnt3++;
                                              }
loop3:
                                              ; } finally { DebugExitSubRule(3); }



                                        {
                                            // AST REWRITE
                                            // elements: negation
                                            // token labels:
                                            // rule labels: retval
                                            // token list labels:
                                            // rule list labels:
                                            // wildcard labels:
                                            retval.Tree = root_0;
                                            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                                            root_0 = (object)adaptor.Nil();
                                            // 24:20: -> ^( ARRAY ( negation )* )
                                            {
                                                DebugLocation(24, 23);
                                                // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:24:23: ^( ARRAY ( negation )* )
                                                {
                                                    object root_1 = (object)adaptor.Nil();
                                                    DebugLocation(24, 25);
                                                    root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(ARRAY, "ARRAY"), root_1);

                                                    DebugLocation(24, 31);
                                                    // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:24:31: ( negation )*
                                                    while (stream_negation.HasNext)
                                                    {
                                                        DebugLocation(24, 31);
                                                        adaptor.AddChild(root_1, stream_negation.NextTree());
                                                    }
                                                    stream_negation.Reset();

                                                    adaptor.AddChild(root_0, root_1);
                                                }
                                            }

                                            retval.Tree = root_0;
                                        }
                                    }
                                    break;

                                case 2:
                                    DebugEnterAlt(2);
                                    // D:\\Dev\\Codeplex\\SheepAop\\SheepAspect\\Saql\\Ast\\Pointcut.g:25:7:
                                    {
                                        {
                                            // AST REWRITE
                                            // elements: negation
                                            // token labels:
                                            // rule labels: retval
                                            // token list labels:
                                            // rule list labels:
                                            // wildcard labels:
                                            retval.Tree = root_0;
                                            RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                                            root_0 = (object)adaptor.Nil();
                                            // 25:7: -> negation
                                            {
                                                DebugLocation(25, 10);
                                                adaptor.AddChild(root_0, stream_negation.NextTree());
                                            }

                                            retval.Tree = root_0;
                                        }
                                    }
                                    break;
                                }
                          } finally { DebugExitSubRule(4); }
                      }

                      retval.Stop = (IToken)input.LT(-1);

                      retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                      adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("array", 3);
                      LeaveRule("array", 3);
                      Leave_array();
                  }
                  DebugLocation(26, 3); } finally { DebugExitRule(GrammarFileName, "array"); }
            return(retval);
        }
Ejemplo n.º 12
0
        private AstParserRuleReturnScope <object, IToken> identifier()
        {
            EnterRule_identifier();
            EnterRule("identifier", 5);
            TraceIn("identifier", 5);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken ASTERISK12 = default(IToken);
            AstParserRuleReturnScope <object, IToken> prefixedName11 = default(AstParserRuleReturnScope <object, IToken>);

            object ASTERISK12_tree = default(object);
            RewriteRuleITokenStream  stream_ASTERISK     = new RewriteRuleITokenStream(adaptor, "token ASTERISK");
            RewriteRuleSubtreeStream stream_prefixedName = new RewriteRuleSubtreeStream(adaptor, "rule prefixedName");

            try { DebugEnterRule(GrammarFileName, "identifier");
                  DebugLocation(56, 1);
                  try
                  {
                      // ../Grammars/OslcSelect.g:56:12: ( prefixedName -> ^( 'prefixed_name' prefixedName ) | ASTERISK -> ^( 'wildcard' ) )
                      int alt3 = 2;
                      try { DebugEnterDecision(3, false);
                            int LA3_1 = input.LA(1);

                            if (((LA3_1 >= PNAME_LN && LA3_1 <= PNAME_NS)))
                            {
                                alt3 = 1;
                            }
                            else if ((LA3_1 == ASTERISK))
                            {
                                alt3 = 2;
                            }
                            else
                            {
                                NoViableAltException nvae = new NoViableAltException("", 3, 0, input, 1);
                                DebugRecognitionException(nvae);
                                throw nvae;
                            } } finally { DebugExitDecision(3); }
                      switch (alt3)
                      {
                      case 1:
                          DebugEnterAlt(1);
                          // ../Grammars/OslcSelect.g:56:14: prefixedName
                          {
                              DebugLocation(56, 14);
                              PushFollow(Follow._prefixedName_in_identifier173);
                              prefixedName11 = prefixedName();
                              PopFollow();

                              stream_prefixedName.Add(prefixedName11.Tree);


                              {
                                  // AST REWRITE
                                  // elements: prefixedName, PREFIXED_NAME
                                  // token labels:
                                  // rule labels: retval
                                  // token list labels:
                                  // rule list labels:
                                  // wildcard labels:
                                  retval.Tree = root_0;
                                  RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                                  root_0 = (object)adaptor.Nil();
                                  // 56:27: -> ^( 'prefixed_name' prefixedName )
                                  {
                                      DebugLocation(56, 30);
                                      // ../Grammars/OslcSelect.g:56:30: ^( 'prefixed_name' prefixedName )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(56, 33);
                                          root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(PREFIXED_NAME, "PREFIXED_NAME"), root_1);

                                          DebugLocation(56, 49);
                                          adaptor.AddChild(root_1, stream_prefixedName.NextTree());

                                          adaptor.AddChild(root_0, root_1);
                                      }
                                  }

                                  retval.Tree = root_0;
                              }
                          }
                          break;

                      case 2:
                          DebugEnterAlt(2);
                          // ../Grammars/OslcSelect.g:57:7: ASTERISK
                          {
                              DebugLocation(57, 7);
                              ASTERISK12 = (IToken)Match(input, ASTERISK, Follow._ASTERISK_in_identifier191);
                              stream_ASTERISK.Add(ASTERISK12);



                              {
                                  // AST REWRITE
                                  // elements: WILDCARD
                                  // token labels:
                                  // rule labels: retval
                                  // token list labels:
                                  // rule list labels:
                                  // wildcard labels:
                                  retval.Tree = root_0;
                                  RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                                  root_0 = (object)adaptor.Nil();
                                  // 57:16: -> ^( 'wildcard' )
                                  {
                                      DebugLocation(57, 19);
                                      // ../Grammars/OslcSelect.g:57:19: ^( 'wildcard' )
                                      {
                                          object root_1 = (object)adaptor.Nil();
                                          DebugLocation(57, 22);
                                          root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(WILDCARD, "WILDCARD"), root_1);

                                          adaptor.AddChild(root_0, root_1);
                                      }
                                  }

                                  retval.Tree = root_0;
                              }
                          }
                          break;
                      }
                      retval.Stop = (IToken)input.LT(-1);

                      retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                      adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("identifier", 5);
                      LeaveRule("identifier", 5);
                      LeaveRule_identifier();
                  }
                  DebugLocation(58, 1); } finally { DebugExitRule(GrammarFileName, "identifier"); }
            return(retval);
        }
Ejemplo n.º 13
0
        private AstParserRuleReturnScope <object, IToken> nested_property()
        {
            EnterRule_nested_property();
            EnterRule("nested_property", 4);
            TraceIn("nested_property", 4);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken OPEN_CURLY_BRACE8   = default(IToken);
            IToken CLOSE_CURLY_BRACE10 = default(IToken);
            AstParserRuleReturnScope <object, IToken> identifier7 = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> properties9 = default(AstParserRuleReturnScope <object, IToken>);

            object OPEN_CURLY_BRACE8_tree   = default(object);
            object CLOSE_CURLY_BRACE10_tree = default(object);
            RewriteRuleITokenStream  stream_CLOSE_CURLY_BRACE = new RewriteRuleITokenStream(adaptor, "token CLOSE_CURLY_BRACE");
            RewriteRuleITokenStream  stream_OPEN_CURLY_BRACE  = new RewriteRuleITokenStream(adaptor, "token OPEN_CURLY_BRACE");
            RewriteRuleSubtreeStream stream_properties        = new RewriteRuleSubtreeStream(adaptor, "rule properties");
            RewriteRuleSubtreeStream stream_identifier        = new RewriteRuleSubtreeStream(adaptor, "rule identifier");

            try { DebugEnterRule(GrammarFileName, "nested_property");
                  DebugLocation(53, 1);
                  try
                  {
                      // ../Grammars/OslcSelect.g:53:17: ( identifier OPEN_CURLY_BRACE properties CLOSE_CURLY_BRACE -> ^( 'nested_property' identifier properties ) )
                      DebugEnterAlt(1);
                      // ../Grammars/OslcSelect.g:53:19: identifier OPEN_CURLY_BRACE properties CLOSE_CURLY_BRACE
                      {
                          DebugLocation(53, 19);
                          PushFollow(Follow._identifier_in_nested_property145);
                          identifier7 = identifier();
                          PopFollow();

                          stream_identifier.Add(identifier7.Tree);
                          DebugLocation(53, 30);
                          OPEN_CURLY_BRACE8 = (IToken)Match(input, OPEN_CURLY_BRACE, Follow._OPEN_CURLY_BRACE_in_nested_property147);
                          stream_OPEN_CURLY_BRACE.Add(OPEN_CURLY_BRACE8);

                          DebugLocation(53, 47);
                          PushFollow(Follow._properties_in_nested_property149);
                          properties9 = properties();
                          PopFollow();

                          stream_properties.Add(properties9.Tree);
                          DebugLocation(53, 58);
                          CLOSE_CURLY_BRACE10 = (IToken)Match(input, CLOSE_CURLY_BRACE, Follow._CLOSE_CURLY_BRACE_in_nested_property151);
                          stream_CLOSE_CURLY_BRACE.Add(CLOSE_CURLY_BRACE10);



                          {
                              // AST REWRITE
                              // elements: properties, NESTED_PROPERTIES, identifier
                              // token labels:
                              // rule labels: retval
                              // token list labels:
                              // rule list labels:
                              // wildcard labels:
                              retval.Tree = root_0;
                              RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                              root_0 = (object)adaptor.Nil();
                              // 53:76: -> ^( 'nested_property' identifier properties )
                              {
                                  DebugLocation(53, 79);
                                  // ../Grammars/OslcSelect.g:53:79: ^( 'nested_property' identifier properties )
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(53, 82);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(NESTED_PROPERTIES, "NESTED_PROPERTIES"), root_1);

                                      DebugLocation(53, 100);
                                      adaptor.AddChild(root_1, stream_identifier.NextTree());
                                      DebugLocation(53, 111);
                                      adaptor.AddChild(root_1, stream_properties.NextTree());

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      retval.Stop = (IToken)input.LT(-1);

                      retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                      adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("nested_property", 4);
                      LeaveRule("nested_property", 4);
                      LeaveRule_nested_property();
                  }
                  DebugLocation(54, 1); } finally { DebugExitRule(GrammarFileName, "nested_property"); }
            return(retval);
        }
Ejemplo n.º 14
0
        private AstParserRuleReturnScope <object, IToken> properties()
        {
            EnterRule_properties();
            EnterRule("properties", 2);
            TraceIn("properties", 2);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal3 = default(IToken);
            AstParserRuleReturnScope <object, IToken> property2 = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> property4 = default(AstParserRuleReturnScope <object, IToken>);

            object char_literal3_tree                = default(object);
            RewriteRuleITokenStream  stream_COMMA    = new RewriteRuleITokenStream(adaptor, "token COMMA");
            RewriteRuleSubtreeStream stream_property = new RewriteRuleSubtreeStream(adaptor, "rule property");

            try { DebugEnterRule(GrammarFileName, "properties");
                  DebugLocation(47, 1);
                  try
                  {
                      // ../Grammars/OslcSelect.g:47:12: ( property ( ',' property )* -> ^( 'properties' property ( property )* ) )
                      DebugEnterAlt(1);
                      // ../Grammars/OslcSelect.g:47:14: property ( ',' property )*
                      {
                          DebugLocation(47, 14);
                          PushFollow(Follow._property_in_properties88);
                          property2 = property();
                          PopFollow();

                          stream_property.Add(property2.Tree);
                          DebugLocation(47, 24);
                          // ../Grammars/OslcSelect.g:47:24: ( ',' property )*
                          try { DebugEnterSubRule(1);
                                while (true)
                                {
                                    int alt1 = 2;
                                    try { DebugEnterDecision(1, false);
                                          int LA1_1 = input.LA(1);

                                          if ((LA1_1 == COMMA))
                                          {
                                              alt1 = 1;
                                          }
                                    } finally { DebugExitDecision(1); }
                                    switch (alt1)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // ../Grammars/OslcSelect.g:47:26: ',' property
                                        {
                                            DebugLocation(47, 26);
                                            char_literal3 = (IToken)Match(input, COMMA, Follow._COMMA_in_properties93);
                                            stream_COMMA.Add(char_literal3);

                                            DebugLocation(47, 30);
                                            PushFollow(Follow._property_in_properties95);
                                            property4 = property();
                                            PopFollow();

                                            stream_property.Add(property4.Tree);
                                        }
                                        break;

                                    default:
                                        goto loop1;
                                    }
                                }

loop1:
                                ; } finally { DebugExitSubRule(1); }



                          {
                              // AST REWRITE
                              // elements: PROPERTIES, property, property
                              // token labels:
                              // rule labels: retval
                              // token list labels:
                              // rule list labels:
                              // wildcard labels:
                              retval.Tree = root_0;
                              RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                              root_0 = (object)adaptor.Nil();
                              // 47:43: -> ^( 'properties' property ( property )* )
                              {
                                  DebugLocation(47, 46);
                                  // ../Grammars/OslcSelect.g:47:46: ^( 'properties' property ( property )* )
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(47, 49);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(PROPERTIES, "PROPERTIES"), root_1);

                                      DebugLocation(47, 62);
                                      adaptor.AddChild(root_1, stream_property.NextTree());
                                      DebugLocation(47, 71);
                                      // ../Grammars/OslcSelect.g:47:71: ( property )*
                                      while (stream_property.HasNext)
                                      {
                                          DebugLocation(47, 72);
                                          adaptor.AddChild(root_1, stream_property.NextTree());
                                      }
                                      stream_property.Reset();

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      retval.Stop = (IToken)input.LT(-1);

                      retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                      adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("properties", 2);
                      LeaveRule("properties", 2);
                      LeaveRule_properties();
                  }
                  DebugLocation(48, 1); } finally { DebugExitRule(GrammarFileName, "properties"); }
            return(retval);
        }
Ejemplo n.º 15
0
        private AstParserRuleReturnScope <object, IToken> oslc_search_terms()
        {
            EnterRule_oslc_search_terms();
            EnterRule("oslc_search_terms", 1);
            TraceIn("oslc_search_terms", 1);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal2 = default(IToken);
            AstParserRuleReturnScope <object, IToken> string_esc1 = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> string_esc3 = default(AstParserRuleReturnScope <object, IToken>);

            object char_literal2_tree                  = default(object);
            RewriteRuleITokenStream  stream_COMMA      = new RewriteRuleITokenStream(adaptor, "token COMMA");
            RewriteRuleSubtreeStream stream_string_esc = new RewriteRuleSubtreeStream(adaptor, "rule string_esc");

            try { DebugEnterRule(GrammarFileName, "oslc_search_terms");
                  DebugLocation(41, 1);
                  try
                  {
                      // ../Grammars/OslcSearchTerms.g:41:22: ( string_esc ( ',' string_esc )* -> ^( 'string_list' string_esc ( string_esc )* ) )
                      DebugEnterAlt(1);
                      // ../Grammars/OslcSearchTerms.g:41:24: string_esc ( ',' string_esc )*
                      {
                          DebugLocation(41, 24);
                          PushFollow(Follow._string_esc_in_oslc_search_terms60);
                          string_esc1 = string_esc();
                          PopFollow();

                          stream_string_esc.Add(string_esc1.Tree);
                          DebugLocation(41, 35);
                          // ../Grammars/OslcSearchTerms.g:41:35: ( ',' string_esc )*
                          try { DebugEnterSubRule(1);
                                while (true)
                                {
                                    int alt1 = 2;
                                    try { DebugEnterDecision(1, false);
                                          int LA1_1 = input.LA(1);

                                          if ((LA1_1 == COMMA))
                                          {
                                              alt1 = 1;
                                          }
                                    } finally { DebugExitDecision(1); }
                                    switch (alt1)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // ../Grammars/OslcSearchTerms.g:41:37: ',' string_esc
                                        {
                                            DebugLocation(41, 37);
                                            char_literal2 = (IToken)Match(input, COMMA, Follow._COMMA_in_oslc_search_terms64);
                                            stream_COMMA.Add(char_literal2);

                                            DebugLocation(41, 41);
                                            PushFollow(Follow._string_esc_in_oslc_search_terms66);
                                            string_esc3 = string_esc();
                                            PopFollow();

                                            stream_string_esc.Add(string_esc3.Tree);
                                        }
                                        break;

                                    default:
                                        goto loop1;
                                    }
                                }

loop1:
                                ; } finally { DebugExitSubRule(1); }



                          {
                              // AST REWRITE
                              // elements: string_esc, STRING_LIST, string_esc
                              // token labels:
                              // rule labels: retval
                              // token list labels:
                              // rule list labels:
                              // wildcard labels:
                              retval.Tree = root_0;
                              RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                              root_0 = (object)adaptor.Nil();
                              // 41:55: -> ^( 'string_list' string_esc ( string_esc )* )
                              {
                                  DebugLocation(41, 58);
                                  // ../Grammars/OslcSearchTerms.g:41:58: ^( 'string_list' string_esc ( string_esc )* )
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(41, 60);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(STRING_LIST, "STRING_LIST"), root_1);

                                      DebugLocation(41, 74);
                                      adaptor.AddChild(root_1, stream_string_esc.NextTree());
                                      DebugLocation(41, 85);
                                      // ../Grammars/OslcSearchTerms.g:41:85: ( string_esc )*
                                      while (stream_string_esc.HasNext)
                                      {
                                          DebugLocation(41, 86);
                                          adaptor.AddChild(root_1, stream_string_esc.NextTree());
                                      }
                                      stream_string_esc.Reset();

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      retval.Stop = (IToken)input.LT(-1);

                      retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                      adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("oslc_search_terms", 1);
                      LeaveRule("oslc_search_terms", 1);
                      LeaveRule_oslc_search_terms();
                  }
                  DebugLocation(42, 1); } finally { DebugExitRule(GrammarFileName, "oslc_search_terms"); }
            return(retval);
        }
		// $ANTLR start "criteria"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:248:1: criteria : '[' expression ']' -> ^( CRITERIA expression ) ;
		public criteria_return criteria() // throws RecognitionException [1]
		{
			var retval = new criteria_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken char_literal84 = null;
			IToken char_literal86 = null;
			expression_return expression85 = default( expression_return );


			CommonTree char_literal84_tree = null;
			CommonTree char_literal86_tree = null;
			var stream_93 = new RewriteRuleTokenStream( adaptor, "token 93" );
			var stream_92 = new RewriteRuleTokenStream( adaptor, "token 92" );
			var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:249:2: ( '[' expression ']' -> ^( CRITERIA expression ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:249:4: '[' expression ']'
				{
					char_literal84 = (IToken)Match( input, 92, FOLLOW_92_in_criteria1320 );
					stream_92.Add( char_literal84 );

					PushFollow( FOLLOW_expression_in_criteria1322 );
					expression85 = expression();
					state.followingStackPointer--;

					stream_expression.Add( expression85.Tree );
					char_literal86 = (IToken)Match( input, 93, FOLLOW_93_in_criteria1324 );
					stream_93.Add( char_literal86 );


					// AST REWRITE
					// elements:          expression
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 249:23: -> ^( CRITERIA expression )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:249:26: ^( CRITERIA expression )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( CRITERIA, "CRITERIA" ), root_1 );

							adaptor.AddChild( root_1, stream_expression.NextTree() );

							adaptor.AddChild( root_0, root_1 );
						}
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
		// $ANTLR start "identifier"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:262:1: identifier : ID -> ^( IDENTIFIER ID ) ;
		public identifier_return identifier() // throws RecognitionException [1]
		{
			var retval = new identifier_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken ID92 = null;

			CommonTree ID92_tree = null;
			var stream_ID = new RewriteRuleTokenStream( adaptor, "token ID" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:263:2: ( ID -> ^( IDENTIFIER ID ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:263:4: ID
				{
					ID92 = (IToken)Match( input, ID, FOLLOW_ID_in_identifier1399 );
					stream_ID.Add( ID92 );


					// AST REWRITE
					// elements:          ID
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 263:7: -> ^( IDENTIFIER ID )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:263:10: ^( IDENTIFIER ID )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( IDENTIFIER, "IDENTIFIER" ), root_1 );

							adaptor.AddChild( root_1, stream_ID.NextNode() );

							adaptor.AddChild( root_0, root_1 );
						}
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 18
0
        private AstParserRuleReturnScope <object, IToken> sort_terms()
        {
            EnterRule_sort_terms();
            EnterRule("sort_terms", 2);
            TraceIn("sort_terms", 2);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken char_literal3 = default(IToken);
            AstParserRuleReturnScope <object, IToken> sort_term2 = default(AstParserRuleReturnScope <object, IToken>);
            AstParserRuleReturnScope <object, IToken> sort_term4 = default(AstParserRuleReturnScope <object, IToken>);

            object char_literal3_tree                 = default(object);
            RewriteRuleITokenStream  stream_COMMA     = new RewriteRuleITokenStream(adaptor, "token COMMA");
            RewriteRuleSubtreeStream stream_sort_term = new RewriteRuleSubtreeStream(adaptor, "rule sort_term");

            try { DebugEnterRule(GrammarFileName, "sort_terms");
                  DebugLocation(46, 1);
                  try
                  {
                      // ../Grammars/OslcOrderBy.g:46:13: ( sort_term ( ',' sort_term )* -> ^( 'terms' sort_term ( sort_term )* ) )
                      DebugEnterAlt(1);
                      // ../Grammars/OslcOrderBy.g:46:15: sort_term ( ',' sort_term )*
                      {
                          DebugLocation(46, 15);
                          PushFollow(Follow._sort_term_in_sort_terms82);
                          sort_term2 = sort_term();
                          PopFollow();

                          stream_sort_term.Add(sort_term2.Tree);
                          DebugLocation(46, 25);
                          // ../Grammars/OslcOrderBy.g:46:25: ( ',' sort_term )*
                          try { DebugEnterSubRule(1);
                                while (true)
                                {
                                    int alt1 = 2;
                                    try { DebugEnterDecision(1, false);
                                          int LA1_1 = input.LA(1);

                                          if ((LA1_1 == COMMA))
                                          {
                                              alt1 = 1;
                                          }
                                    } finally { DebugExitDecision(1); }
                                    switch (alt1)
                                    {
                                    case 1:
                                        DebugEnterAlt(1);
                                        // ../Grammars/OslcOrderBy.g:46:27: ',' sort_term
                                        {
                                            DebugLocation(46, 27);
                                            char_literal3 = (IToken)Match(input, COMMA, Follow._COMMA_in_sort_terms86);
                                            stream_COMMA.Add(char_literal3);

                                            DebugLocation(46, 31);
                                            PushFollow(Follow._sort_term_in_sort_terms88);
                                            sort_term4 = sort_term();
                                            PopFollow();

                                            stream_sort_term.Add(sort_term4.Tree);
                                        }
                                        break;

                                    default:
                                        goto loop1;
                                    }
                                }

loop1:
                                ; } finally { DebugExitSubRule(1); }



                          {
                              // AST REWRITE
                              // elements: sort_term, sort_term, TERMS
                              // token labels:
                              // rule labels: retval
                              // token list labels:
                              // rule list labels:
                              // wildcard labels:
                              retval.Tree = root_0;
                              RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);

                              root_0 = (object)adaptor.Nil();
                              // 46:45: -> ^( 'terms' sort_term ( sort_term )* )
                              {
                                  DebugLocation(46, 48);
                                  // ../Grammars/OslcOrderBy.g:46:48: ^( 'terms' sort_term ( sort_term )* )
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(46, 51);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(TERMS, "TERMS"), root_1);

                                      DebugLocation(46, 59);
                                      adaptor.AddChild(root_1, stream_sort_term.NextTree());
                                      DebugLocation(46, 69);
                                      // ../Grammars/OslcOrderBy.g:46:69: ( sort_term )*
                                      while (stream_sort_term.HasNext)
                                      {
                                          DebugLocation(46, 70);
                                          adaptor.AddChild(root_1, stream_sort_term.NextTree());
                                      }
                                      stream_sort_term.Reset();

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      retval.Stop = (IToken)input.LT(-1);

                      retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                      adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("sort_terms", 2);
                      LeaveRule("sort_terms", 2);
                      LeaveRule_sort_terms();
                  }
                  DebugLocation(47, 1); } finally { DebugExitRule(GrammarFileName, "sort_terms"); }
            return(retval);
        }
		// $ANTLR start "name"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:92:1: name : x= ID -> NAME[$x] ;
		public name_return name() // throws RecognitionException [1]
		{
			var retval = new name_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_ID = new RewriteRuleTokenStream( adaptor, "token ID" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:93:2: (x= ID -> NAME[$x] )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:93:4: x= ID
				{
					x = (IToken)Match( input, ID, FOLLOW_ID_in_name371 );
					stream_ID.Add( x );


					// AST REWRITE
					// elements:          
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 93:9: -> NAME[$x]
					{
						adaptor.AddChild( root_0, adaptor.Create( NAME, x ) );
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 20
0
	private AstParserRuleReturnScope<CommonTree, IToken> continueStatement()
	{
		EnterRule_continueStatement();
		EnterRule("continueStatement", 51);
		TraceIn("continueStatement", 51);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken CONTINUE170 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree CONTINUE170_tree = default(CommonTree);
		RewriteRuleITokenStream stream_CONTINUE=new RewriteRuleITokenStream(adaptor,"token CONTINUE");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "continueStatement");
		DebugLocation(455, 1);
		try
		{
			// AS3.g:456:2: ( CONTINUE s= semi -> ^( CONTINUE_STATEMENT CONTINUE ) )
			DebugEnterAlt(1);
			// AS3.g:456:4: CONTINUE s= semi
			{
			DebugLocation(456, 4);
			CONTINUE170=(IToken)Match(input,CONTINUE,Follow._CONTINUE_in_continueStatement2462); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_CONTINUE.Add(CONTINUE170);

			DebugLocation(456, 14);
			PushFollow(Follow._semi_in_continueStatement2466);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


			{
			// AST REWRITE
			// elements: CONTINUE
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 457:9: -> ^( CONTINUE_STATEMENT CONTINUE )
			{
				DebugLocation(457, 12);
				// AS3.g:457:12: ^( CONTINUE_STATEMENT CONTINUE )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(457, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(CONTINUE_STATEMENT, "CONTINUE_STATEMENT"), root_1);

				DebugLocation(457, 33);
				adaptor.AddChild(root_1, stream_CONTINUE.NextNode());
				DebugLocation(457, 42);
				adaptor.AddChild(root_1, maybeSemi(s));

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("continueStatement", 51);
			LeaveRule("continueStatement", 51);
			LeaveRule_continueStatement();
		}
		DebugLocation(458, 1);
		} finally { DebugExitRule(GrammarFileName, "continueStatement"); }
		return retval;

	}
Ejemplo n.º 21
0
	private AstParserRuleReturnScope<CommonTree, IToken> typeExpression()
	{
		EnterRule_typeExpression();
		EnterRule("typeExpression", 71);
		TraceIn("typeExpression", 71);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken COLON232 = default(IToken);
		IToken string_literal234 = default(IToken);
		IToken STAR235 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> typeIdentifier233 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree COLON232_tree = default(CommonTree);
		CommonTree string_literal234_tree = default(CommonTree);
		CommonTree STAR235_tree = default(CommonTree);
		RewriteRuleITokenStream stream_COLON=new RewriteRuleITokenStream(adaptor,"token COLON");
		RewriteRuleITokenStream stream_257=new RewriteRuleITokenStream(adaptor,"token 257");
		RewriteRuleITokenStream stream_STAR=new RewriteRuleITokenStream(adaptor,"token STAR");
		RewriteRuleSubtreeStream stream_typeIdentifier=new RewriteRuleSubtreeStream(adaptor,"rule typeIdentifier");
		try { DebugEnterRule(GrammarFileName, "typeExpression");
		DebugLocation(567, 4);
		try
		{
			// AS3.g:568:2: ( COLON ( typeIdentifier | 'void' | STAR ) -> ^( TYPE_SPEC COLON ( typeIdentifier )? ( 'void' )? ( STAR )? ) )
			DebugEnterAlt(1);
			// AS3.g:569:3: COLON ( typeIdentifier | 'void' | STAR )
			{
			DebugLocation(569, 3);
			COLON232=(IToken)Match(input,COLON,Follow._COLON_in_typeExpression3075); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_COLON.Add(COLON232);

			DebugLocation(569, 9);
			// AS3.g:569:9: ( typeIdentifier | 'void' | STAR )
			int alt49=3;
			try { DebugEnterSubRule(49);
			try { DebugEnterDecision(49, false);
			switch (input.LA(1))
			{
			case AS:
			case DYNAMIC:
			case GET:
			case IDENT:
			case IS:
			case NAMESPACE:
			case SET:
			case SUPER:
			case USE:
			case XML:
				{
				alt49 = 1;
				}
				break;
			case 257:
				{
				alt49 = 2;
				}
				break;
			case STAR:
				{
				alt49 = 3;
				}
				break;
			default:
				{
					if (state.backtracking>0) {state.failed=true; return retval;}
					NoViableAltException nvae = new NoViableAltException("", 49, 0, input, 1);
					DebugRecognitionException(nvae);
					throw nvae;
				}
			}

			} finally { DebugExitDecision(49); }
			switch (alt49)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:569:10: typeIdentifier
				{
				DebugLocation(569, 10);
				PushFollow(Follow._typeIdentifier_in_typeExpression3078);
				typeIdentifier233=typeIdentifier();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_typeIdentifier.Add(typeIdentifier233.Tree);

				}
				break;
			case 2:
				DebugEnterAlt(2);
				// AS3.g:569:27: 'void'
				{
				DebugLocation(569, 27);
				string_literal234=(IToken)Match(input,257,Follow._257_in_typeExpression3082); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_257.Add(string_literal234);


				}
				break;
			case 3:
				DebugEnterAlt(3);
				// AS3.g:569:36: STAR
				{
				DebugLocation(569, 36);
				STAR235=(IToken)Match(input,STAR,Follow._STAR_in_typeExpression3086); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_STAR.Add(STAR235);


				}
				break;

			}
			} finally { DebugExitSubRule(49); }



			{
			// AST REWRITE
			// elements: COLON, typeIdentifier, 257, STAR
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 570:3: -> ^( TYPE_SPEC COLON ( typeIdentifier )? ( 'void' )? ( STAR )? )
			{
				DebugLocation(570, 6);
				// AS3.g:570:6: ^( TYPE_SPEC COLON ( typeIdentifier )? ( 'void' )? ( STAR )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(570, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(TYPE_SPEC, "TYPE_SPEC"), root_1);

				DebugLocation(570, 18);
				adaptor.AddChild(root_1, stream_COLON.NextNode());
				DebugLocation(570, 24);
				// AS3.g:570:24: ( typeIdentifier )?
				if (stream_typeIdentifier.HasNext)
				{
					DebugLocation(570, 24);
					adaptor.AddChild(root_1, stream_typeIdentifier.NextTree());

				}
				stream_typeIdentifier.Reset();
				DebugLocation(570, 40);
				// AS3.g:570:40: ( 'void' )?
				if (stream_257.HasNext)
				{
					DebugLocation(570, 40);
					adaptor.AddChild(root_1, stream_257.NextNode());

				}
				stream_257.Reset();
				DebugLocation(570, 48);
				// AS3.g:570:48: ( STAR )?
				if (stream_STAR.HasNext)
				{
					DebugLocation(570, 48);
					adaptor.AddChild(root_1, stream_STAR.NextNode());

				}
				stream_STAR.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("typeExpression", 71);
			LeaveRule("typeExpression", 71);
			LeaveRule_typeExpression();
		}
		DebugLocation(571, 4);
		} finally { DebugExitRule(GrammarFileName, "typeExpression"); }
		return retval;

	}
Ejemplo n.º 22
0
	private AstParserRuleReturnScope<CommonTree, IToken> breakStatement()
	{
		EnterRule_breakStatement();
		EnterRule("breakStatement", 52);
		TraceIn("breakStatement", 52);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken BREAK171 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> s = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree BREAK171_tree = default(CommonTree);
		RewriteRuleITokenStream stream_BREAK=new RewriteRuleITokenStream(adaptor,"token BREAK");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "breakStatement");
		DebugLocation(460, 1);
		try
		{
			// AS3.g:461:2: ( BREAK s= semi -> ^( BREAK_STATEMENT BREAK ) )
			DebugEnterAlt(1);
			// AS3.g:461:4: BREAK s= semi
			{
			DebugLocation(461, 4);
			BREAK171=(IToken)Match(input,BREAK,Follow._BREAK_in_breakStatement2495); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_BREAK.Add(BREAK171);

			DebugLocation(461, 11);
			PushFollow(Follow._semi_in_breakStatement2499);
			s=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(s.Tree);


			{
			// AST REWRITE
			// elements: BREAK
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 462:9: -> ^( BREAK_STATEMENT BREAK )
			{
				DebugLocation(462, 12);
				// AS3.g:462:12: ^( BREAK_STATEMENT BREAK )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(462, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(BREAK_STATEMENT, "BREAK_STATEMENT"), root_1);

				DebugLocation(462, 30);
				adaptor.AddChild(root_1, stream_BREAK.NextNode());
				DebugLocation(462, 36);
				adaptor.AddChild(root_1, maybeSemi(s));

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("breakStatement", 52);
			LeaveRule("breakStatement", 52);
			LeaveRule_breakStatement();
		}
		DebugLocation(463, 1);
		} finally { DebugExitRule(GrammarFileName, "breakStatement"); }
		return retval;

	}
		// $ANTLR start "relationshipJoinDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:116:1: relationshipJoinDeclaration : name 'where' expression -> ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) ) ;
		public relationshipJoinDeclaration_return relationshipJoinDeclaration() // throws RecognitionException [1]
		{
			var retval = new relationshipJoinDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken string_literal31 = null;
			name_return name30 = default( name_return );

			expression_return expression32 = default( expression_return );


			CommonTree string_literal31_tree = null;
			var stream_59 = new RewriteRuleTokenStream( adaptor, "token 59" );
			var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
			var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:2: ( name 'where' expression -> ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:4: name 'where' expression
				{
					PushFollow( FOLLOW_name_in_relationshipJoinDeclaration514 );
					name30 = name();
					state.followingStackPointer--;

					stream_name.Add( name30.Tree );
					string_literal31 = (IToken)Match( input, 59, FOLLOW_59_in_relationshipJoinDeclaration516 );
					stream_59.Add( string_literal31 );

					PushFollow( FOLLOW_expression_in_relationshipJoinDeclaration518 );
					expression32 = expression();
					state.followingStackPointer--;

					stream_expression.Add( expression32.Tree );


					// AST REWRITE
					// elements:          name, expression
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 117:28: -> ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:31: ^( JOIN ^( TARGET name ) ^( CRITERIA expression ) )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( JOIN, "JOIN" ), root_1 );

							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:39: ^( TARGET name )
							{
								var root_2 = (CommonTree)adaptor.GetNilNode();
								root_2 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( TARGET, "TARGET" ), root_2 );

								adaptor.AddChild( root_2, stream_name.NextTree() );

								adaptor.AddChild( root_1, root_2 );
							}
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:117:56: ^( CRITERIA expression )
							{
								var root_2 = (CommonTree)adaptor.GetNilNode();
								root_2 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( CRITERIA, "CRITERIA" ), root_2 );

								adaptor.AddChild( root_2, stream_expression.NextTree() );

								adaptor.AddChild( root_1, root_2 );
							}

							adaptor.AddChild( root_0, root_1 );
						}
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 24
0
	private AstParserRuleReturnScope<CommonTree, IToken> switchStatement()
	{
		EnterRule_switchStatement();
		EnterRule("switchStatement", 53);
		TraceIn("switchStatement", 53);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken SWITCH172 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> condition173 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> switchBlock174 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree SWITCH172_tree = default(CommonTree);
		RewriteRuleITokenStream stream_SWITCH=new RewriteRuleITokenStream(adaptor,"token SWITCH");
		RewriteRuleSubtreeStream stream_condition=new RewriteRuleSubtreeStream(adaptor,"rule condition");
		RewriteRuleSubtreeStream stream_switchBlock=new RewriteRuleSubtreeStream(adaptor,"rule switchBlock");
		try { DebugEnterRule(GrammarFileName, "switchStatement");
		DebugLocation(465, 1);
		try
		{
			// AS3.g:466:2: ( SWITCH condition switchBlock -> ^( SWITCH_STATEMENT SWITCH condition switchBlock ) )
			DebugEnterAlt(1);
			// AS3.g:466:4: SWITCH condition switchBlock
			{
			DebugLocation(466, 4);
			SWITCH172=(IToken)Match(input,SWITCH,Follow._SWITCH_in_switchStatement2528); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_SWITCH.Add(SWITCH172);

			DebugLocation(466, 11);
			PushFollow(Follow._condition_in_switchStatement2530);
			condition173=condition();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_condition.Add(condition173.Tree);
			DebugLocation(467, 3);
			PushFollow(Follow._switchBlock_in_switchStatement2534);
			switchBlock174=switchBlock();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_switchBlock.Add(switchBlock174.Tree);


			{
			// AST REWRITE
			// elements: SWITCH, condition, switchBlock
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 468:9: -> ^( SWITCH_STATEMENT SWITCH condition switchBlock )
			{
				DebugLocation(468, 12);
				// AS3.g:468:12: ^( SWITCH_STATEMENT SWITCH condition switchBlock )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(468, 14);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(SWITCH_STATEMENT, "SWITCH_STATEMENT"), root_1);

				DebugLocation(468, 31);
				adaptor.AddChild(root_1, stream_SWITCH.NextNode());
				DebugLocation(468, 38);
				adaptor.AddChild(root_1, stream_condition.NextTree());
				DebugLocation(468, 48);
				adaptor.AddChild(root_1, stream_switchBlock.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("switchStatement", 53);
			LeaveRule("switchStatement", 53);
			LeaveRule_switchStatement();
		}
		DebugLocation(469, 1);
		} finally { DebugExitRule(GrammarFileName, "switchStatement"); }
		return retval;

	}
		// $ANTLR start "orOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:177:1: orOp : (x= 'or' -> OP_OR[$x] | x= '||' -> OP_OR[$x] );
		public orOp_return orOp() // throws RecognitionException [1]
		{
			var retval = new orOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_73 = new RewriteRuleTokenStream( adaptor, "token 73" );
			var stream_74 = new RewriteRuleTokenStream( adaptor, "token 74" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:178:2: (x= 'or' -> OP_OR[$x] | x= '||' -> OP_OR[$x] )
				int alt23 = 2;
				int LA23_0 = input.LA( 1 );

				if ( ( LA23_0 == 73 ) )
					alt23 = 1;
				else if ( ( LA23_0 == 74 ) )
					alt23 = 2;
				else
				{
					var nvae_d23s0 =
							new NoViableAltException( "", 23, 0, input );

					throw nvae_d23s0;
				}
				switch ( alt23 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:178:4: x= 'or'
						{
							x = (IToken)Match( input, 73, FOLLOW_73_in_orOp898 );
							stream_73.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 178:11: -> OP_OR[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_OR, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:179:4: x= '||'
						{
							x = (IToken)Match( input, 74, FOLLOW_74_in_orOp910 );
							stream_74.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 179:11: -> OP_OR[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_OR, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 26
0
	private AstParserRuleReturnScope<CommonTree, IToken> switchBlock()
	{
		EnterRule_switchBlock();
		EnterRule("switchBlock", 54);
		TraceIn("switchBlock", 54);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken LCURLY175 = default(IToken);
		IToken RCURLY178 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> caseStatement176 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> defaultStatement177 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree LCURLY175_tree = default(CommonTree);
		CommonTree RCURLY178_tree = default(CommonTree);
		RewriteRuleITokenStream stream_LCURLY=new RewriteRuleITokenStream(adaptor,"token LCURLY");
		RewriteRuleITokenStream stream_RCURLY=new RewriteRuleITokenStream(adaptor,"token RCURLY");
		RewriteRuleSubtreeStream stream_caseStatement=new RewriteRuleSubtreeStream(adaptor,"rule caseStatement");
		RewriteRuleSubtreeStream stream_defaultStatement=new RewriteRuleSubtreeStream(adaptor,"rule defaultStatement");
		try { DebugEnterRule(GrammarFileName, "switchBlock");
		DebugLocation(471, 1);
		try
		{
			// AS3.g:472:2: ( LCURLY ( caseStatement )* ( defaultStatement )? RCURLY -> ^( BLOCK ( caseStatement )* ( defaultStatement )? ) )
			DebugEnterAlt(1);
			// AS3.g:472:4: LCURLY ( caseStatement )* ( defaultStatement )? RCURLY
			{
			DebugLocation(472, 4);
			LCURLY175=(IToken)Match(input,LCURLY,Follow._LCURLY_in_switchBlock2565); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LCURLY.Add(LCURLY175);

			DebugLocation(473, 3);
			// AS3.g:473:3: ( caseStatement )*
			try { DebugEnterSubRule(40);
			while (true)
			{
				int alt40=2;
				try { DebugEnterDecision(40, false);
				int LA40_1 = input.LA(1);

				if ((LA40_1==CASE))
				{
					alt40 = 1;
				}


				} finally { DebugExitDecision(40); }
				switch ( alt40 )
				{
				case 1:
					DebugEnterAlt(1);
					// AS3.g:473:4: caseStatement
					{
					DebugLocation(473, 4);
					PushFollow(Follow._caseStatement_in_switchBlock2570);
					caseStatement176=caseStatement();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_caseStatement.Add(caseStatement176.Tree);

					}
					break;

				default:
					goto loop40;
				}
			}

			loop40:
				;

			} finally { DebugExitSubRule(40); }

			DebugLocation(474, 3);
			// AS3.g:474:3: ( defaultStatement )?
			int alt41=2;
			try { DebugEnterSubRule(41);
			try { DebugEnterDecision(41, false);
			int LA41_1 = input.LA(1);

			if ((LA41_1==DEFAULT))
			{
				alt41 = 1;
			}
			} finally { DebugExitDecision(41); }
			switch (alt41)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:474:4: defaultStatement
				{
				DebugLocation(474, 4);
				PushFollow(Follow._defaultStatement_in_switchBlock2577);
				defaultStatement177=defaultStatement();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_defaultStatement.Add(defaultStatement177.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(41); }

			DebugLocation(475, 3);
			RCURLY178=(IToken)Match(input,RCURLY,Follow._RCURLY_in_switchBlock2583); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RCURLY.Add(RCURLY178);



			{
			// AST REWRITE
			// elements: caseStatement, defaultStatement
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 476:3: -> ^( BLOCK ( caseStatement )* ( defaultStatement )? )
			{
				DebugLocation(476, 6);
				// AS3.g:476:6: ^( BLOCK ( caseStatement )* ( defaultStatement )? )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(476, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(BLOCK, "BLOCK"), root_1);

				DebugLocation(476, 14);
				// AS3.g:476:14: ( caseStatement )*
				while ( stream_caseStatement.HasNext )
				{
					DebugLocation(476, 14);
					adaptor.AddChild(root_1, stream_caseStatement.NextTree());

				}
				stream_caseStatement.Reset();
				DebugLocation(476, 29);
				// AS3.g:476:29: ( defaultStatement )?
				if (stream_defaultStatement.HasNext)
				{
					DebugLocation(476, 29);
					adaptor.AddChild(root_1, stream_defaultStatement.NextTree());

				}
				stream_defaultStatement.Reset();

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("switchBlock", 54);
			LeaveRule("switchBlock", 54);
			LeaveRule_switchBlock();
		}
		DebugLocation(477, 1);
		} finally { DebugExitRule(GrammarFileName, "switchBlock"); }
		return retval;

	}
		// $ANTLR start "modulusOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:185:1: modulusOp : (x= 'mod' -> OP_MODULUS[$x] | x= '%' -> OP_MODULUS[$x] );
		public modulusOp_return modulusOp() // throws RecognitionException [1]
		{
			var retval = new modulusOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_78 = new RewriteRuleTokenStream( adaptor, "token 78" );
			var stream_77 = new RewriteRuleTokenStream( adaptor, "token 77" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:186:2: (x= 'mod' -> OP_MODULUS[$x] | x= '%' -> OP_MODULUS[$x] )
				int alt25 = 2;
				int LA25_0 = input.LA( 1 );

				if ( ( LA25_0 == 77 ) )
					alt25 = 1;
				else if ( ( LA25_0 == 78 ) )
					alt25 = 2;
				else
				{
					var nvae_d25s0 =
							new NoViableAltException( "", 25, 0, input );

					throw nvae_d25s0;
				}
				switch ( alt25 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:186:4: x= 'mod'
						{
							x = (IToken)Match( input, 77, FOLLOW_77_in_modulusOp957 );
							stream_77.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 186:12: -> OP_MODULUS[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_MODULUS, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:187:4: x= '%'
						{
							x = (IToken)Match( input, 78, FOLLOW_78_in_modulusOp969 );
							stream_78.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 187:12: -> OP_MODULUS[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_MODULUS, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 28
0
	private AstParserRuleReturnScope<CommonTree, IToken> forEachStatement()
	{
		EnterRule_forEachStatement();
		EnterRule("forEachStatement", 58);
		TraceIn("forEachStatement", 58);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken f = default(IToken);
		IToken EACH185 = default(IToken);
		IToken LPAREN186 = default(IToken);
		IToken RPAREN188 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> forInClause187 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> statement189 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree f_tree = default(CommonTree);
		CommonTree EACH185_tree = default(CommonTree);
		CommonTree LPAREN186_tree = default(CommonTree);
		CommonTree RPAREN188_tree = default(CommonTree);
		RewriteRuleITokenStream stream_FOR=new RewriteRuleITokenStream(adaptor,"token FOR");
		RewriteRuleITokenStream stream_EACH=new RewriteRuleITokenStream(adaptor,"token EACH");
		RewriteRuleITokenStream stream_LPAREN=new RewriteRuleITokenStream(adaptor,"token LPAREN");
		RewriteRuleITokenStream stream_RPAREN=new RewriteRuleITokenStream(adaptor,"token RPAREN");
		RewriteRuleSubtreeStream stream_forInClause=new RewriteRuleSubtreeStream(adaptor,"rule forInClause");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		try { DebugEnterRule(GrammarFileName, "forEachStatement");
		DebugLocation(491, 1);
		try
		{
			// AS3.g:492:2: (f= FOR EACH LPAREN forInClause RPAREN statement -> ^( FOR_EACH_LOOP $f forInClause statement ) )
			DebugEnterAlt(1);
			// AS3.g:492:4: f= FOR EACH LPAREN forInClause RPAREN statement
			{
			DebugLocation(492, 5);
			f=(IToken)Match(input,FOR,Follow._FOR_in_forEachStatement2672); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_FOR.Add(f);

			DebugLocation(492, 10);
			EACH185=(IToken)Match(input,EACH,Follow._EACH_in_forEachStatement2674); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_EACH.Add(EACH185);

			DebugLocation(493, 3);
			LPAREN186=(IToken)Match(input,LPAREN,Follow._LPAREN_in_forEachStatement2678); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LPAREN.Add(LPAREN186);

			DebugLocation(494, 3);
			PushFollow(Follow._forInClause_in_forEachStatement2682);
			forInClause187=forInClause();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_forInClause.Add(forInClause187.Tree);
			DebugLocation(495, 3);
			RPAREN188=(IToken)Match(input,RPAREN,Follow._RPAREN_in_forEachStatement2686); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RPAREN.Add(RPAREN188);

			DebugLocation(496, 3);
			PushFollow(Follow._statement_in_forEachStatement2690);
			statement189=statement();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_statement.Add(statement189.Tree);


			{
			// AST REWRITE
			// elements: f, forInClause, statement
			// token labels: f
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleITokenStream stream_f=new RewriteRuleITokenStream(adaptor,"token f",f);
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 497:3: -> ^( FOR_EACH_LOOP $f forInClause statement )
			{
				DebugLocation(497, 6);
				// AS3.g:497:6: ^( FOR_EACH_LOOP $f forInClause statement )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(497, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FOR_EACH_LOOP, "FOR_EACH_LOOP"), root_1);

				DebugLocation(497, 23);
				adaptor.AddChild(root_1, stream_f.NextNode());
				DebugLocation(497, 25);
				adaptor.AddChild(root_1, stream_forInClause.NextTree());
				DebugLocation(497, 37);
				adaptor.AddChild(root_1, stream_statement.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("forEachStatement", 58);
			LeaveRule("forEachStatement", 58);
			LeaveRule_forEachStatement();
		}
		DebugLocation(498, 1);
		} finally { DebugExitRule(GrammarFileName, "forEachStatement"); }
		return retval;

	}
		// $ANTLR start "notEqualsOp"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:193:1: notEqualsOp : (x= '!=' -> OP_NE[$x] | x= '<>' -> OP_NE[$x] );
		public notEqualsOp_return notEqualsOp() // throws RecognitionException [1]
		{
			var retval = new notEqualsOp_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_80 = new RewriteRuleTokenStream( adaptor, "token 80" );
			var stream_81 = new RewriteRuleTokenStream( adaptor, "token 81" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:194:2: (x= '!=' -> OP_NE[$x] | x= '<>' -> OP_NE[$x] )
				int alt27 = 2;
				int LA27_0 = input.LA( 1 );

				if ( ( LA27_0 == 80 ) )
					alt27 = 1;
				else if ( ( LA27_0 == 81 ) )
					alt27 = 2;
				else
				{
					var nvae_d27s0 =
							new NoViableAltException( "", 27, 0, input );

					throw nvae_d27s0;
				}
				switch ( alt27 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:194:4: x= '!='
						{
							x = (IToken)Match( input, 80, FOLLOW_80_in_notEqualsOp1019 );
							stream_80.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 194:11: -> OP_NE[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_NE, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:195:4: x= '<>'
						{
							x = (IToken)Match( input, 81, FOLLOW_81_in_notEqualsOp1031 );
							stream_81.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 195:11: -> OP_NE[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( OP_NE, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 30
0
	private AstParserRuleReturnScope<CommonTree, IToken> forStatement()
	{
		EnterRule_forStatement();
		EnterRule("forStatement", 59);
		TraceIn("forStatement", 59);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken FOR190 = default(IToken);
		IToken LPAREN191 = default(IToken);
		IToken RPAREN193 = default(IToken);
		IToken RPAREN196 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> forInClause192 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> statement194 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> traditionalForClause195 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> statement197 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree FOR190_tree = default(CommonTree);
		CommonTree LPAREN191_tree = default(CommonTree);
		CommonTree RPAREN193_tree = default(CommonTree);
		CommonTree RPAREN196_tree = default(CommonTree);
		RewriteRuleITokenStream stream_FOR=new RewriteRuleITokenStream(adaptor,"token FOR");
		RewriteRuleITokenStream stream_LPAREN=new RewriteRuleITokenStream(adaptor,"token LPAREN");
		RewriteRuleITokenStream stream_RPAREN=new RewriteRuleITokenStream(adaptor,"token RPAREN");
		RewriteRuleSubtreeStream stream_forInClause=new RewriteRuleSubtreeStream(adaptor,"rule forInClause");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		RewriteRuleSubtreeStream stream_traditionalForClause=new RewriteRuleSubtreeStream(adaptor,"rule traditionalForClause");
		try { DebugEnterRule(GrammarFileName, "forStatement");
		DebugLocation(500, 1);
		try
		{
			// AS3.g:502:2: ( FOR LPAREN ( forInClause RPAREN statement -> ^( FOR_IN_LOOP FOR LPAREN forInClause RPAREN statement ) | traditionalForClause RPAREN statement -> ^( FOR_LOOP FOR LPAREN traditionalForClause RPAREN statement ) ) )
			DebugEnterAlt(1);
			// AS3.g:502:4: FOR LPAREN ( forInClause RPAREN statement -> ^( FOR_IN_LOOP FOR LPAREN forInClause RPAREN statement ) | traditionalForClause RPAREN statement -> ^( FOR_LOOP FOR LPAREN traditionalForClause RPAREN statement ) )
			{
			DebugLocation(502, 4);
			FOR190=(IToken)Match(input,FOR,Follow._FOR_in_forStatement2717); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_FOR.Add(FOR190);

			DebugLocation(503, 3);
			LPAREN191=(IToken)Match(input,LPAREN,Follow._LPAREN_in_forStatement2721); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LPAREN.Add(LPAREN191);

			DebugLocation(504, 3);
			// AS3.g:504:3: ( forInClause RPAREN statement -> ^( FOR_IN_LOOP FOR LPAREN forInClause RPAREN statement ) | traditionalForClause RPAREN statement -> ^( FOR_LOOP FOR LPAREN traditionalForClause RPAREN statement ) )
			int alt43=2;
			try { DebugEnterSubRule(43);
			try { DebugEnterDecision(43, false);
			try
			{
				alt43 = dfa43.Predict(input);
			}
			catch (NoViableAltException nvae)
			{
				DebugRecognitionException(nvae);
				throw;
			}
			} finally { DebugExitDecision(43); }
			switch (alt43)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:504:5: forInClause RPAREN statement
				{
				DebugLocation(504, 5);
				PushFollow(Follow._forInClause_in_forStatement2727);
				forInClause192=forInClause();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_forInClause.Add(forInClause192.Tree);
				DebugLocation(504, 17);
				RPAREN193=(IToken)Match(input,RPAREN,Follow._RPAREN_in_forStatement2729); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_RPAREN.Add(RPAREN193);

				DebugLocation(504, 24);
				PushFollow(Follow._statement_in_forStatement2731);
				statement194=statement();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_statement.Add(statement194.Tree);


				{
				// AST REWRITE
				// elements: FOR, LPAREN, forInClause, RPAREN, statement
				// token labels: 
				// rule labels: retval
				// token list labels: 
				// rule list labels: 
				// wildcard labels: 
				if (state.backtracking == 0) {
				retval.Tree = root_0;
				RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

				root_0 = (CommonTree)adaptor.Nil();
				// 505:4: -> ^( FOR_IN_LOOP FOR LPAREN forInClause RPAREN statement )
				{
					DebugLocation(505, 7);
					// AS3.g:505:7: ^( FOR_IN_LOOP FOR LPAREN forInClause RPAREN statement )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(505, 9);
					root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FOR_IN_LOOP, "FOR_IN_LOOP"), root_1);

					DebugLocation(505, 21);
					adaptor.AddChild(root_1, stream_FOR.NextNode());
					DebugLocation(505, 25);
					adaptor.AddChild(root_1, stream_LPAREN.NextNode());
					DebugLocation(505, 32);
					adaptor.AddChild(root_1, stream_forInClause.NextTree());
					DebugLocation(505, 44);
					adaptor.AddChild(root_1, stream_RPAREN.NextNode());
					DebugLocation(505, 51);
					adaptor.AddChild(root_1, stream_statement.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;
			case 2:
				DebugEnterAlt(2);
				// AS3.g:507:5: traditionalForClause RPAREN statement
				{
				DebugLocation(507, 5);
				PushFollow(Follow._traditionalForClause_in_forStatement2757);
				traditionalForClause195=traditionalForClause();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_traditionalForClause.Add(traditionalForClause195.Tree);
				DebugLocation(507, 26);
				RPAREN196=(IToken)Match(input,RPAREN,Follow._RPAREN_in_forStatement2759); if (state.failed) return retval; 
				if (state.backtracking == 0) stream_RPAREN.Add(RPAREN196);

				DebugLocation(507, 33);
				PushFollow(Follow._statement_in_forStatement2761);
				statement197=statement();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_statement.Add(statement197.Tree);


				{
				// AST REWRITE
				// elements: FOR, LPAREN, traditionalForClause, RPAREN, statement
				// token labels: 
				// rule labels: retval
				// token list labels: 
				// rule list labels: 
				// wildcard labels: 
				if (state.backtracking == 0) {
				retval.Tree = root_0;
				RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

				root_0 = (CommonTree)adaptor.Nil();
				// 508:4: -> ^( FOR_LOOP FOR LPAREN traditionalForClause RPAREN statement )
				{
					DebugLocation(508, 7);
					// AS3.g:508:7: ^( FOR_LOOP FOR LPAREN traditionalForClause RPAREN statement )
					{
					CommonTree root_1 = (CommonTree)adaptor.Nil();
					DebugLocation(508, 9);
					root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(FOR_LOOP, "FOR_LOOP"), root_1);

					DebugLocation(508, 18);
					adaptor.AddChild(root_1, stream_FOR.NextNode());
					DebugLocation(508, 22);
					adaptor.AddChild(root_1, stream_LPAREN.NextNode());
					DebugLocation(508, 29);
					adaptor.AddChild(root_1, stream_traditionalForClause.NextTree());
					DebugLocation(508, 50);
					adaptor.AddChild(root_1, stream_RPAREN.NextNode());
					DebugLocation(508, 57);
					adaptor.AddChild(root_1, stream_statement.NextTree());

					adaptor.AddChild(root_0, root_1);
					}

				}

				retval.Tree = root_0;
				}
				}

				}
				break;

			}
			} finally { DebugExitSubRule(43); }


			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("forStatement", 59);
			LeaveRule("forStatement", 59);
			LeaveRule_forStatement();
		}
		DebugLocation(510, 1);
		} finally { DebugExitRule(GrammarFileName, "forStatement"); }
		return retval;

	}
		// $ANTLR start "classDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:79:1: classDeclaration : 'class' name ( baseClassDeclaration )? classStatementBlock -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) ;
		public classDeclaration_return classDeclaration() // throws RecognitionException [1]
		{
			var retval = new classDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken string_literal4 = null;
			name_return name5 = default( name_return );

			baseClassDeclaration_return baseClassDeclaration6 = default( baseClassDeclaration_return );

			classStatementBlock_return classStatementBlock7 = default( classStatementBlock_return );


			CommonTree string_literal4_tree = null;
			var stream_57 = new RewriteRuleTokenStream( adaptor, "token 57" );
			var stream_classStatementBlock = new RewriteRuleSubtreeStream( adaptor, "rule classStatementBlock" );
			var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
			var stream_baseClassDeclaration = new RewriteRuleSubtreeStream( adaptor, "rule baseClassDeclaration" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:2: ( 'class' name ( baseClassDeclaration )? classStatementBlock -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:4: 'class' name ( baseClassDeclaration )? classStatementBlock
				{
					string_literal4 = (IToken)Match( input, 57, FOLLOW_57_in_classDeclaration262 );
					stream_57.Add( string_literal4 );

					PushFollow( FOLLOW_name_in_classDeclaration264 );
					name5 = name();
					state.followingStackPointer--;

					stream_name.Add( name5.Tree );
					// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:17: ( baseClassDeclaration )?
					int alt3 = 2;
					int LA3_0 = input.LA( 1 );

					if ( ( LA3_0 == 58 ) )
						alt3 = 1;
					switch ( alt3 )
					{
						case 1:
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:17: baseClassDeclaration
							{
								PushFollow( FOLLOW_baseClassDeclaration_in_classDeclaration266 );
								baseClassDeclaration6 = baseClassDeclaration();
								state.followingStackPointer--;

								stream_baseClassDeclaration.Add( baseClassDeclaration6.Tree );
							}
							break;
					}

					PushFollow( FOLLOW_classStatementBlock_in_classDeclaration269 );
					classStatementBlock7 = classStatementBlock();
					state.followingStackPointer--;

					stream_classStatementBlock.Add( classStatementBlock7.Tree );


					// AST REWRITE
					// elements:          name, classStatementBlock, baseClassDeclaration
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 80:59: -> ^( CLASS name ( baseClassDeclaration )? classStatementBlock )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:62: ^( CLASS name ( baseClassDeclaration )? classStatementBlock )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( CLASS, "CLASS" ), root_1 );

							adaptor.AddChild( root_1, stream_name.NextTree() );
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:80:76: ( baseClassDeclaration )?
							if ( stream_baseClassDeclaration.HasNext() )
								adaptor.AddChild( root_1, stream_baseClassDeclaration.NextTree() );
							stream_baseClassDeclaration.Reset();
							adaptor.AddChild( root_1, stream_classStatementBlock.NextTree() );

							adaptor.AddChild( root_0, root_1 );
						}
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 32
0
	private AstParserRuleReturnScope<CommonTree, IToken> packageDecl()
	{
		EnterRule_packageDecl();
		EnterRule("packageDecl", 5);
		TraceIn("packageDecl", 5);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken PACKAGE11 = default(IToken);
		IToken LCURLY13 = default(IToken);
		IToken RCURLY15 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> identifierStar12 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> packageBlockEntry14 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree PACKAGE11_tree = default(CommonTree);
		CommonTree LCURLY13_tree = default(CommonTree);
		CommonTree RCURLY15_tree = default(CommonTree);
		RewriteRuleITokenStream stream_PACKAGE=new RewriteRuleITokenStream(adaptor,"token PACKAGE");
		RewriteRuleITokenStream stream_LCURLY=new RewriteRuleITokenStream(adaptor,"token LCURLY");
		RewriteRuleITokenStream stream_RCURLY=new RewriteRuleITokenStream(adaptor,"token RCURLY");
		RewriteRuleSubtreeStream stream_identifierStar=new RewriteRuleSubtreeStream(adaptor,"rule identifierStar");
		RewriteRuleSubtreeStream stream_packageBlockEntry=new RewriteRuleSubtreeStream(adaptor,"rule packageBlockEntry");
		try { DebugEnterRule(GrammarFileName, "packageDecl");
		DebugLocation(139, 1);
		try
		{
			// AS3.g:140:2: ( PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY -> ^( PACKAGE_DECL PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY ) )
			DebugEnterAlt(1);
			// AS3.g:140:4: PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY
			{
			DebugLocation(140, 4);
			PACKAGE11=(IToken)Match(input,PACKAGE,Follow._PACKAGE_in_packageDecl590); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_PACKAGE.Add(PACKAGE11);

			DebugLocation(140, 12);
			// AS3.g:140:12: ( identifierStar )?
			int alt5=2;
			try { DebugEnterSubRule(5);
			try { DebugEnterDecision(5, false);
			int LA5_1 = input.LA(1);

			if ((LA5_1==AS||LA5_1==DYNAMIC||LA5_1==GET||LA5_1==IDENT||LA5_1==IS||LA5_1==NAMESPACE||LA5_1==SET||LA5_1==SUPER||LA5_1==USE||LA5_1==XML))
			{
				alt5 = 1;
			}
			} finally { DebugExitDecision(5); }
			switch (alt5)
			{
			case 1:
				DebugEnterAlt(1);
				// AS3.g:140:12: identifierStar
				{
				DebugLocation(140, 12);
				PushFollow(Follow._identifierStar_in_packageDecl592);
				identifierStar12=identifierStar();
				PopFollow();
				if (state.failed) return retval;
				if (state.backtracking == 0) stream_identifierStar.Add(identifierStar12.Tree);

				}
				break;

			}
			} finally { DebugExitSubRule(5); }

			DebugLocation(141, 3);
			LCURLY13=(IToken)Match(input,LCURLY,Follow._LCURLY_in_packageDecl597); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_LCURLY.Add(LCURLY13);

			DebugLocation(142, 9);
			// AS3.g:142:9: ( packageBlockEntry )*
			try { DebugEnterSubRule(6);
			while (true)
			{
				int alt6=2;
				try { DebugEnterDecision(6, false);
				int LA6_1 = input.LA(1);

				if ((LA6_1==AS||LA6_1==BNOT||LA6_1==BREAK||LA6_1==CLASS||LA6_1==CONST||LA6_1==CONTINUE||(LA6_1>=DEC && LA6_1<=DECIMAL_LITERAL)||LA6_1==DEFAULT||LA6_1==DO||(LA6_1>=DYNAMIC && LA6_1<=E4X_ATTRI)||(LA6_1>=FALSE && LA6_1<=FOR)||LA6_1==FUNCTION||LA6_1==GET||(LA6_1>=HEX_LITERAL && LA6_1<=IDENT)||LA6_1==IF||LA6_1==IMPORT||LA6_1==INC||LA6_1==INTERFACE||(LA6_1>=INTERNAL && LA6_1<=IS)||(LA6_1>=LBRACK && LA6_1<=LCURLY)||LA6_1==LNOT||LA6_1==LPAREN||LA6_1==MINUS||LA6_1==NAMESPACE||LA6_1==NEW||LA6_1==NULL||LA6_1==OCTAL_LITERAL||LA6_1==PLUS||LA6_1==PRIVATE||(LA6_1>=PROTECTED && LA6_1<=PUBLIC)||LA6_1==REGEX_LITERAL||LA6_1==RETURN||(LA6_1>=SEMI && LA6_1<=SET)||LA6_1==STATIC||(LA6_1>=STRING_LITERAL_DOUBLE && LA6_1<=SWITCH)||LA6_1==TRUE||(LA6_1>=USE && LA6_1<=VAR)||LA6_1==WHILE||LA6_1==WITH||LA6_1==XML||LA6_1==XML_LITERAL||(LA6_1>=243 && LA6_1<=246)||LA6_1==248||LA6_1==250||(LA6_1>=252 && LA6_1<=257)))
				{
					alt6 = 1;
				}


				} finally { DebugExitDecision(6); }
				switch ( alt6 )
				{
				case 1:
					DebugEnterAlt(1);
					// AS3.g:142:9: packageBlockEntry
					{
					DebugLocation(142, 9);
					PushFollow(Follow._packageBlockEntry_in_packageDecl608);
					packageBlockEntry14=packageBlockEntry();
					PopFollow();
					if (state.failed) return retval;
					if (state.backtracking == 0) stream_packageBlockEntry.Add(packageBlockEntry14.Tree);

					}
					break;

				default:
					goto loop6;
				}
			}

			loop6:
				;

			} finally { DebugExitSubRule(6); }

			DebugLocation(143, 3);
			RCURLY15=(IToken)Match(input,RCURLY,Follow._RCURLY_in_packageDecl613); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_RCURLY.Add(RCURLY15);



			{
			// AST REWRITE
			// elements: PACKAGE, identifierStar, LCURLY, packageBlockEntry, RCURLY
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 144:3: -> ^( PACKAGE_DECL PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY )
			{
				DebugLocation(144, 6);
				// AS3.g:144:6: ^( PACKAGE_DECL PACKAGE ( identifierStar )? LCURLY ( packageBlockEntry )* RCURLY )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(144, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(PACKAGE_DECL, "PACKAGE_DECL"), root_1);

				DebugLocation(144, 21);
				adaptor.AddChild(root_1, stream_PACKAGE.NextNode());
				DebugLocation(144, 29);
				// AS3.g:144:29: ( identifierStar )?
				if (stream_identifierStar.HasNext)
				{
					DebugLocation(144, 29);
					adaptor.AddChild(root_1, stream_identifierStar.NextTree());

				}
				stream_identifierStar.Reset();
				DebugLocation(144, 45);
				adaptor.AddChild(root_1, stream_LCURLY.NextNode());
				DebugLocation(144, 52);
				// AS3.g:144:52: ( packageBlockEntry )*
				while ( stream_packageBlockEntry.HasNext )
				{
					DebugLocation(144, 52);
					adaptor.AddChild(root_1, stream_packageBlockEntry.NextTree());

				}
				stream_packageBlockEntry.Reset();
				DebugLocation(144, 71);
				adaptor.AddChild(root_1, stream_RCURLY.NextNode());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("packageDecl", 5);
			LeaveRule("packageDecl", 5);
			LeaveRule_packageDecl();
		}
		DebugLocation(145, 1);
		} finally { DebugExitRule(GrammarFileName, "packageDecl"); }
		return retval;

	}
		// $ANTLR start "functionCall"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:255:1: functionCall : x= ID '(' ( expression ( ',' expression )* )? ')' -> ^( FUNCTION[$x] ( expression )* ) ;
		public functionCall_return functionCall() // throws RecognitionException [1]
		{
			var retval = new functionCall_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;
			IToken char_literal87 = null;
			IToken char_literal89 = null;
			IToken char_literal91 = null;
			expression_return expression88 = default( expression_return );

			expression_return expression90 = default( expression_return );


			CommonTree x_tree = null;
			CommonTree char_literal87_tree = null;
			CommonTree char_literal89_tree = null;
			CommonTree char_literal91_tree = null;
			var stream_69 = new RewriteRuleTokenStream( adaptor, "token 69" );
			var stream_94 = new RewriteRuleTokenStream( adaptor, "token 94" );
			var stream_ID = new RewriteRuleTokenStream( adaptor, "token ID" );
			var stream_70 = new RewriteRuleTokenStream( adaptor, "token 70" );
			var stream_expression = new RewriteRuleSubtreeStream( adaptor, "rule expression" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:2: (x= ID '(' ( expression ( ',' expression )* )? ')' -> ^( FUNCTION[$x] ( expression )* ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:4: x= ID '(' ( expression ( ',' expression )* )? ')'
				{
					x = (IToken)Match( input, ID, FOLLOW_ID_in_functionCall1352 );
					stream_ID.Add( x );

					char_literal87 = (IToken)Match( input, 69, FOLLOW_69_in_functionCall1354 );
					stream_69.Add( char_literal87 );

					// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:13: ( expression ( ',' expression )* )?
					int alt33 = 2;
					int LA33_0 = input.LA( 1 );

					if ( ( ( LA33_0 >= ID && LA33_0 <= FLOAT ) || LA33_0 == 69 || ( LA33_0 >= 71 && LA33_0 <= 72 ) || LA33_0 == 87 || LA33_0 == 91 || ( LA33_0 >= 95 && LA33_0 <= 96 ) ) )
						alt33 = 1;
					switch ( alt33 )
					{
						case 1:
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:15: expression ( ',' expression )*
							{
								PushFollow( FOLLOW_expression_in_functionCall1358 );
								expression88 = expression();
								state.followingStackPointer--;

								stream_expression.Add( expression88.Tree );
								// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:26: ( ',' expression )*
								do
								{
									int alt32 = 2;
									int LA32_0 = input.LA( 1 );

									if ( ( LA32_0 == 94 ) )
										alt32 = 1;


									switch ( alt32 )
									{
										case 1:
											// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:28: ',' expression
											{
												char_literal89 = (IToken)Match( input, 94, FOLLOW_94_in_functionCall1362 );
												stream_94.Add( char_literal89 );

												PushFollow( FOLLOW_expression_in_functionCall1364 );
												expression90 = expression();
												state.followingStackPointer--;

												stream_expression.Add( expression90.Tree );
											}
											break;

										default:
											goto loop32;
									}
								} while ( true );

								loop32:
								; // Stops C# compiler whining that label 'loop32' has no statements
							}
							break;
					}

					char_literal91 = (IToken)Match( input, 70, FOLLOW_70_in_functionCall1372 );
					stream_70.Add( char_literal91 );


					// AST REWRITE
					// elements:          expression
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 256:53: -> ^( FUNCTION[$x] ( expression )* )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:56: ^( FUNCTION[$x] ( expression )* )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( FUNCTION, x ), root_1 );

							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:256:72: ( expression )*
							while ( stream_expression.HasNext() )
								adaptor.AddChild( root_1, stream_expression.NextTree() );
							stream_expression.Reset();

							adaptor.AddChild( root_0, root_1 );
						}
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 34
0
	private AstParserRuleReturnScope<CommonTree, IToken> whileStatement()
	{
		EnterRule_whileStatement();
		EnterRule("whileStatement", 67);
		TraceIn("whileStatement", 67);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken WHILE215 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> condition216 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> statement217 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree WHILE215_tree = default(CommonTree);
		RewriteRuleITokenStream stream_WHILE=new RewriteRuleITokenStream(adaptor,"token WHILE");
		RewriteRuleSubtreeStream stream_condition=new RewriteRuleSubtreeStream(adaptor,"rule condition");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		try { DebugEnterRule(GrammarFileName, "whileStatement");
		DebugLocation(548, 1);
		try
		{
			// AS3.g:549:2: ( WHILE condition statement -> ^( WHILE_LOOP condition statement ) )
			DebugEnterAlt(1);
			// AS3.g:549:4: WHILE condition statement
			{
			DebugLocation(549, 4);
			WHILE215=(IToken)Match(input,WHILE,Follow._WHILE_in_whileStatement2962); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_WHILE.Add(WHILE215);

			DebugLocation(549, 10);
			PushFollow(Follow._condition_in_whileStatement2964);
			condition216=condition();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_condition.Add(condition216.Tree);
			DebugLocation(549, 20);
			PushFollow(Follow._statement_in_whileStatement2966);
			statement217=statement();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_statement.Add(statement217.Tree);


			{
			// AST REWRITE
			// elements: condition, statement
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 550:3: -> ^( WHILE_LOOP condition statement )
			{
				DebugLocation(550, 6);
				// AS3.g:550:6: ^( WHILE_LOOP condition statement )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(550, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(WHILE_LOOP, "WHILE_LOOP"), root_1);

				DebugLocation(550, 19);
				adaptor.AddChild(root_1, stream_condition.NextTree());
				DebugLocation(550, 29);
				adaptor.AddChild(root_1, stream_statement.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("whileStatement", 67);
			LeaveRule("whileStatement", 67);
			LeaveRule_whileStatement();
		}
		DebugLocation(551, 1);
		} finally { DebugExitRule(GrammarFileName, "whileStatement"); }
		return retval;

	}
		// $ANTLR start "booleanValue"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:269:1: booleanValue : (x= 'true' -> TRUE[$x] | x= 'false' -> FALSE[$x] );
		public booleanValue_return booleanValue() // throws RecognitionException [1]
		{
			var retval = new booleanValue_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken x = null;

			CommonTree x_tree = null;
			var stream_96 = new RewriteRuleTokenStream( adaptor, "token 96" );
			var stream_95 = new RewriteRuleTokenStream( adaptor, "token 95" );

			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:270:2: (x= 'true' -> TRUE[$x] | x= 'false' -> FALSE[$x] )
				int alt34 = 2;
				int LA34_0 = input.LA( 1 );

				if ( ( LA34_0 == 95 ) )
					alt34 = 1;
				else if ( ( LA34_0 == 96 ) )
					alt34 = 2;
				else
				{
					var nvae_d34s0 =
							new NoViableAltException( "", 34, 0, input );

					throw nvae_d34s0;
				}
				switch ( alt34 )
				{
					case 1:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:270:4: x= 'true'
						{
							x = (IToken)Match( input, 95, FOLLOW_95_in_booleanValue1440 );
							stream_95.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 270:13: -> TRUE[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( TRUE, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
					case 2:
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:271:4: x= 'false'
						{
							x = (IToken)Match( input, 96, FOLLOW_96_in_booleanValue1452 );
							stream_96.Add( x );


							// AST REWRITE
							// elements:          
							// token labels:      
							// rule labels:       retval
							// token list labels: 
							// rule list labels:  
							// wildcard labels: 
							retval.Tree = root_0;
							var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

							root_0 = (CommonTree)adaptor.GetNilNode();
							// 271:14: -> FALSE[$x]
							{
								adaptor.AddChild( root_0, adaptor.Create( FALSE, x ) );
							}

							retval.Tree = root_0;
							retval.Tree = root_0;
						}
						break;
				}
				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 36
0
	private AstParserRuleReturnScope<CommonTree, IToken> doWhileStatement()
	{
		EnterRule_doWhileStatement();
		EnterRule("doWhileStatement", 68);
		TraceIn("doWhileStatement", 68);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken DO218 = default(IToken);
		IToken WHILE220 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> statement219 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> condition221 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> semi222 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree DO218_tree = default(CommonTree);
		CommonTree WHILE220_tree = default(CommonTree);
		RewriteRuleITokenStream stream_DO=new RewriteRuleITokenStream(adaptor,"token DO");
		RewriteRuleITokenStream stream_WHILE=new RewriteRuleITokenStream(adaptor,"token WHILE");
		RewriteRuleSubtreeStream stream_statement=new RewriteRuleSubtreeStream(adaptor,"rule statement");
		RewriteRuleSubtreeStream stream_condition=new RewriteRuleSubtreeStream(adaptor,"rule condition");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "doWhileStatement");
		DebugLocation(553, 1);
		try
		{
			// AS3.g:554:2: ( DO statement WHILE condition semi -> ^( DO_WHILE_LOOP DO statement WHILE condition ) )
			DebugEnterAlt(1);
			// AS3.g:554:4: DO statement WHILE condition semi
			{
			DebugLocation(554, 4);
			DO218=(IToken)Match(input,DO,Follow._DO_in_doWhileStatement2989); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_DO.Add(DO218);

			DebugLocation(554, 7);
			PushFollow(Follow._statement_in_doWhileStatement2991);
			statement219=statement();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_statement.Add(statement219.Tree);
			DebugLocation(554, 17);
			WHILE220=(IToken)Match(input,WHILE,Follow._WHILE_in_doWhileStatement2993); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_WHILE.Add(WHILE220);

			DebugLocation(554, 23);
			PushFollow(Follow._condition_in_doWhileStatement2995);
			condition221=condition();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_condition.Add(condition221.Tree);
			DebugLocation(554, 33);
			PushFollow(Follow._semi_in_doWhileStatement2997);
			semi222=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(semi222.Tree);


			{
			// AST REWRITE
			// elements: DO, statement, WHILE, condition
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 555:3: -> ^( DO_WHILE_LOOP DO statement WHILE condition )
			{
				DebugLocation(555, 6);
				// AS3.g:555:6: ^( DO_WHILE_LOOP DO statement WHILE condition )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(555, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(DO_WHILE_LOOP, "DO_WHILE_LOOP"), root_1);

				DebugLocation(555, 22);
				adaptor.AddChild(root_1, stream_DO.NextNode());
				DebugLocation(555, 25);
				adaptor.AddChild(root_1, stream_statement.NextTree());
				DebugLocation(555, 35);
				adaptor.AddChild(root_1, stream_WHILE.NextNode());
				DebugLocation(555, 41);
				adaptor.AddChild(root_1, stream_condition.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("doWhileStatement", 68);
			LeaveRule("doWhileStatement", 68);
			LeaveRule_doWhileStatement();
		}
		DebugLocation(556, 1);
		} finally { DebugExitRule(GrammarFileName, "doWhileStatement"); }
		return retval;

	}
		// $ANTLR start "classStatementBlock"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:85:1: classStatementBlock : '{' ( classLevelStatement )* '}' -> ^( STATEMENT_BLOCK ( classLevelStatement )* ) ;
		public classStatementBlock_return classStatementBlock() // throws RecognitionException [1]
		{
			var retval = new classStatementBlock_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken char_literal12 = null;
			IToken char_literal14 = null;
			classLevelStatement_return classLevelStatement13 = default( classLevelStatement_return );


			CommonTree char_literal12_tree = null;
			CommonTree char_literal14_tree = null;
			var stream_60 = new RewriteRuleTokenStream( adaptor, "token 60" );
			var stream_61 = new RewriteRuleTokenStream( adaptor, "token 61" );
			var stream_classLevelStatement = new RewriteRuleSubtreeStream( adaptor, "rule classLevelStatement" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:2: ( '{' ( classLevelStatement )* '}' -> ^( STATEMENT_BLOCK ( classLevelStatement )* ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:4: '{' ( classLevelStatement )* '}'
				{
					char_literal12 = (IToken)Match( input, 60, FOLLOW_60_in_classStatementBlock328 );
					stream_60.Add( char_literal12 );

					// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:8: ( classLevelStatement )*
					do
					{
						int alt4 = 2;
						int LA4_0 = input.LA( 1 );

						if ( ( LA4_0 == 62 || LA4_0 == 67 ) )
							alt4 = 1;


						switch ( alt4 )
						{
							case 1:
								// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:8: classLevelStatement
								{
									PushFollow( FOLLOW_classLevelStatement_in_classStatementBlock330 );
									classLevelStatement13 = classLevelStatement();
									state.followingStackPointer--;

									stream_classLevelStatement.Add( classLevelStatement13.Tree );
								}
								break;

							default:
								goto loop4;
						}
					} while ( true );

					loop4:
					; // Stops C# compiler whining that label 'loop4' has no statements

					char_literal14 = (IToken)Match( input, 61, FOLLOW_61_in_classStatementBlock333 );
					stream_61.Add( char_literal14 );


					// AST REWRITE
					// elements:          classLevelStatement
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 86:33: -> ^( STATEMENT_BLOCK ( classLevelStatement )* )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:36: ^( STATEMENT_BLOCK ( classLevelStatement )* )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( STATEMENT_BLOCK, "STATEMENT_BLOCK" ), root_1 );

							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:86:55: ( classLevelStatement )*
							while ( stream_classLevelStatement.HasNext() )
								adaptor.AddChild( root_1, stream_classLevelStatement.NextTree() );
							stream_classLevelStatement.Reset();

							adaptor.AddChild( root_0, root_1 );
						}
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 38
0
	private AstParserRuleReturnScope<CommonTree, IToken> defaultXMLNamespaceStatement()
	{
		EnterRule_defaultXMLNamespaceStatement();
		EnterRule("defaultXMLNamespaceStatement", 70);
		TraceIn("defaultXMLNamespaceStatement", 70);
		AstParserRuleReturnScope<CommonTree, IToken> retval = new AstParserRuleReturnScope<CommonTree, IToken>();
		retval.Start = (IToken)input.LT(1);

		CommonTree root_0 = default(CommonTree);

		IToken DEFAULT226 = default(IToken);
		IToken XML227 = default(IToken);
		IToken NAMESPACE228 = default(IToken);
		IToken ASSIGN229 = default(IToken);
		AstParserRuleReturnScope<CommonTree, IToken> expression230 = default(AstParserRuleReturnScope<CommonTree, IToken>);
		AstParserRuleReturnScope<CommonTree, IToken> semi231 = default(AstParserRuleReturnScope<CommonTree, IToken>);

		CommonTree DEFAULT226_tree = default(CommonTree);
		CommonTree XML227_tree = default(CommonTree);
		CommonTree NAMESPACE228_tree = default(CommonTree);
		CommonTree ASSIGN229_tree = default(CommonTree);
		RewriteRuleITokenStream stream_DEFAULT=new RewriteRuleITokenStream(adaptor,"token DEFAULT");
		RewriteRuleITokenStream stream_XML=new RewriteRuleITokenStream(adaptor,"token XML");
		RewriteRuleITokenStream stream_NAMESPACE=new RewriteRuleITokenStream(adaptor,"token NAMESPACE");
		RewriteRuleITokenStream stream_ASSIGN=new RewriteRuleITokenStream(adaptor,"token ASSIGN");
		RewriteRuleSubtreeStream stream_expression=new RewriteRuleSubtreeStream(adaptor,"rule expression");
		RewriteRuleSubtreeStream stream_semi=new RewriteRuleSubtreeStream(adaptor,"rule semi");
		try { DebugEnterRule(GrammarFileName, "defaultXMLNamespaceStatement");
		DebugLocation(562, 1);
		try
		{
			// AS3.g:563:2: ( DEFAULT XML NAMESPACE ASSIGN expression semi -> ^( DEFAULT_XML_NAMESPACE expression ) )
			DebugEnterAlt(1);
			// AS3.g:563:4: DEFAULT XML NAMESPACE ASSIGN expression semi
			{
			DebugLocation(563, 4);
			DEFAULT226=(IToken)Match(input,DEFAULT,Follow._DEFAULT_in_defaultXMLNamespaceStatement3040); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_DEFAULT.Add(DEFAULT226);

			DebugLocation(563, 12);
			XML227=(IToken)Match(input,XML,Follow._XML_in_defaultXMLNamespaceStatement3042); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_XML.Add(XML227);

			DebugLocation(563, 16);
			NAMESPACE228=(IToken)Match(input,NAMESPACE,Follow._NAMESPACE_in_defaultXMLNamespaceStatement3044); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_NAMESPACE.Add(NAMESPACE228);

			DebugLocation(563, 26);
			ASSIGN229=(IToken)Match(input,ASSIGN,Follow._ASSIGN_in_defaultXMLNamespaceStatement3046); if (state.failed) return retval; 
			if (state.backtracking == 0) stream_ASSIGN.Add(ASSIGN229);

			DebugLocation(563, 33);
			PushFollow(Follow._expression_in_defaultXMLNamespaceStatement3048);
			expression230=expression();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_expression.Add(expression230.Tree);
			DebugLocation(563, 44);
			PushFollow(Follow._semi_in_defaultXMLNamespaceStatement3050);
			semi231=semi();
			PopFollow();
			if (state.failed) return retval;
			if (state.backtracking == 0) stream_semi.Add(semi231.Tree);


			{
			// AST REWRITE
			// elements: expression
			// token labels: 
			// rule labels: retval
			// token list labels: 
			// rule list labels: 
			// wildcard labels: 
			if (state.backtracking == 0) {
			retval.Tree = root_0;
			RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.Tree:null);

			root_0 = (CommonTree)adaptor.Nil();
			// 564:3: -> ^( DEFAULT_XML_NAMESPACE expression )
			{
				DebugLocation(564, 6);
				// AS3.g:564:6: ^( DEFAULT_XML_NAMESPACE expression )
				{
				CommonTree root_1 = (CommonTree)adaptor.Nil();
				DebugLocation(564, 8);
				root_1 = (CommonTree)adaptor.BecomeRoot((CommonTree)adaptor.Create(DEFAULT_XML_NAMESPACE, "DEFAULT_XML_NAMESPACE"), root_1);

				DebugLocation(564, 30);
				adaptor.AddChild(root_1, stream_expression.NextTree());

				adaptor.AddChild(root_0, root_1);
				}

			}

			retval.Tree = root_0;
			}
			}

			}

			retval.Stop = (IToken)input.LT(-1);

			if (state.backtracking == 0) {
			retval.Tree = (CommonTree)adaptor.RulePostProcessing(root_0);
			adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
			}
		}
		catch (RecognitionException re)
		{
			ReportError(re);
			Recover(input,re);
		retval.Tree = (CommonTree)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);

		}
		finally
		{
			TraceOut("defaultXMLNamespaceStatement", 70);
			LeaveRule("defaultXMLNamespaceStatement", 70);
			LeaveRule_defaultXMLNamespaceStatement();
		}
		DebugLocation(565, 1);
		} finally { DebugExitRule(GrammarFileName, "defaultXMLNamespaceStatement"); }
		return retval;

	}
		// $ANTLR start "propertyDeclaration"
		// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:97:1: propertyDeclaration : 'property' name ( propertyModifiers )? ';' -> ^( PROPERTY name ( propertyModifiers )? ) ;
		public propertyDeclaration_return propertyDeclaration() // throws RecognitionException [1]
		{
			var retval = new propertyDeclaration_return();
			retval.Start = input.LT( 1 );

			CommonTree root_0 = null;

			IToken string_literal17 = null;
			IToken char_literal20 = null;
			name_return name18 = default( name_return );

			propertyModifiers_return propertyModifiers19 = default( propertyModifiers_return );


			CommonTree string_literal17_tree = null;
			CommonTree char_literal20_tree = null;
			var stream_62 = new RewriteRuleTokenStream( adaptor, "token 62" );
			var stream_63 = new RewriteRuleTokenStream( adaptor, "token 63" );
			var stream_propertyModifiers = new RewriteRuleSubtreeStream( adaptor, "rule propertyModifiers" );
			var stream_name = new RewriteRuleSubtreeStream( adaptor, "rule name" );
			try
			{
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:2: ( 'property' name ( propertyModifiers )? ';' -> ^( PROPERTY name ( propertyModifiers )? ) )
				// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:4: 'property' name ( propertyModifiers )? ';'
				{
					string_literal17 = (IToken)Match( input, 62, FOLLOW_62_in_propertyDeclaration389 );
					stream_62.Add( string_literal17 );

					PushFollow( FOLLOW_name_in_propertyDeclaration391 );
					name18 = name();
					state.followingStackPointer--;

					stream_name.Add( name18.Tree );
					// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:20: ( propertyModifiers )?
					int alt6 = 2;
					int LA6_0 = input.LA( 1 );

					if ( ( ( LA6_0 >= 64 && LA6_0 <= 66 ) ) )
						alt6 = 1;
					switch ( alt6 )
					{
						case 1:
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:20: propertyModifiers
							{
								PushFollow( FOLLOW_propertyModifiers_in_propertyDeclaration393 );
								propertyModifiers19 = propertyModifiers();
								state.followingStackPointer--;

								stream_propertyModifiers.Add( propertyModifiers19.Tree );
							}
							break;
					}

					char_literal20 = (IToken)Match( input, 63, FOLLOW_63_in_propertyDeclaration396 );
					stream_63.Add( char_literal20 );


					// AST REWRITE
					// elements:          name, propertyModifiers
					// token labels:      
					// rule labels:       retval
					// token list labels: 
					// rule list labels:  
					// wildcard labels: 
					retval.Tree = root_0;
					var stream_retval = new RewriteRuleSubtreeStream( adaptor, "rule retval", retval != null ? retval.Tree : null );

					root_0 = (CommonTree)adaptor.GetNilNode();
					// 98:43: -> ^( PROPERTY name ( propertyModifiers )? )
					{
						// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:46: ^( PROPERTY name ( propertyModifiers )? )
						{
							var root_1 = (CommonTree)adaptor.GetNilNode();
							root_1 = (CommonTree)adaptor.BecomeRoot( adaptor.Create( PROPERTY, "PROPERTY" ), root_1 );

							adaptor.AddChild( root_1, stream_name.NextTree() );
							// C:\\Projects\\CalcEngine\\src\\CalcEngine\\Parsers\\Antlr\\AntlrCalcEngine.g:98:63: ( propertyModifiers )?
							if ( stream_propertyModifiers.HasNext() )
								adaptor.AddChild( root_1, stream_propertyModifiers.NextTree() );
							stream_propertyModifiers.Reset();

							adaptor.AddChild( root_0, root_1 );
						}
					}

					retval.Tree = root_0;
					retval.Tree = root_0;
				}

				retval.Stop = input.LT( -1 );

				retval.Tree = adaptor.RulePostProcessing( root_0 );
				adaptor.SetTokenBoundaries( retval.Tree, (IToken)retval.Start, (IToken)retval.Stop );
			}
			catch ( RecognitionException re )
			{
				ReportError( re );
				Recover( input, re );
				// Conversion of the second argument necessary, but harmless
				retval.Tree = adaptor.ErrorNode( input, (IToken)retval.Start, input.LT( -1 ), re );
			}
			finally {}
			return retval;
		}
Ejemplo n.º 40
0
        private AstParserRuleReturnScope <object, IToken> plain_descr()
        {
            EnterRule_plain_descr();
            EnterRule("plain_descr", 2);
            TraceIn("plain_descr", 2);
            AstParserRuleReturnScope <object, IToken> retval = new AstParserRuleReturnScope <object, IToken>();

            retval.Start = (IToken)input.LT(1);

            object root_0 = default(object);

            IToken PLAIN3        = default(IToken);
            IToken ID4           = default(IToken);
            IToken BEGIN5        = default(IToken);
            IToken END6          = default(IToken);
            IToken char_literal7 = default(IToken);
            AstParserRuleReturnScope <object, IToken> pl = default(AstParserRuleReturnScope <object, IToken>);

            object PLAIN3_tree                              = default(object);
            object ID4_tree                                 = default(object);
            object BEGIN5_tree                              = default(object);
            object END6_tree                                = default(object);
            object char_literal7_tree                       = default(object);
            RewriteRuleITokenStream  stream_ID              = new RewriteRuleITokenStream(adaptor, "token ID");
            RewriteRuleITokenStream  stream_END             = new RewriteRuleITokenStream(adaptor, "token END");
            RewriteRuleITokenStream  stream_PLAIN           = new RewriteRuleITokenStream(adaptor, "token PLAIN");
            RewriteRuleITokenStream  stream_24              = new RewriteRuleITokenStream(adaptor, "token 24");
            RewriteRuleITokenStream  stream_BEGIN           = new RewriteRuleITokenStream(adaptor, "token BEGIN");
            RewriteRuleSubtreeStream stream_plain_elem_list = new RewriteRuleSubtreeStream(adaptor, "rule plain_elem_list");

            try { DebugEnterRule(GrammarFileName, "plain_descr");
                  DebugLocation(30, 1);
                  try
                  {
                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:30:12: ( PLAIN ID BEGIN pl= plain_elem_list END ';' -> ^( PLAIN_FILE ID $pl) )
                      DebugEnterAlt(1);
                      // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:31:2: PLAIN ID BEGIN pl= plain_elem_list END ';'
                      {
                          DebugLocation(31, 2);
                          PLAIN3 = (IToken)Match(input, PLAIN, Follow._PLAIN_in_plain_descr99);
                          stream_PLAIN.Add(PLAIN3);

                          DebugLocation(31, 8);
                          ID4 = (IToken)Match(input, ID, Follow._ID_in_plain_descr101);
                          stream_ID.Add(ID4);

                          DebugLocation(32, 2);
                          BEGIN5 = (IToken)Match(input, BEGIN, Follow._BEGIN_in_plain_descr104);
                          stream_BEGIN.Add(BEGIN5);

                          DebugLocation(33, 6);
                          PushFollow(Follow._plain_elem_list_in_plain_descr111);
                          pl = plain_elem_list();
                          PopFollow();

                          stream_plain_elem_list.Add(pl.Tree);
                          DebugLocation(34, 2);
                          END6 = (IToken)Match(input, END, Follow._END_in_plain_descr114);
                          stream_END.Add(END6);

                          DebugLocation(34, 6);
                          char_literal7 = (IToken)Match(input, 24, Follow._24_in_plain_descr116);
                          stream_24.Add(char_literal7);



                          {
                              // AST REWRITE
                              // elements: pl, ID
                              // token labels:
                              // rule labels: retval, pl
                              // token list labels:
                              // rule list labels:
                              // wildcard labels:
                              retval.Tree = root_0;
                              RewriteRuleSubtreeStream stream_retval = new RewriteRuleSubtreeStream(adaptor, "rule retval", retval != null?retval.Tree:null);
                              RewriteRuleSubtreeStream stream_pl     = new RewriteRuleSubtreeStream(adaptor, "rule pl", pl != null?pl.Tree:null);

                              root_0 = (object)adaptor.Nil();
                              // 34:10: -> ^( PLAIN_FILE ID $pl)
                              {
                                  DebugLocation(34, 13);
                                  // C:\\Users\\franz\\SkyDrive\\Dokumente\\workspace\\TextTable\\src\\eu\\reitmayer\\texttable\\lang\\TextTable.g:34:13: ^( PLAIN_FILE ID $pl)
                                  {
                                      object root_1 = (object)adaptor.Nil();
                                      DebugLocation(34, 15);
                                      root_1 = (object)adaptor.BecomeRoot((object)adaptor.Create(PLAIN_FILE, "PLAIN_FILE"), root_1);

                                      DebugLocation(34, 26);
                                      adaptor.AddChild(root_1, stream_ID.NextNode());
                                      DebugLocation(34, 30);
                                      adaptor.AddChild(root_1, stream_pl.NextTree());

                                      adaptor.AddChild(root_0, root_1);
                                  }
                              }

                              retval.Tree = root_0;
                          }
                      }

                      retval.Stop = (IToken)input.LT(-1);

                      retval.Tree = (object)adaptor.RulePostProcessing(root_0);
                      adaptor.SetTokenBoundaries(retval.Tree, retval.Start, retval.Stop);
                  }
                  catch (RecognitionException re)
                  {
                      ReportError(re);
                      Recover(input, re);
                      retval.Tree = (object)adaptor.ErrorNode(input, retval.Start, input.LT(-1), re);
                  }
                  finally
                  {
                      TraceOut("plain_descr", 2);
                      LeaveRule("plain_descr", 2);
                      LeaveRule_plain_descr();
                  }
                  DebugLocation(35, 1); } finally { DebugExitRule(GrammarFileName, "plain_descr"); }
            return(retval);
        }