コード例 #1
0
ファイル: BooParserBase.cs プロジェクト: hlizard/boo
	protected void type_member_stmt(
		StatementCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		
			TypeMemberCollection members = new TypeMemberCollection();
		
		
		try {      // for error handling
			type_definition_member(members);
			if (0==inputState.guessing)
			{
				
						foreach (var member in members)
							container.Add(new TypeMemberStatement(member));
					
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "type_member_stmt");
				recover(ex,tokenSet_55_);
			}
			else
			{
				throw ex;
			}
		}
	}
コード例 #2
0
ファイル: BooParserBase.cs プロジェクト: hlizard/boo
	protected void simple_stmt(
		StatementCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		
				Statement s = null;
				_compact = true;
			
		
		try {      // for error handling
			{
				if (((LA(1)==THEN||LA(1)==ID) && (tokenSet_24_.member(LA(2))))&&(IsValidMacroArgument(LA(2))))
				{
					s=closure_macro_stmt();
				}
				else {
					bool synPredMatched323 = false;
					if (((tokenSet_37_.member(LA(1))) && (tokenSet_88_.member(LA(2)))))
					{
						int _m323 = mark();
						synPredMatched323 = true;
						inputState.guessing++;
						try {
							{
								slicing_expression();
								match(ASSIGN);
							}
						}
						catch (RecognitionException)
						{
							synPredMatched323 = false;
						}
						rewind(_m323);
						inputState.guessing--;
					}
					if ( synPredMatched323 )
					{
						s=assignment_or_method_invocation();
					}
					else if ((LA(1)==RETURN)) {
						s=return_expression_stmt();
					}
					else {
						bool synPredMatched325 = false;
						if (((LA(1)==ID) && (LA(2)==AS||LA(2)==COMMA)))
						{
							int _m325 = mark();
							synPredMatched325 = true;
							inputState.guessing++;
							try {
								{
									declaration();
									match(COMMA);
								}
							}
							catch (RecognitionException)
							{
								synPredMatched325 = false;
							}
							rewind(_m325);
							inputState.guessing--;
						}
						if ( synPredMatched325 )
						{
							s=unpack();
						}
						else if ((LA(1)==ID) && (LA(2)==AS)) {
							s=declaration_stmt();
						}
						else if ((tokenSet_82_.member(LA(1))) && (tokenSet_89_.member(LA(2)))) {
							{
								{
									switch ( LA(1) )
									{
									case GOTO:
									{
										s=goto_stmt();
										break;
									}
									case COLON:
									{
										s=label_stmt();
										break;
									}
									case YIELD:
									{
										s=yield_stmt();
										break;
									}
									case BREAK:
									{
										s=break_stmt();
										break;
									}
									case CONTINUE:
									{
										s=continue_stmt();
										break;
									}
									case RAISE:
									{
										s=raise_stmt();
										break;
									}
									case ESEPARATOR:
									case CAST:
									case CHAR:
									case FALSE:
									case NULL:
									case SELF:
									case SUPER:
									case THEN:
									case TRUE:
									case TYPEOF:
									case TRIPLE_QUOTED_STRING:
									case LPAREN:
									case DOUBLE_QUOTED_STRING:
									case SINGLE_QUOTED_STRING:
									case ID:
									case MULTIPLY:
									case LBRACK:
									case SPLICE_BEGIN:
									case DOT:
									case LBRACE:
									case QQ_BEGIN:
									case SUBTRACT:
									case LONG:
									case INCREMENT:
									case DECREMENT:
									case ONES_COMPLEMENT:
									case INT:
									case BACKTICK_QUOTED_STRING:
									case RE_LITERAL:
									case DOUBLE:
									case FLOAT:
									case TIMESPAN:
									{
										s=expression_stmt();
										break;
									}
									default:
									{
										throw new NoViableAltException(LT(1), getFilename());
									}
									 }
								}
							}
						}
						else
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						}}
					}
					if (0==inputState.guessing)
					{
						
								if (null != s)
								{
									container.Add(s);
								}
							
					}
					if (0==inputState.guessing)
					{
						_compact=false;
					}
				}
				catch (RecognitionException ex)
				{
					if (0 == inputState.guessing)
					{
						reportError(ex, "simple_stmt");
						recover(ex,tokenSet_19_);
					}
					else
					{
						throw ex;
					}
				}
			}
