Boo.Lang.Parser.BooParserBase.declaration_stmt C# (CSharp) Method

declaration_stmt() protected method

protected declaration_stmt ( ) : DeclarationStatement
return DeclarationStatement
        protected DeclarationStatement declaration_stmt()
        {
            DeclarationStatement s;

            IToken  id = null;

                s = null;
                TypeReference tr = null;
                Expression initializer = null;
                StatementModifier m = null;

            try {      // for error handling
            id = LT(1);
            match(ID);
            match(AS);
            tr=type_reference();
            {
                switch ( LA(1) )
                {
                case ASSIGN:
                {
                    {
                        match(ASSIGN);
                        {
                            if (((tokenSet_93_.member(LA(1))) && (tokenSet_94_.member(LA(2))))&&(_compact))
                            {
                                initializer=simple_initializer();
                            }
                            else if ((tokenSet_93_.member(LA(1))) && (tokenSet_95_.member(LA(2)))) {
                                initializer=declaration_initializer();
                            }
                            else
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }

                        }
                    }
                    break;
                }
                case EOL:
                case IF:
                case UNLESS:
                case WHILE:
                case EOS:
                {
                    {
                        if (!(!_compact))
                          throw new SemanticException("!_compact");
                        {
                            switch ( LA(1) )
                            {
                            case IF:
                            case UNLESS:
                            case WHILE:
                            {
                                m=stmt_modifier();
                                break;
                            }
                            case EOL:
                            case EOS:
                            {
                                break;
                            }
                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                             }
                        }
                        eos();
                    }
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            if (0==inputState.guessing)
            {

                        Declaration d = new Declaration(ToLexicalInfo(id));
                        d.Name = id.getText();
                        d.Type = tr;

                        s = new DeclarationStatement(d.LexicalInfo);
                        s.Declaration = d;
                        s.Initializer = initializer;
                        s.Modifier = m;

            }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex, "declaration_stmt");
                recover(ex,tokenSet_22_);
            }
            else
            {
                throw ex;
            }
            }
            return s;
        }
BooParserBase