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

field_or_property() protected method

protected field_or_property ( TypeMemberCollection container ) : void
container TypeMemberCollection
return void
        protected void field_or_property(
		TypeMemberCollection container
	)
        {
            IToken  id1 = null;
            IToken  begin1 = null;
            IToken  s = null;
            IToken  lparen = null;
            IToken  id2 = null;
            IToken  begin2 = null;

            IToken id = null;
            TypeMember tm = null;
            TypeReference tr = null;
            Property p = null;
            Field field = null;
            ExplicitMemberInfo emi = null;
            Expression initializer = null;
            ParameterDeclarationCollection parameters = null;
            Expression nameSplice = null;

            try {      // for error handling
            {
                bool synPredMatched154 = false;
                if (((LA(1)==SELF||LA(1)==ID||LA(1)==SPLICE_BEGIN) && (tokenSet_53_.member(LA(2)))))
                {
                    int _m154 = mark();
                    synPredMatched154 = true;
                    inputState.guessing++;
                    try {
                        {
                            property_header();
                        }
                    }
                    catch (RecognitionException)
                    {
                        synPredMatched154 = false;
                    }
                    rewind(_m154);
                    inputState.guessing--;
                }
                if ( synPredMatched154 )
                {
                    {
                        {
                            if ((LA(1)==ID) && (LA(2)==DOT))
                            {
                                emi=explicit_member_info();
                            }
                            else if ((LA(1)==SELF||LA(1)==ID||LA(1)==SPLICE_BEGIN) && (tokenSet_53_.member(LA(2)))) {
                            }
                            else
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }

                        }
                        {
                            switch ( LA(1) )
                            {
                            case ID:
                            {
                                id1 = LT(1);
                                match(ID);
                                if (0==inputState.guessing)
                                {
                                    id=id1;
                                }
                                break;
                            }
                            case SPLICE_BEGIN:
                            {
                                begin1 = LT(1);
                                match(SPLICE_BEGIN);
                                nameSplice=atom();
                                if (0==inputState.guessing)
                                {
                                    id=begin1;
                                }
                                break;
                            }
                            case SELF:
                            {
                                s = LT(1);
                                match(SELF);
                                if (0==inputState.guessing)
                                {
                                    id=s;
                                }
                                break;
                            }
                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                             }
                        }
                        {
                            if (0==inputState.guessing)
                            {

                                                if (emi != null)
                                                    p = new Property(emi.LexicalInfo);
                                                else
                                                    p = new Property(ToLexicalInfo(id));
                                                p.Name = id.getText();
                                                p.ExplicitInfo = emi;
                                                AddAttributes(p.Attributes);
                                                parameters = p.Parameters;
                                                tm = p;

                            }
                            {
                                switch ( LA(1) )
                                {
                                case LPAREN:
                                {
                                    {
                                        lparen = LT(1);
                                        match(LPAREN);
                                        parameter_declaration_list(parameters);
                                        match(RPAREN);
                                        if (0==inputState.guessing)
                                        {
                                            EmitIndexedPropertyDeprecationWarning(p);
                                        }
                                    }
                                    break;
                                }
                                case LBRACK:
                                {
                                    {
                                        match(LBRACK);
                                        parameter_declaration_list(parameters);
                                        match(RBRACK);
                                    }
                                    break;
                                }
                                case AS:
                                case COLON:
                                {
                                    break;
                                }
                                default:
                                {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                                 }
                            }
                            {
                                switch ( LA(1) )
                                {
                                case AS:
                                {
                                    match(AS);
                                    tr=type_reference();
                                    break;
                                }
                                case COLON:
                                {
                                    break;
                                }
                                default:
                                {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                                 }
                            }
                            if (0==inputState.guessing)
                            {

                                                p.Type = tr;
                                                p.Modifiers = _modifiers;

                            }
                            begin_with_doc(p);
                            { // ( ... )+
                                int _cnt164=0;
                                for (;;)
                                {
                                    if ((tokenSet_54_.member(LA(1))))
                                    {
                                        property_accessor(p);
                                    }
                                    else
                                    {
                                        if (_cnt164 >= 1) { goto _loop164_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
                                    }

                                    _cnt164++;
                                }
            _loop164_breakloop:								;
                            }    // ( ... )+
                            end(p);
                        }
                    }
                }
                else {
                    bool synPredMatched167 = false;
                    if (((LA(1)==THEN||LA(1)==ID) && (tokenSet_4_.member(LA(2)))))
                    {
                        int _m167 = mark();
                        synPredMatched167 = true;
                        inputState.guessing++;
                        try {
                            {
                                macro_name();
                                expression_list(null);
                                {
                                    switch ( LA(1) )
                                    {
                                    case EOL:
                                    case EOS:
                                    {
                                        eos();
                                        break;
                                    }
                                    case COLON:
                                    {
                                        begin_with_doc(null);
                                        break;
                                    }
                                    default:
                                    {
                                        throw new NoViableAltException(LT(1), getFilename());
                                    }
                                     }
                                }
                            }
                        }
                        catch (RecognitionException)
                        {
                            synPredMatched167 = false;
                        }
                        rewind(_m167);
                        inputState.guessing--;
                    }
                    if ( synPredMatched167 )
                    {
                        tm=member_macro();
                    }
                    else if ((LA(1)==ID||LA(1)==SPLICE_BEGIN) && (tokenSet_55_.member(LA(2)))) {
                        {
                            {
                                switch ( LA(1) )
                                {
                                case ID:
                                {
                                    id2 = LT(1);
                                    match(ID);
                                    break;
                                }
                                case SPLICE_BEGIN:
                                {
                                    begin2 = LT(1);
                                    match(SPLICE_BEGIN);
                                    nameSplice=atom();
                                    break;
                                }
                                default:
                                {
                                    throw new NoViableAltException(LT(1), getFilename());
                                }
                                 }
                            }
                            if (0==inputState.guessing)
                            {

                                            IToken token = id2 ?? begin2;
                                            field = new Field(ToLexicalInfo(token));
                                            field.Name = token.getText();
                                            field.Modifiers = _modifiers;
                                            AddAttributes(field.Attributes);
                                            tm = field;

                            }
                            {
                                {
                                    switch ( LA(1) )
                                    {
                                    case AS:
                                    {
                                        match(AS);
                                        tr=type_reference();
                                        if (0==inputState.guessing)
                                        {
                                            field.Type = tr;
                                        }
                                        break;
                                    }
                                    case EOL:
                                    case EOS:
                                    case ASSIGN:
                                    {
                                        break;
                                    }
                                    default:
                                    {
                                        throw new NoViableAltException(LT(1), getFilename());
                                    }
                                     }
                                }
                                {
                                    switch ( LA(1) )
                                    {
                                    case ASSIGN:
                                    {
                                        {
                                            match(ASSIGN);
                                            initializer=declaration_initializer();
                                            if (0==inputState.guessing)
                                            {
                                                field.Initializer = initializer;
                                            }
                                        }
                                        break;
                                    }
                                    case EOL:
                                    case EOS:
                                    {
                                        eos();
                                        break;
                                    }
                                    default:
                                    {
                                        throw new NoViableAltException(LT(1), getFilename());
                                    }
                                     }
                                }
                                docstring(field);
                            }
                        }
                    }
                    else
                    {
                        throw new NoViableAltException(LT(1), getFilename());
                    }
                    }
                }
                if (0==inputState.guessing)
                {

                        if (null != nameSplice) {
                            tm = new SpliceTypeMember(tm, nameSplice);
                        }
                        container.Add(tm);

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