コード例 #3
0
ファイル: WSABooParserBase.cs プロジェクト: 0xb1dd1e/boo
        //throws RecognitionException, TokenStreamException
        protected void type_member_stmt(
            StatementCollection container
            )
        {
            TypeMemberCollection members = new TypeMemberCollection();

            try {      // for error handling
            type_member(members);
            if (0==inputState.guessing)
            {

                        container.Add(new TypeMemberStatement(members[0]));

            }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_86_);
            }
            else
            {
                throw ex;
            }
            }
        }
コード例 #4
0
ファイル: BooParserBase.cs プロジェクト: hlizard/boo
	protected void stmt(
		StatementCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		
				Statement s = null;
				StatementModifier m = null;
			
		
		try {      // for error handling
			{
				switch ( LA(1) )
				{
				case DEF:
				{
					s=nested_function();
					break;
				}
				case FOR:
				{
					s=for_stmt();
					break;
				}
				case WHILE:
				{
					s=while_stmt();
					break;
				}
				case IF:
				{
					s=if_stmt();
					break;
				}
				case UNLESS:
				{
					s=unless_stmt();
					break;
				}
				case TRY:
				{
					s=try_stmt();
					break;
				}
				case RETURN:
				{
					s=return_stmt();
					break;
				}
				default:
					bool synPredMatched310 = false;
					if ((((LA(1)==THEN||LA(1)==ID) && (tokenSet_4_.member(LA(2))))&&(IsValidMacroArgument(LA(2)))))
					{
						int _m310 = mark();
						synPredMatched310 = true;
						inputState.guessing++;
						try {
							{
								macro_name();
								{
									if ((tokenSet_5_.member(LA(1))))
									{
										expression();
									}
									else {
									}
									
								}
							}
						}
						catch (RecognitionException)
						{
							synPredMatched310 = false;
						}
						rewind(_m310);
						inputState.guessing--;
					}
					if ( synPredMatched310 )
					{
						s=macro_stmt();
					}
					else {
						bool synPredMatched314 = false;
						if (((tokenSet_37_.member(LA(1))) && (tokenSet_81_.member(LA(2)))))
						{
							int _m314 = mark();
							synPredMatched314 = true;
							inputState.guessing++;
							try {
								{
									slicing_expression();
									{
										switch ( LA(1) )
										{
										case ASSIGN:
										{
											match(ASSIGN);
											break;
										}
										case DEF:
										case DO:
										case COLON:
										{
											{
												switch ( LA(1) )
												{
												case COLON:
												{
													match(COLON);
													break;
												}
												case DO:
												{
													match(DO);
													break;
												}
												case DEF:
												{
													match(DEF);
													break;
												}
												default:
												{
													throw new NoViableAltException(LT(1), getFilename());
												}
												 }
											}
											break;
										}
										default:
										{
											throw new NoViableAltException(LT(1), getFilename());
										}
										 }
									}
								}
							}
							catch (RecognitionException)
							{
								synPredMatched314 = false;
							}
							rewind(_m314);
							inputState.guessing--;
						}
						if ( synPredMatched314 )
						{
							s=assignment_or_method_invocation_with_block_stmt();
						}
						else {
							bool synPredMatched316 = false;
							if (((LA(1)==ID) && (LA(2)==AS||LA(2)==COMMA)))
							{
								int _m316 = mark();
								synPredMatched316 = true;
								inputState.guessing++;
								try {
									{
										declaration();
										match(COMMA);
									}
								}
								catch (RecognitionException)
								{
									synPredMatched316 = false;
								}
								rewind(_m316);
								inputState.guessing--;
							}
							if ( synPredMatched316 )
							{
								s=unpack_stmt();
							}
							else if ((LA(1)==ID) && (LA(2)==AS)) {
								s=declaration_stmt();
							}
							else if ((tokenSet_82_.member(LA(1))) && (tokenSet_83_.member(LA(2)))) {
								{
									{
										switch ( LA(1) )
										{
										case GOTO:
										{
											s=goto_stmt();
											break;
										}
										case COLON:
										{
											s=label_stmt();
											break;
										}
										case YIELD:
										{
											s=yield_stmt();
											break;
										}
										case BREAK:
										{
											s=break_stmt();
											break;
										}
										case CONTINUE:
										{
											s=continue_stmt();
											break;
										}
										case RAISE:
										{
											s=raise_stmt();
											break;
										}
										case ESEPARATOR:
										case CAST:
										case CHAR:
										case FALSE:
										case NULL:
										case SELF:
										case SUPER:
										case THEN:
										case TRUE:
										case TYPEOF:
										case TRIPLE_QUOTED_STRING:
										case LPAREN:
										case DOUBLE_QUOTED_STRING:
										case SINGLE_QUOTED_STRING:
										case ID:
										case MULTIPLY:
										case LBRACK:
										case SPLICE_BEGIN:
										case DOT:
										case LBRACE:
										case QQ_BEGIN:
										case SUBTRACT:
										case LONG:
										case INCREMENT:
										case DECREMENT:
										case ONES_COMPLEMENT:
										case INT:
										case BACKTICK_QUOTED_STRING:
										case RE_LITERAL:
										case DOUBLE:
										case FLOAT:
										case TIMESPAN:
										{
											s=expression_stmt();
											break;
										}
										default:
										{
											throw new NoViableAltException(LT(1), getFilename());
										}
										 }
									}
									{
										switch ( LA(1) )
										{
										case IF:
										case UNLESS:
										case WHILE:
										{
											m=stmt_modifier();
											if (0==inputState.guessing)
											{
												if (s != null) s.Modifier = m;
											}
											break;
										}
										case EOL:
										case EOS:
										{
											break;
										}
										default:
										{
											throw new NoViableAltException(LT(1), getFilename());
										}
										 }
									}
									eos();
								}
							}
						else
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						}}break; }
					}
					if (0==inputState.guessing)
					{
						
								if (s != null && container != null)
								{
									container.Add(s);
								}
							
					}
				}
				catch (RecognitionException ex)
				{
					if (0 == inputState.guessing)
					{
						reportError(ex, "stmt");
						recover(ex,tokenSet_84_);
					}
					else
					{
						throw ex;
					}
				}
			}
コード例 #5
0
ファイル: WSABooParserBase.cs プロジェクト: 0xb1dd1e/boo
        //throws RecognitionException, TokenStreamException
        protected void stmt(
            StatementCollection container
            )
        {
            Statement s = null;
                StatementModifier m = null;

            try {      // for error handling
            {
                switch ( LA(1) )
                {
                case FOR:
                {
                    s=for_stmt();
                    break;
                }
                case WHILE:
                {
                    s=while_stmt();
                    break;
                }
                case IF:
                {
                    s=if_stmt();
                    break;
                }
                case UNLESS:
                {
                    s=unless_stmt();
                    break;
                }
                case TRY:
                {
                    s=try_stmt();
                    break;
                }
                case RETURN:
                {
                    s=return_stmt();
                    break;
                }
                default:
                    bool synPredMatched260 = false;
                    if (((tokenSet_75_.member(LA(1))) && (tokenSet_76_.member(LA(2)))))
                    {
                        int _m260 = mark();
                        synPredMatched260 = true;
                        inputState.guessing++;
                        try {
                            {
                                atom();
                                { // ( ... )+
                                    int _cnt259=0;
                                    for (;;)
                                    {
                                        if ((LA(1)==NEWLINE))
                                        {
                                            match(NEWLINE);
                                        }
                                        else
                                        {
                                            if (_cnt259 >= 1) { goto _loop259_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
                                        }

                                        _cnt259++;
                                    }
            _loop259_breakloop:									;
                                }    // ( ... )+
                                match(DOT);
                            }
                        }
                        catch (RecognitionException)
                        {
                            synPredMatched260 = false;
                        }
                        rewind(_m260);
                        inputState.guessing--;
                    }
                    if ( synPredMatched260 )
                    {
                        {
                            s=expression_stmt();
                            eos();
                        }
                    }
                    else {
                        bool synPredMatched264 = false;
                        if ((((LA(1)==ID) && (tokenSet_3_.member(LA(2))))&&(IsValidMacroArgument(LA(2)))))
                        {
                            int _m264 = mark();
                            synPredMatched264 = true;
                            inputState.guessing++;
                            try {
                                {
                                    match(ID);
                                    {
                                        if ((tokenSet_4_.member(LA(1))))
                                        {
                                            expression();
                                        }
                                        else {
                                        }

                                    }
                                }
                            }
                            catch (RecognitionException)
                            {
                                synPredMatched264 = false;
                            }
                            rewind(_m264);
                            inputState.guessing--;
                        }
                        if ( synPredMatched264 )
                        {
                            s=macro_stmt();
                        }
                        else {
                            bool synPredMatched268 = false;
                            if (((tokenSet_66_.member(LA(1))) && (tokenSet_77_.member(LA(2)))))
                            {
                                int _m268 = mark();
                                synPredMatched268 = true;
                                inputState.guessing++;
                                try {
                                    {
                                        slicing_expression();
                                        {
                                            switch ( LA(1) )
                                            {
                                            case ASSIGN:
                                            {
                                                match(ASSIGN);
                                                break;
                                            }
                                            case DEF:
                                            case DO:
                                            case COLON:
                                            {
                                                {
                                                    switch ( LA(1) )
                                                    {
                                                    case COLON:
                                                    {
                                                        match(COLON);
                                                        break;
                                                    }
                                                    case DO:
                                                    {
                                                        match(DO);
                                                        break;
                                                    }
                                                    case DEF:
                                                    {
                                                        match(DEF);
                                                        break;
                                                    }
                                                    default:
                                                    {
                                                        throw new NoViableAltException(LT(1), getFilename());
                                                    }
                                                     }
                                                }
                                                break;
                                            }
                                            default:
                                            {
                                                throw new NoViableAltException(LT(1), getFilename());
                                            }
                                             }
                                        }
                                    }
                                }
                                catch (RecognitionException)
                                {
                                    synPredMatched268 = false;
                                }
                                rewind(_m268);
                                inputState.guessing--;
                            }
                            if ( synPredMatched268 )
                            {
                                s=assignment_or_method_invocation_with_block_stmt();
                            }
                            else {
                                bool synPredMatched270 = false;
                                if (((LA(1)==ID) && (LA(2)==AS||LA(2)==COMMA)))
                                {
                                    int _m270 = mark();
                                    synPredMatched270 = true;
                                    inputState.guessing++;
                                    try {
                                        {
                                            declaration();
                                            match(COMMA);
                                        }
                                    }
                                    catch (RecognitionException)
                                    {
                                        synPredMatched270 = false;
                                    }
                                    rewind(_m270);
                                    inputState.guessing--;
                                }
                                if ( synPredMatched270 )
                                {
                                    s=unpack_stmt();
                                }
                                else if ((LA(1)==ID) && (LA(2)==AS)) {
                                    s=declaration_stmt();
                                }
                                else if ((tokenSet_78_.member(LA(1))) && (tokenSet_76_.member(LA(2)))) {
                                    {
                                        {
                                            switch ( LA(1) )
                                            {
                                            case GOTO:
                                            {
                                                s=goto_stmt();
                                                break;
                                            }
                                            case COLON:
                                            {
                                                s=label_stmt();
                                                break;
                                            }
                                            case YIELD:
                                            {
                                                s=yield_stmt();
                                                break;
                                            }
                                            case BREAK:
                                            {
                                                s=break_stmt();
                                                break;
                                            }
                                            case CONTINUE:
                                            {
                                                s=continue_stmt();
                                                break;
                                            }
                                            case RAISE:
                                            {
                                                s=raise_stmt();
                                                break;
                                            }
                                            case ESEPARATOR:
                                            case CAST:
                                            case CHAR:
                                            case FALSE:
                                            case NULL:
                                            case SELF:
                                            case SUPER:
                                            case TRUE:
                                            case TYPEOF:
                                            case ID:
                                            case TRIPLE_QUOTED_STRING:
                                            case LPAREN:
                                            case DOUBLE_QUOTED_STRING:
                                            case SINGLE_QUOTED_STRING:
                                            case LBRACK:
                                            case SUBTRACT:
                                            case SPLICE_BEGIN:
                                            case DOT:
                                            case MULTIPLY:
                                            case LBRACE:
                                            case QQ_BEGIN:
                                            case LONG:
                                            case INCREMENT:
                                            case DECREMENT:
                                            case ONES_COMPLEMENT:
                                            case INT:
                                            case RE_LITERAL:
                                            case DOUBLE:
                                            case FLOAT:
                                            case TIMESPAN:
                                            {
                                                s=expression_stmt();
                                                break;
                                            }
                                            default:
                                            {
                                                throw new NoViableAltException(LT(1), getFilename());
                                            }
                                             }
                                        }
                                        {
                                            switch ( LA(1) )
                                            {
                                            case IF:
                                            case UNLESS:
                                            case WHILE:
                                            {
                                                m=stmt_modifier();
                                                if (0==inputState.guessing)
                                                {
                                                    s.Modifier = m;
                                                }
                                                break;
                                            }
                                            case EOF:
                                            case EOS:
                                            case NEWLINE:
                                            {
                                                break;
                                            }
                                            default:
                                            {
                                                throw new NoViableAltException(LT(1), getFilename());
                                            }
                                             }
                                        }
                                        eos();
                                    }
                                }
                            else
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                            }}}break; }
                        }
                        if (0==inputState.guessing)
                        {

                                    if (null != s)
                                    {
                                        container.Add(s);
                                    }

                        }
                    }
                    catch (RecognitionException ex)
                    {
                        if (0 == inputState.guessing)
                        {
                            reportError(ex);
                            recover(ex,tokenSet_79_);
                        }
                        else
                        {
                            throw ex;
                        }
                    }
        }