• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Ast.Declaration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Declaration类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了Declaration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: LeaveDeclaration

 public override void LeaveDeclaration(Declaration node)
 {
     // Special exemption made for anonymous exception handlers
     if(!(node.ParentNode is ExceptionHandler) ||
        ((node.ParentNode as ExceptionHandler).Flags
         & ExceptionHandlerFlags.Anonymous) == ExceptionHandlerFlags.None)
     {
         CheckName(node,node.Name);
     }
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:10,代码来源:CheckIdentifiers.cs


示例2: read

 public static Statement read (Expression expression){
     Declaration declaraion = new Declaration();
     declaraion.Name = "readedContent";
     Expression arg = null;
     
     if (expression is BinaryExpression){
         var ass = expression as BinaryExpression;
         declaraion.Name=ass.Left.LiftToString();
         arg = ass.Right;
     }else{
         arg = expression;
     }
     MethodInvocationExpression assign = AstUtil.CreateMethodInvocationExpression(AstUtil.CreateReferenceExpression("System.IO.File.ReadAllText"), arg);
     var result =  new DeclarationStatement(declaraion, assign);
     return result;
 }
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:16,代码来源:Metas.cs


示例3: declaration

        public Declaration declaration()
        {
            Declaration declaration = null;
            try
            {
                TypeReference reference;
                this.match(0x2d);
                IToken token = this.identifier();
                switch (this.LA(1))
                {
                    case 0x42:
                        this.match(0x42);
                        reference = this.type_reference();
                        break;

                    case 1:
                    case 5:
                    case 7:
                    case 8:
                    case 9:
                    case 10:
                    case 11:
                    case 12:
                    case 13:
                    case 15:
                    case 0x10:
                    case 0x11:
                    case 0x12:
                    case 0x13:
                    case 20:
                    case 0x15:
                    case 0x18:
                    case 0x19:
                    case 0x1b:
                    case 0x1d:
                    case 30:
                    case 0x1f:
                    case 0x20:
                    case 0x21:
                    case 0x23:
                    case 0x24:
                    case 0x25:
                    case 0x26:
                    case 0x27:
                    case 40:
                    case 0x29:
                    case 0x2a:
                    case 0x2b:
                    case 0x2c:
                    case 0x2d:
                    case 0x2e:
                    case 0x2f:
                    case 0x30:
                    case 0x31:
                    case 50:
                    case 0x33:
                    case 0x3b:
                    case 60:
                    case 0x3d:
                    case 0x3e:
                    case 0x3f:
                    case 0x44:
                    case 0x4d:
                    case 0x4e:
                    case 0x4f:
                    case 80:
                    case 0x52:
                    case 0x58:
                    case 0x63:
                    case 0x67:
                    case 0x69:
                    case 0x6a:
                    case 0x6b:
                    case 0x6c:
                    case 0x6d:
                        break;

                    default:
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                }
                if (base.inputState.guessing == 0)
                {
                    Declaration declaration2;
                    Declaration declaration1 = declaration2 = new Declaration(ToLexicalInfo(token));
                    declaration2.set_Name(token.getText());
                    declaration2.set_Type(reference);
                    declaration = declaration2;
                }
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_50_);
                return declaration;
            }
            return declaration;
//.........这里部分代码省略.........
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:101,代码来源:UnityScriptParser.cs


示例4: DeclareLocal

        void DeclareLocal(Declaration d, bool privateScope)
        {
            AssertIdentifierName(d, d.Name);

            var local = DeclareLocal(d, d.Name, GetType(d.Type), privateScope);
            d.Entity = local;

            var internalLocal = local as InternalLocal;
            if (internalLocal != null)
                internalLocal.OriginalDeclaration = d;
        }
开发者ID:stuman08,项目名称:boo,代码行数:11,代码来源:ProcessMethodBodies.cs


示例5: ProcessDeclarationForIterator

        protected void ProcessDeclarationForIterator(Declaration d, IType defaultDeclType)
        {
            var local = LocalToReuseFor(d);
            if (local != null)
            {
                var localType = ((InternalLocal)GetEntity(local)).Type;
                AssertTypeCompatibility(d, localType, defaultDeclType);

                d.Type = CodeBuilder.CreateTypeReference(localType);
                d.Entity = local.Entity;
                return;
            }
            GetDeclarationType(defaultDeclType, d);
            DeclareLocal(d, true);
        }
开发者ID:stuman08,项目名称:boo,代码行数:15,代码来源:ProcessMethodBodies.cs


示例6: AssertUniqueLocal

 protected bool AssertUniqueLocal(Declaration d)
 {
     if (null == _currentMethod.ResolveLocal(d.Name) &&
         null == _currentMethod.ResolveParameter(d.Name))
         return true;
     Error(CompilerErrorFactory.LocalAlreadyExists(d, d.Name));
     return false;
 }
开发者ID:stuman08,项目名称:boo,代码行数:8,代码来源:ProcessMethodBodies.cs


示例7: declaration

	protected Declaration  declaration() //throws RecognitionException, TokenStreamException
{
		Declaration d;
		
		IToken  id = null;
		
				d = null;
				TypeReference tr = null;
			
		
		try {      // for error handling
			id = LT(1);
			match(ID);
			{
				switch ( LA(1) )
				{
				case AS:
				{
					match(AS);
					tr=type_reference();
					break;
				}
				case IN:
				case ASSIGN:
				case COMMA:
				{
					break;
				}
				default:
				{
					throw new NoViableAltException(LT(1), getFilename());
				}
				 }
			}
			if (0==inputState.guessing)
			{
				
						d = new Declaration(ToLexicalInfo(id));
						d.Name = id.getText();
						d.Type = tr;
					
			}
		}
		catch (RecognitionException ex)
		{
			if (0 == inputState.guessing)
			{
				reportError(ex, "declaration");
				recover(ex,tokenSet_94_);
			}
			else
			{
				throw ex;
			}
		}
		return d;
	}
开发者ID:hlizard,项目名称:boo,代码行数:57,代码来源:BooParserBase.cs


示例8: OnDeclaration

			public override void OnDeclaration(Declaration node)
			{
				if (!_skippedReferences.ContainsKey(node.Name))
				{
					_skippedReferences.Add(node.Name, node);
				}

				base.OnDeclaration(node);
			}
开发者ID:Qorpent,项目名称:comdiv.oldcore,代码行数:9,代码来源:DslMacro.cs


示例9: DeclareLocal

 void DeclareLocal(Declaration d, bool privateScope)
 {
     if (AssertIdentifierName(d, d.Name))
     {
         d.Entity = DeclareLocal(d, d.Name, GetType(d.Type), privateScope);
     }
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:7,代码来源:ProcessMethodBodies.cs


示例10: Local

 public Local(Declaration declaration, bool privateScope)
 {
     _name = declaration.Name;
      			LexicalInfo = declaration.LexicalInfo;
      			_privateScope = privateScope;
 }
开发者ID:boo,项目名称:boo-lang,代码行数:6,代码来源:Local.cs


示例11: Clone

		override public object Clone()
		{
		
			Declaration clone = new Declaration();
			clone._lexicalInfo = _lexicalInfo;
			clone._endSourceLocation = _endSourceLocation;
			clone._documentation = _documentation;
			clone._isSynthetic = _isSynthetic;
			clone._entity = _entity;
			if (_annotations != null) clone._annotations = (Hashtable)_annotations.Clone();
			clone._name = _name;
			if (null != _type)
			{
				clone._type = _type.Clone() as TypeReference;
				clone._type.InitializeParent(clone);
			}
			return clone;


		}
开发者ID:Rfvgyhn,项目名称:boo,代码行数:20,代码来源:DeclarationImpl.cs


示例12: OnDeclaration

 public override void OnDeclaration(Declaration d)
 {
     Write(d.Name);
     WriteTypeReference(d.Type);
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:5,代码来源:BooPrinterVisitor.cs


示例13: try_statement

        public void try_statement(Block container)
        {
            IToken token = null;
            IToken token2 = null;
            IToken token3 = null;
            try
            {
                TryStatement statement;
                Block block;
                token = this.LT(1);
                this.match(0x2b);
                if (base.inputState.guessing == 0)
                {
                    statement = new TryStatement(ToLexicalInfo(token));
                    block = statement.get_ProtectedBlock();
                    container.Add(statement);
                }
                this.compound_or_single_stmt(block);
                while (true)
                {
                    TypeReference reference;
                    if ((this.LA(1) != 7) || (this.LA(2) != 0x3f))
                    {
                        break;
                    }
                    token2 = this.LT(1);
                    this.match(7);
                    this.match(0x3f);
                    token3 = this.LT(1);
                    this.match(0x3b);
                    switch (this.LA(1))
                    {
                        case 0x42:
                            this.match(0x42);
                            reference = this.type_reference();
                            break;

                        case 0x40:
                            break;

                        default:
                            throw new NoViableAltException(this.LT(1), this.getFilename());
                    }
                    this.match(0x40);
                    if (base.inputState.guessing == 0)
                    {
                        Declaration declaration;
                        ExceptionHandler handler;
                        if (reference == null)
                        {
                            reference = new SimpleTypeReference(ToLexicalInfo(token3), "System.Exception");
                        }
                        ExceptionHandler handler1 = handler = new ExceptionHandler(ToLexicalInfo(token2));
                        Declaration declaration1 = declaration = new Declaration(ToLexicalInfo(token3));
                        declaration.set_Name(token3.getText());
                        declaration.set_Type(reference);
                        handler.set_Declaration(declaration);
                        ExceptionHandler handler2 = handler;
                        statement.get_ExceptionHandlers().Add(handler2);
                        block = handler2.get_Block();
                        reference = null;
                    }
                    this.compound_or_single_stmt(block);
                }
                if ((this.LA(1) != 0x11) || !tokenSet_2_.member(this.LA(2)))
                {
                    if (!tokenSet_15_.member(this.LA(1)) || !tokenSet_20_.member(this.LA(2)))
                    {
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                    }
                }
                else
                {
                    this.finally_block(statement);
                }
            }
            catch (RecognitionException exception)
            {
                if (base.inputState.guessing != 0)
                {
                    throw;
                }
                this.reportError(exception);
                this.recover(exception, tokenSet_15_);
            }
        }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:86,代码来源:UnityScriptParser.cs


示例14: array_literal

        public Expression array_literal()
        {
            Expression expression = null;
            IToken token = null;
            try
            {
                token = this.LT(1);
                this.match(0x44);
                bool flag = false;
                if (tokenSet_16_.member(this.LA(1)) && tokenSet_59_.member(this.LA(2)))
                {
                    int num = this.mark();
                    flag = true;
                    base.inputState.guessing++;
                    try
                    {
                        this.expression();
                        this.match(0x12);
                    }
                    catch (RecognitionException)
                    {
                        flag = false;
                    }
                    this.rewind(num);
                    base.inputState.guessing--;
                }
                if (flag)
                {
                    IToken token2;
                    Declaration declaration;
                    Expression expression4;
                    Expression projection = this.expression();
                    this.match(0x12);
                    this.match(0x3f);
                    int num2 = this.LA(1);
                    switch (num2)
                    {
                        case 12:
                        case 0x10:
                        case 0x21:
                        case 0x3b:
                            token2 = this.identifier();
                            break;

                        default:
                            if (num2 != 0x2d)
                            {
                                throw new NoViableAltException(this.LT(1), this.getFilename());
                            }
                            declaration = this.declaration();
                            break;
                    }
                    this.match(0x18);
                    Expression expression3 = this.expression();
                    this.match(0x40);
                    switch (this.LA(1))
                    {
                        case 0x15:
                            this.match(0x15);
                            expression4 = this.expression();
                            break;

                        case 0x45:
                            break;

                        default:
                            throw new NoViableAltException(this.LT(1), this.getFilename());
                    }
                    if (base.inputState.guessing == 0)
                    {
                        if (token2 != null)
                        {
                            Declaration declaration2;
                            Declaration declaration1 = declaration2 = new Declaration(ToLexicalInfo(token2));
                            declaration2.set_Name(token2.getText());
                            declaration = declaration2;
                        }
                        expression = CodeFactory.NewArrayComprehension(ToLexicalInfo(token), projection, declaration, expression3, expression4);
                    }
                }
                else
                {
                    ExpressionCollection expressions;
                    if (!tokenSet_60_.member(this.LA(1)) || !tokenSet_20_.member(this.LA(2)))
                    {
                        throw new NoViableAltException(this.LT(1), this.getFilename());
                    }
                    if (base.inputState.guessing == 0)
                    {
                        ArrayLiteralExpression expression5;
                        expression = expression5 = new ArrayLiteralExpression(ToLexicalInfo(token));
                        expressions = expression5.get_Items();
                    }
                    this.expression_list(expressions);
                }
                this.match(0x45);
            }
            catch (RecognitionException exception2)
            {
                if (base.inputState.guessing != 0)
//.........这里部分代码省略.........
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:101,代码来源:UnityScriptParser.cs


示例15: for_in

 public Statement for_in(Block container)
 {
     Statement stmt = null;
     try
     {
         Declaration declaration2;
         Block block;
         int num = this.LA(1);
         switch (num)
         {
             case 12:
             case 0x10:
             case 0x21:
             case 0x3b:
             {
                 IToken token = this.identifier();
                 if (base.inputState.guessing == 0)
                 {
                     Declaration declaration;
                     Declaration declaration1 = declaration = new Declaration(ToLexicalInfo(token));
                     declaration.set_Name(token.getText());
                     declaration2 = declaration;
                 }
                 break;
             }
             default:
                 if (num != 0x2d)
                 {
                     throw new NoViableAltException(this.LT(1), this.getFilename());
                 }
                 declaration2 = this.declaration();
                 if (base.inputState.guessing == 0)
                 {
                     DeclarationAnnotations.ForceNewVariable(declaration2);
                 }
                 break;
         }
         this.match(0x18);
         Expression expression = this.expression();
         if (base.inputState.guessing == 0)
         {
             ForStatement statement2;
             ForStatement statement1 = statement2 = new ForStatement();
             statement2.set_Iterator(expression);
             ForStatement statement3 = statement2;
             statement3.get_Declarations().Add(declaration2);
             block = statement3.get_Block();
             stmt = statement3;
             container.Add(stmt);
             this.EnterLoop(stmt);
         }
         this.match(0x40);
         this.compound_or_single_stmt(block);
         if (base.inputState.guessing == 0)
         {
             this.LeaveLoop(stmt);
         }
     }
     catch (RecognitionException exception)
     {
         if (base.inputState.guessing != 0)
         {
             throw;
         }
         this.reportError(exception);
         this.recover(exception, tokenSet_15_);
         return stmt;
     }
     return stmt;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:70,代码来源:UnityScriptParser.cs


示例16: DeclarationsNamespace

		public DeclarationsNamespace(INamespace parent, Declaration declaration)
		{
			_parent = parent;
			_declarations = new DeclarationCollection { declaration };
		}
开发者ID:HaKDMoDz,项目名称:GNet,代码行数:5,代码来源:DeclarationsNamespace.cs


示例17: declaration_stmt

        //throws RecognitionException, TokenStreamException
        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);
                        initializer=declaration_initializer();
                    }
                    break;
                }
                case EOF:
                case IF:
                case UNLESS:
                case WHILE:
                case EOS:
                case NEWLINE:
                {
                    {
                        {
                            switch ( LA(1) )
                            {
                            case IF:
                            case UNLESS:
                            case WHILE:
                            {
                                m=stmt_modifier();
                                break;
                            }
                            case EOF:
                            case EOS:
                            case NEWLINE:
                            {
                                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(SourceLocationFactory.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);
                recover(ex,tokenSet_79_);
            }
            else
            {
                throw ex;
            }
            }
            return s;
        }
开发者ID:0xb1dd1e,项目名称:boo,代码行数:96,代码来源:WSABooParserBase.cs


示例18: ForceNewVariable

 public static void ForceNewVariable(Declaration d)
 {
     d.Annotate(NewVariableAnnotation);
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:4,代码来源:DeclarationAnnotations.cs


示例19: DeclarationsNamespace

 public DeclarationsNamespace(INamespace parent, TypeSystemServices tagManager, Declaration declaration)
 {
     _parent = parent;
     _declarations = new DeclarationCollection();
     _declarations.Add(declaration);
 }
开发者ID:boo,项目名称:boo-lang,代码行数:6,代码来源:DeclarationsNamespace.cs


示例20: ShouldForceNewVariableFor

 public static bool ShouldForceNewVariableFor(Declaration d)
 {
     return d.ContainsAnnotation(NewVariableAnnotation);
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:4,代码来源:DeclarationAnnotations.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Ast.EnumDefinition类代码示例发布时间:2022-05-24
下一篇:
C# Ast.Constructor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap