当前位置: 首页>>代码示例>>C#>>正文


C# TypeMemberCollection.Add方法代码示例

本文整理汇总了C#中Boo.Lang.Compiler.Ast.TypeMemberCollection.Add方法的典型用法代码示例。如果您正苦于以下问题:C# TypeMemberCollection.Add方法的具体用法?C# TypeMemberCollection.Add怎么用?C# TypeMemberCollection.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Boo.Lang.Compiler.Ast.TypeMemberCollection的用法示例。


在下文中一共展示了TypeMemberCollection.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FromArray

		public static TypeMemberCollection FromArray(params object[] items)
		{
			var result = new TypeMemberCollection();
			foreach (var item in items)
			{
				var typeMember = item as TypeMember;
				if (typeMember != null)
					result.Add(typeMember);
				else
					result.AddRange((IEnumerable<TypeMember>)item);
			}
			return result;
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:13,代码来源:TypeMemberCollection.cs

示例2: enum_member

	protected void enum_member(
		TypeMemberCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		IToken  id = null;
			
				EnumMember em = null;
				Expression initializer = null;
			
		
		try {      // for error handling
			attributes();
			id = LT(1);
			match(ID);
			{
				switch ( LA(1) )
				{
				case ASSIGN:
				{
					match(ASSIGN);
					initializer=simple_initializer();
					break;
				}
				case EOL:
				case EOS:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			if (0==inputState.guessing)
			{
				
						em = new EnumMember(ToLexicalInfo(id));
						em.Name = id.getText();
						em.Initializer = initializer;
						AddAttributes(em.Attributes);
						container.Add(em);
					
			}
			eos();
			docstring(em);
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "enum_member");
				recover(ex,tokenSet_48_);
			}
			else
			{
				throw ex;
			}
		}
	}
开发者ID:hlizard,项目名称:boo,代码行数:61,代码来源:BooParserBase.cs

示例3: callable_definition

	protected void callable_definition(
		TypeMemberCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		IToken  id = null;
		
				CallableDefinition cd = null;
				TypeReference returnType = null;
				GenericParameterDeclarationCollection genericParameters = null;
			
		
		try {      // for error handling
			match(CALLABLE);
			id = LT(1);
			match(ID);
			if (0==inputState.guessing)
			{
				
						cd = new CallableDefinition(ToLexicalInfo(id));
						cd.Name = id.getText();
						cd.Modifiers = _modifiers;
						AddAttributes(cd.Attributes);
						container.Add(cd);
						genericParameters = cd.GenericParameters;
					
			}
			{
				switch ( LA(1) )
				{
				case LBRACK:
				{
					match(LBRACK);
					{
						switch ( LA(1) )
						{
						case OF:
						{
							match(OF);
							break;
						}
						case ID:
						{
							break;
						}
						default:
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						 }
					}
					generic_parameter_declaration_list(genericParameters);
					match(RBRACK);
					break;
				}
				case LPAREN:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			match(LPAREN);
			parameter_declaration_list(cd.Parameters);
			match(RPAREN);
			{
				switch ( LA(1) )
				{
				case AS:
				{
					match(AS);
					returnType=type_reference();
					if (0==inputState.guessing)
					{
						cd.ReturnType=returnType;
					}
					break;
				}
				case EOL:
				case EOS:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			eos();
			docstring(cd);
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "callable_definition");
//.........这里部分代码省略.........
开发者ID:hlizard,项目名称:boo,代码行数:101,代码来源:BooParserBase.cs

示例4: enum_definition

	protected void enum_definition(
		TypeMemberCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		IToken  id = null;
		
				EnumDefinition ed = null;
				TypeMemberCollection members = null;
			
		
		try {      // for error handling
			match(ENUM);
			id = LT(1);
			match(ID);
			if (0==inputState.guessing)
			{
				ed = new EnumDefinition(ToLexicalInfo(id));
			}
			begin_with_doc(ed);
			if (0==inputState.guessing)
			{
				
							ed.Name = id.getText();
							ed.Modifiers = _modifiers;
							AddAttributes(ed.Attributes);
							container.Add(ed);
							members = ed.Members;
						
			}
			{
				switch ( LA(1) )
				{
				case PASS:
				{
					{
						match(PASS);
						eos();
					}
					break;
				}
				case ID:
				case LBRACK:
				case SPLICE_BEGIN:
				{
					{ // ( ... )+
						int _cnt48=0;
						for (;;)
						{
							switch ( LA(1) )
							{
							case ID:
							case LBRACK:
							{
								enum_member(members);
								break;
							}
							case SPLICE_BEGIN:
							{
								splice_type_definition_body(members);
								break;
							}
							default:
							{
								if (_cnt48 >= 1) { goto _loop48_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
							}
							break; }
							_cnt48++;
						}
_loop48_breakloop:						;
					}    // ( ... )+
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			end(ed);
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "enum_definition");
				recover(ex,tokenSet_22_);
			}
			else
			{
				throw ex;
			}
		}
	}
开发者ID:hlizard,项目名称:boo,代码行数:94,代码来源:BooParserBase.cs

示例5: interface_definition

	protected void interface_definition(
		TypeMemberCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		IToken  id = null;
		IToken  begin = null;
		
				InterfaceDefinition itf = null;
				TypeMemberCollection members = null;
				GenericParameterDeclarationCollection genericParameters = null;
				Expression nameSplice = null;
			
		
		try {      // for error handling
			match(INTERFACE);
			{
				switch ( LA(1) )
				{
				case ID:
				{
					id = LT(1);
					match(ID);
					break;
				}
				case SPLICE_BEGIN:
				{
					{
						begin = LT(1);
						match(SPLICE_BEGIN);
						nameSplice=atom();
					}
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			if (0==inputState.guessing)
			{
				
						IToken token = id ?? begin;
						itf = new InterfaceDefinition(ToLexicalInfo(token));
						itf.Name = token.getText();
						itf.Modifiers = _modifiers;
						AddAttributes(itf.Attributes);
						if (id != null) {
							container.Add(itf);
						} else {
							container.Add(new SpliceTypeMember(itf, nameSplice));
						}
						members = itf.Members;
						genericParameters = itf.GenericParameters;
					
			}
			{
				switch ( LA(1) )
				{
				case LBRACK:
				{
					match(LBRACK);
					{
						switch ( LA(1) )
						{
						case OF:
						{
							match(OF);
							break;
						}
						case ID:
						{
							break;
						}
						default:
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						 }
					}
					generic_parameter_declaration_list(genericParameters);
					match(RBRACK);
					break;
				}
				case LPAREN:
				case COLON:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			{
				switch ( LA(1) )
				{
				case LPAREN:
//.........这里部分代码省略.........
开发者ID:hlizard,项目名称:boo,代码行数:101,代码来源:BooParserBase.cs

示例6: Lift

 public static TypeMemberCollection Lift(Block block)
 {
     var members = new TypeMemberCollection();
     foreach (var stmt in block.Statements)
         members.Add(TypeMember.Lift(stmt));
     return members;
 }
开发者ID:elfrostie,项目名称:boo,代码行数:7,代码来源:TypeMember.cs

示例7: interface_property

	protected void interface_property(
		TypeMemberCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		IToken  id1 = null;
		IToken  s = null;
		
				IToken id = null;
		Property p = null;
		TypeReference tr = null;
		ParameterDeclarationCollection parameters = null;
		
		
		try {      // for error handling
			{
				switch ( LA(1) )
				{
				case ID:
				{
					id1 = LT(1);
					match(ID);
					if (0==inputState.guessing)
					{
						id=id1;
					}
					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)
			{
				
				p = new Property(ToLexicalInfo(id));
				p.Name = id.getText();
				AddAttributes(p.Attributes);
				container.Add(p);
				parameters = p.Parameters;
				
			}
			{
				switch ( LA(1) )
				{
				case LPAREN:
				case LBRACK:
				{
					{
						switch ( LA(1) )
						{
						case LBRACK:
						{
							match(LBRACK);
							break;
						}
						case LPAREN:
						{
							match(LPAREN);
							break;
						}
						default:
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						 }
					}
					parameter_declaration_list(parameters);
					{
						switch ( LA(1) )
						{
						case RBRACK:
						{
							match(RBRACK);
							break;
						}
						case RPAREN:
						{
							match(RPAREN);
							break;
						}
						default:
						{
							throw new NoViableAltException(LT(1), getFilename());
						}
						 }
					}
					break;
//.........这里部分代码省略.........
开发者ID:hlizard,项目名称:boo,代码行数:101,代码来源:BooParserBase.cs

示例8: field_or_property


//.........这里部分代码省略.........
								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:
开发者ID:hlizard,项目名称:boo,代码行数:67,代码来源:BooParserBase.cs

示例9: interface_method

        //throws RecognitionException, TokenStreamException
        protected void interface_method(
            TypeMemberCollection container
            )
        {
            Method m = null;
                TypeReference rt = null;
                IToken id = null;

            try {      // for error handling
            match(DEF);
            id=member();
            if (0==inputState.guessing)
            {

                        m = new Method(SourceLocationFactory.ToLexicalInfo(id));
                        m.Name = id.getText();
                        AddAttributes(m.Attributes);
                        container.Add(m);

            }
            {
                switch ( LA(1) )
                {
                case LBRACK:
                {
                    {
                        match(LBRACK);
                        {
                            switch ( LA(1) )
                            {
                            case OF:
                            {
                                match(OF);
                                break;
                            }
                            case ID:
                            {
                                break;
                            }
                            default:
                            {
                                throw new NoViableAltException(LT(1), getFilename());
                            }
                             }
                        }
                        generic_parameter_declaration_list(m.GenericParameters);
                        match(RBRACK);
                    }
                    break;
                }
                case OF:
                {
                    {
                        match(OF);
                        generic_parameter_declaration(m.GenericParameters);
                    }
                    break;
                }
                case LPAREN:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            match(LPAREN);
            parameter_declaration_list(m.Parameters);
            match(RPAREN);
            {
                switch ( LA(1) )
                {
                case AS:
                {
                    match(AS);
                    rt=type_reference();
                    if (0==inputState.guessing)
                    {
                        m.ReturnType=rt;
                    }
                    break;
                }
                case EOF:
                case EOS:
                case NEWLINE:
                case COLON:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            {
                switch ( LA(1) )
//.........这里部分代码省略.........
开发者ID:0xb1dd1e,项目名称:boo,代码行数:101,代码来源:WSABooParserBase.cs

示例10: interface_definition

        //throws RecognitionException, TokenStreamException
        protected void interface_definition(
            TypeMemberCollection container
            )
        {
            IToken  id = null;

                InterfaceDefinition itf = null;
                TypeMemberCollection members = null;
                GenericParameterDeclarationCollection genericParameters = null;

            try {      // for error handling
            match(INTERFACE);
            id = LT(1);
            match(ID);
            if (0==inputState.guessing)
            {

                        itf = new InterfaceDefinition(SourceLocationFactory.ToLexicalInfo(id));
                        itf.Name = id.getText();
                        itf.Modifiers = _modifiers;
                        AddAttributes(itf.Attributes);
                        container.Add(itf);
                        members = itf.Members;
                        genericParameters = itf.GenericParameters;

            }
            {
                switch ( LA(1) )
                {
                case LBRACK:
                {
                    match(LBRACK);
                    {
                        switch ( LA(1) )
                        {
                        case OF:
                        {
                            match(OF);
                            break;
                        }
                        case ID:
                        {
                            break;
                        }
                        default:
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                         }
                    }
                    generic_parameter_declaration_list(genericParameters);
                    match(RBRACK);
                    break;
                }
                case LPAREN:
                case COLON:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            {
                switch ( LA(1) )
                {
                case LPAREN:
                {
                    base_types(itf.BaseTypes);
                    break;
                }
                case COLON:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            begin_with_doc(itf);
            {    // ( ... )*
                for (;;)
                {
                    if ((tokenSet_33_.member(LA(1))))
                    {
                        attributes();
                        {
                            switch ( LA(1) )
                            {
                            case DEF:
                            {
                                interface_method(members);
                                break;
                            }
                            case EVENT:
//.........这里部分代码省略.........
开发者ID:0xb1dd1e,项目名称:boo,代码行数:101,代码来源:WSABooParserBase.cs

示例11: field_or_property

        //throws RecognitionException, TokenStreamException
        protected void field_or_property(
            TypeMemberCollection container
            )
        {
            IToken  id1 = null;
            IToken  s = null;
            IToken  id2 = 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;

            try {      // for error handling
            bool synPredMatched132 = false;
            if (((LA(1)==SELF||LA(1)==ID) && (tokenSet_50_.member(LA(2)))))
            {
                int _m132 = mark();
                synPredMatched132 = true;
                inputState.guessing++;
                try {
                    {
                        property_header();
                    }
                }
                catch (RecognitionException)
                {
                    synPredMatched132 = false;
                }
                rewind(_m132);
                inputState.guessing--;
            }
            if ( synPredMatched132 )
            {
                {
                    {
                        if ((LA(1)==ID) && (LA(2)==DOT))
                        {
                            emi=explicit_member_info();
                        }
                        else if ((LA(1)==SELF||LA(1)==ID) && (tokenSet_51_.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 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(SourceLocationFactory.ToLexicalInfo(id));
                                            p.Name = id.getText();
                                            p.ExplicitInfo = emi;
                                            AddAttributes(p.Attributes);
                                            parameters = p.Parameters;

                        }
                        {
                            switch ( LA(1) )
                            {
                            case LPAREN:
//.........这里部分代码省略.........
开发者ID:0xb1dd1e,项目名称:boo,代码行数:101,代码来源:WSABooParserBase.cs

示例12: enum_member

        //throws RecognitionException, TokenStreamException
        protected void enum_member(
            TypeMemberCollection container
            )
        {
            IToken  id = null;

                EnumMember em = null;
                IntegerLiteralExpression initializer = null;
                bool negative = false;

            try {      // for error handling
            attributes();
            id = LT(1);
            match(ID);
            {
                switch ( LA(1) )
                {
                case ASSIGN:
                {
                    match(ASSIGN);
                    {
                        if ((LA(1)==SUBTRACT) && (LA(2)==SUBTRACT||LA(2)==LONG||LA(2)==INT))
                        {
                            match(SUBTRACT);
                            if (0==inputState.guessing)
                            {
                                negative = true;
                            }
                        }
                        else if ((LA(1)==SUBTRACT||LA(1)==LONG||LA(1)==INT) && (tokenSet_42_.member(LA(2)))) {
                        }
                        else
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }

                    }
                    initializer=integer_literal();
                    break;
                }
                case EOF:
                case EOS:
                case NEWLINE:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            if (0==inputState.guessing)
            {

                        em = new EnumMember(SourceLocationFactory.ToLexicalInfo(id));
                        em.Name = id.getText();
                        em.Initializer = initializer;
                        if (negative && null != initializer)
                        {
                            initializer.Value *= -1;
                        }
                        AddAttributes(em.Attributes);
                        container.Add(em);

            }
            eos();
            docstring(em);
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_43_);
            }
            else
            {
                throw ex;
            }
            }
        }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:83,代码来源:WSABooParserBase.cs

示例13: class_definition

        //throws RecognitionException, TokenStreamException
        protected void class_definition(
            TypeMemberCollection container
            )
        {
            IToken  id = null;

                TypeDefinition td = null;
                TypeReferenceCollection baseTypes = null;
                TypeMemberCollection members = null;
                GenericParameterDeclarationCollection genericParameters = null;

            try {      // for error handling
            {
                switch ( LA(1) )
                {
                case CLASS:
                {
                    match(CLASS);
                    if (0==inputState.guessing)
                    {
                        td = new ClassDefinition();
                    }
                    break;
                }
                case STRUCT:
                {
                    match(STRUCT);
                    if (0==inputState.guessing)
                    {
                        td = new StructDefinition();
                    }
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            id = LT(1);
            match(ID);
            if (0==inputState.guessing)
            {

                        td.LexicalInfo = SourceLocationFactory.ToLexicalInfo(id);
                        td.Name = id.getText();
                        td.Modifiers = _modifiers;
                        AddAttributes(td.Attributes);
                        container.Add(td);
                        baseTypes = td.BaseTypes;
                        members = td.Members;
                        genericParameters = td.GenericParameters;

            }
            {
                switch ( LA(1) )
                {
                case LBRACK:
                {
                    match(LBRACK);
                    {
                        switch ( LA(1) )
                        {
                        case OF:
                        {
                            match(OF);
                            break;
                        }
                        case ID:
                        {
                            break;
                        }
                        default:
                        {
                            throw new NoViableAltException(LT(1), getFilename());
                        }
                         }
                    }
                    generic_parameter_declaration_list(genericParameters);
                    match(RBRACK);
                    break;
                }
                case LPAREN:
                case COLON:
                {
                    break;
                }
                default:
                {
                    throw new NoViableAltException(LT(1), getFilename());
                }
                 }
            }
            {
                switch ( LA(1) )
                {
                case LPAREN:
                {
                    base_types(baseTypes);
//.........这里部分代码省略.........
开发者ID:0xb1dd1e,项目名称:boo,代码行数:101,代码来源:WSABooParserBase.cs

示例14: enum_definition

        //throws RecognitionException, TokenStreamException
        protected void enum_definition(
            TypeMemberCollection container
            )
        {
            IToken  id = null;

                EnumDefinition ed = null;

            try {      // for error handling
            match(ENUM);
            id = LT(1);
            match(ID);
            if (0==inputState.guessing)
            {
                ed = new EnumDefinition(ToLexicalInfo(id));
            }
            begin_with_doc(ed);
            if (0==inputState.guessing)
            {

                        ed.Name = id.getText();
                        ed.Modifiers = _modifiers;
                        AddAttributes(ed.Attributes);
                        container.Add(ed);

            }
            {
                { // ( ... )+
                    int _cnt40=0;
                    for (;;)
                    {
                        if ((LA(1)==ID||LA(1)==LBRACK))
                        {
                            enum_member(ed);
                        }
                        else
                        {
                            if (_cnt40 >= 1) { goto _loop40_breakloop; } else { throw new NoViableAltException(LT(1), getFilename());; }
                        }

                        _cnt40++;
                    }
            _loop40_breakloop:					;
                }    // ( ... )+
            }
            end(ed);
            }
            catch (RecognitionException ex)
            {
            if (0 == inputState.guessing)
            {
                reportError(ex);
                recover(ex,tokenSet_20_);
            }
            else
            {
                throw ex;
            }
            }
        }
开发者ID:elfrostie,项目名称:boo,代码行数:61,代码来源:BooParserBase.cs

示例15: LiftBlockInto

		private static void LiftBlockInto(TypeMemberCollection collection, Block block)
		{
			foreach (var stmt in block.Statements)
			{
				var childBlock = stmt as Block;
				if (childBlock != null)
					LiftBlockInto(collection, childBlock);
				else
					collection.Add(TypeMember.Lift(stmt));
			}
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:11,代码来源:TypeMember.cs


注:本文中的Boo.Lang.Compiler.Ast.TypeMemberCollection.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。