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

exception_handler() protected method

protected exception_handler ( TryStatement t ) : void
t TryStatement
return void
        protected void exception_handler(
		TryStatement t
	)
        {
            IToken  c = null;
            IToken  x = null;
            IToken  u = null;

                ExceptionHandler eh = null;
                TypeReference tr = null;
                Expression e = null;

            try {      // for error handling
            c = LT(1);
            match(EXCEPT);
            {
                switch ( LA(1) )
                {
                case ID:
                {
                    x = LT(1);
                    match(ID);
                    break;
                }
                case AS:
                case IF:
                case UNLESS:
                case COLON:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            {
                switch ( LA(1) )
                {
                case AS:
                {
                    match(AS);
                    tr=type_reference();
                    break;
                }
                case IF:
                case UNLESS:
                case COLON:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            {
                switch ( LA(1) )
                {
                case IF:
                case UNLESS:
                {
                    {
                        switch ( LA(1) )
                        {
                        case IF:
                        {
                            match(IF);
                            break;
                        }
                        case UNLESS:
                        {
                            u = LT(1);
                            match(UNLESS);
                            break;
                        }
                        default:
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                         }
                    }
                    e=boolean_expression();
                    break;
                }
                case COLON:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            if (0==inputState.guessing)
            {

                        eh = new ExceptionHandler(ToLexicalInfo(c));

                        eh.Declaration = new Declaration();
                        eh.Declaration.Type = tr;

                        if (x != null)
                        {
                            eh.Declaration.LexicalInfo = ToLexicalInfo(x);
                            eh.Declaration.Name = x.getText();
                        }
                        else
                        {
                            eh.Declaration.Name = null;
                            eh.Flags |= ExceptionHandlerFlags.Anonymous;
                        }
                        if (tr != null)
                        {
                            eh.Declaration.LexicalInfo = tr.LexicalInfo;
                        }
                        else if (x != null)
                        {
                            eh.Declaration.LexicalInfo = eh.LexicalInfo;
                        }
                        if(tr == null)
                        {
                            eh.Flags |= ExceptionHandlerFlags.Untyped;
                        }
                        if (e != null)
                        {
                            if(u != null)
                            {
                                UnaryExpression not = new UnaryExpression(ToLexicalInfo(u));
                                not.Operator = UnaryOperatorType.LogicalNot;
                                not.Operand = e;
                                e = not;
                            }
                            eh.FilterCondition = e;
                            eh.Flags |= ExceptionHandlerFlags.Filter;
                        }

            }
            compound_stmt(eh.Block);
            if (0==inputState.guessing)
            {

                        t.ExceptionHandlers.Add(eh);

            }
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex, "exception_handler");
                recover(ex,tokenSet_104_);
            }
            else
            {
                throw ex;
            }
            }
        }
BooParserBase