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


C# Ast.TypeMemberCollection类代码示例

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


TypeMemberCollection类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了TypeMemberCollection类的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: 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

示例3: type_member

	protected void type_member(
		TypeMemberCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		
		try {      // for error handling
			attributes();
			modifiers();
			{
				switch ( LA(1) )
				{
				case CALLABLE:
				case CLASS:
				case ENUM:
				case INTERFACE:
				case STRUCT:
				{
					type_definition(container);
					break;
				}
				case CONSTRUCTOR:
				case DEF:
				case DESTRUCTOR:
				{
					method(container);
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "type_member");
				recover(ex,tokenSet_16_);
			}
			else
			{
				throw ex;
			}
		}
	}
开发者ID:hlizard,项目名称:boo,代码行数:48,代码来源:BooParserBase.cs

示例4: 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

示例5: field_or_property

	protected void field_or_property(
		TypeMemberCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		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 synPredMatched156 = false;
				if (((LA(1)==SELF||LA(1)==ID||LA(1)==SPLICE_BEGIN) && (tokenSet_34_.member(LA(2)))))
				{
					int _m156 = mark();
					synPredMatched156 = true;
					inputState.guessing++;
					try {
						{
							property_header();
						}
					}
					catch (RecognitionException)
					{
						synPredMatched156 = false;
					}
					rewind(_m156);
					inputState.guessing--;
				}
				if ( synPredMatched156 )
				{
					{
						{
							if ((LA(1)==ID) && (LA(2)==DOT))
							{
								emi=explicit_member_info();
							}
							else if ((LA(1)==SELF||LA(1)==ID||LA(1)==SPLICE_BEGIN) && (tokenSet_34_.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());
							}
							 }
						}
						{
//.........这里部分代码省略.........
开发者ID:hlizard,项目名称:boo,代码行数:101,代码来源:BooParserBase.cs

示例6: splice_type_definition_body

	public void splice_type_definition_body(
		TypeMemberCollection container
	) //throws RecognitionException, TokenStreamException
{
		
		IToken  begin = null;
		
			Expression e = null;
		
		
		try {      // for error handling
			begin = LT(1);
			match(SPLICE_BEGIN);
			e=atom();
			eos();
			if (0==inputState.guessing)
			{
				
						container.Add(new SpliceTypeDefinitionBody(e));
					
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "splice_type_definition_body");
				recover(ex,tokenSet_49_);
			}
			else
			{
				throw ex;
			}
		}
	}
开发者ID:hlizard,项目名称:boo,代码行数:35,代码来源:BooParserBase.cs

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: type_member_stmt

        //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;
            }
            }
        }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:29,代码来源:WSABooParserBase.cs

示例13: 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

示例14: 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

示例15: Lift

		public static TypeMemberCollection Lift(Block block)
		{
			var members = new TypeMemberCollection();
			LiftBlockInto(members, block);
			return members;
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:6,代码来源:TypeMember.cs


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