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


C# IBlockNode.Add方法代码示例

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


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

示例1: NewExpression

        IExpression NewExpression(IBlockNode Scope = null)
        {
            Expect(New);
            var startLoc = t.Location;

            IExpression[] newArgs = null;
            // NewArguments
            if (laKind == (OpenParenthesis))
            {
                Step();
                if (laKind != (CloseParenthesis))
                    newArgs = ArgumentList(Scope).ToArray();
                Expect(CloseParenthesis);
            }

            /*
             * If there occurs a class keyword here, interpretate it as an anonymous class definition
             * http://digitalmars.com/d/2.0/expression.html#NewExpression
             *
             * NewArguments ClassArguments BaseClasslist_opt { DeclDefs }
             *
             * http://digitalmars.com/d/2.0/class.html#anonymous
             *
                NewAnonClassExpression:
                    new PerenArgumentListopt class PerenArgumentList_opt SuperClass_opt InterfaceClasses_opt ClassBody

                PerenArgumentList:
                    (ArgumentList)
             *
             */
            if (laKind == (Class))
            {
                Step();
                var ac = new AnonymousClassExpression();
                ac.NewArguments = newArgs;

                // ClassArguments
                if (laKind == (OpenParenthesis))
                {
                    Step();
                    if (laKind == (CloseParenthesis))
                        Step();
                    else
                        ac.ClassArguments = ArgumentList(Scope).ToArray();
                }

                var anclass = new DClassLike(Class) { IsAnonymousClass=true, Name = "(Anonymous Class)" };

                // BaseClasslist_opt
                if (laKind == (Colon))
                {
                    //TODO : Add base classes to expression
                    BaseClassList(anclass);
                }
                // SuperClass_opt InterfaceClasses_opt
                else if (laKind != OpenCurlyBrace)
                    BaseClassList(anclass,false);

                ClassBody(anclass);

                ac.AnonymousClass = anclass;

                ac.Location = startLoc;
                ac.EndLocation = t.EndLocation;

                if (Scope != null)
                    Scope.Add(ac.AnonymousClass);

                return ac;
            }

            // NewArguments Type
            else
            {
                var nt = BasicType();

                while (IsBasicType2())
                {
                    var bt=BasicType2();
                    if (bt == null)
                        break;
                    bt.InnerDeclaration = nt;
                    nt = bt;
                }

                var initExpr = new NewExpression()
                {
                    NewArguments = newArgs,
                    Type=nt,
                    Location=startLoc
                };

                List<IExpression> args;

                var ad=nt as ArrayDecl;

                if ((ad == null || ad.ClampsEmpty) && laKind == OpenParenthesis) {
                    Step ();
                    if (laKind != CloseParenthesis)
                        args = ArgumentList (Scope);
//.........这里部分代码省略.........
开发者ID:rainers,项目名称:D_Parser,代码行数:101,代码来源:Parser_Impl.cs

示例2: PrimaryExpression


//.........这里部分代码省略.........
                    /*
                        listdir (".", delegate bool (DirEntry * de)
                        {
                            auto s = std.string.format("%s : c %s, w %s, a %s", de.name,
                                    toUTCString (de.creationTime),
                                    toUTCString (de.lastWriteTime),
                                    toUTCString (de.lastAccessTime));
                            return true;
                        }
                        );
                    */
                    if (laKind != OpenCurlyBrace) // foo( 1, {bar();} ); -> is a legal delegate
                    {
                        if (!IsFunctionAttribute && Lexer.CurrentPeekToken.Kind == OpenParenthesis)
                            fl.AnonymousMethod.Type = BasicType();
                        else if (laKind != OpenParenthesis && laKind != OpenCurlyBrace)
                            fl.AnonymousMethod.Type = Type();

                        if (laKind == OpenParenthesis)
                            fl.AnonymousMethod.Parameters = Parameters(fl.AnonymousMethod);

                        FunctionAttributes(fl.AnonymousMethod);
                    }

                    if (!IsEOF)
                    {
                        FunctionBody(fl.AnonymousMethod);
                        fl.EndLocation = fl.AnonymousMethod.EndLocation;
                    }
                    else
                        fl.EndLocation = la.Location;

                    if (Scope != null)
                        Scope.Add(fl.AnonymousMethod);

                    return fl;
                // AssertExpression
                case Assert:
                    Step();
                    startLoc = t.Location;
                    Expect(OpenParenthesis);
                    var ce = new AssertExpression() { Location=startLoc};

                    var exprs = new List<IExpression>();
                    exprs.Add(AssignExpression());

                    if (laKind == (Comma))
                    {
                        Step();
                        exprs.Add(AssignExpression());
                    }
                    ce.AssignExpressions = exprs.ToArray();
                    Expect(CloseParenthesis);
                    ce.EndLocation = t.EndLocation;
                    return ce;
                // MixinExpression
                case Mixin:
                    Step();
                    var me = new MixinExpression() { Location=t.Location};
                    if (Expect(OpenParenthesis))
                    {
                        me.AssignExpression = AssignExpression();
                        Expect(CloseParenthesis);
                    }
                    me.EndLocation = t.EndLocation;
                    return me;
开发者ID:rainers,项目名称:D_Parser,代码行数:67,代码来源:Parser_Impl.cs

示例3: Condition

        DeclarationCondition Condition(IBlockNode parent)
        {
            DeclarationCondition c = null;

            switch (laKind) {
            case Version:
                /*
                 * http://www.dlang.org/version.html#VersionSpecification
                 * VersionCondition:
                 *		version ( IntegerLiteral )
                 *		version ( Identifier )
                 *		version ( unittest )
                 *		version ( assert )
                 */
                Step ();
                if (Expect (OpenParenthesis)) {
                    switch (laKind) {
                    case Unittest:
                        Step ();
                        c = new VersionCondition ("unittest") { IdLocation = t.Location };
                        break;
                    case Assert:
                        Step ();
                        c = new VersionCondition ("assert") { IdLocation = t.Location };
                        break;
                    case Literal:
                        Step ();
                        if (t.LiteralFormat != LiteralFormat.Scalar)
                            SynErr (t.Kind, "Version number must be an integer");
                        else
                            c = new VersionCondition (Convert.ToInt32 (t.LiteralValue)) { IdLocation = t.Location };
                        break;
                    default:
                        if (Expect (Identifier))
                            c = new VersionCondition (t.Value) { IdLocation = t.Location };
                        else if (IsEOF) {
                            c = new VersionCondition (DTokens.IncompleteId);
                            parent.Add (new DVariable{ Attributes = new List<DAttribute>{ c } });
                        }
                        break;
                    }

                    Expect (CloseParenthesis);
                }

                if (c == null)
                    c = new VersionCondition ("");
                break;

            case Debug:
                /*
                 * DebugCondition:
                 *		debug
                 *		debug ( IntegerLiteral )
                 *		debug ( Identifier )
                 */
                Step ();
                if (laKind == OpenParenthesis) {
                    Step ();

                    if (laKind == Literal) {
                        Step ();
                        if (t.LiteralFormat != LiteralFormat.Scalar)
                            SynErr (t.Kind, "Debug level must be an integer");
                        else
                            c = new DebugCondition (Convert.ToInt32 (t.LiteralValue)) { IdLocation = t.Location };
                    } else if (Expect (Identifier))
                        c = new DebugCondition ((string)t.LiteralValue) { IdLocation = t.Location };
                    else if (IsEOF) {
                        c = new DebugCondition (DTokens.IncompleteId);
                        parent.Add (new DVariable{ Attributes = new List<DAttribute>{ c } });
                    }

                    Expect (CloseParenthesis);
                }

                if (c == null)
                    c = new DebugCondition ();
                break;

            case Static:
                /*
                 * StaticIfCondition:
                 *		static if ( AssignExpression )
                 */
                Step ();
                if (Expect (If) && Expect (OpenParenthesis)) {
                    var x = AssignExpression (parent);
                    c = new StaticIfCondition (x);

                    if (!Expect (CloseParenthesis) && IsEOF)
                        parent.Add (new DVariable{ Attributes = new List<DAttribute>{ c } });
                } else
                    c = new StaticIfCondition (null);
                break;

            default:
                throw new Exception("Condition() should only be called if Version/Debug/If is the next token!");
            }

//.........这里部分代码省略.........
开发者ID:rainers,项目名称:D_Parser,代码行数:101,代码来源:Parser_Impl.cs

示例4: LambaExpression

        FunctionLiteral LambaExpression(IBlockNode Scope=null)
        {
            var fl = new FunctionLiteral(true);

            fl.Location = fl.AnonymousMethod.Location = la.Location;

            if(laKind == Function || laKind == Delegate)
            {
                fl.LiteralToken = laKind;
                Step();
            }

            if (laKind == Identifier)
            {
                Step();

                var p = new DVariable {
                    Name = t.Value,
                    Location = t.Location,
                    EndLocation = t.EndLocation,
                    Attributes =  new List<DAttribute>{new Modifier(Auto)}
                };

                fl.AnonymousMethod.Parameters.Add(p);
            }
            else if (laKind == OpenParenthesis)
                fl.AnonymousMethod.Parameters = Parameters(fl.AnonymousMethod);

            LambdaBody(fl.AnonymousMethod);
            fl.EndLocation = fl.AnonymousMethod.EndLocation;

            if (Scope != null)
                Scope.Add(fl.AnonymousMethod);

            return fl;
        }
开发者ID:rainers,项目名称:D_Parser,代码行数:36,代码来源:Parser_Impl.cs

示例5: LambaExpression

        FunctionLiteral LambaExpression(IBlockNode Scope=null)
        {
            var fl = new FunctionLiteral { IsLambda=true };

            fl.Location = fl.AnonymousMethod.Location = la.Location;

            if (laKind == Identifier)
            {
                Step();

                var p = new DVariable {
                    Name = t.Value,
                    Location = t.Location,
                    EndLocation = t.EndLocation };

                p.Attributes.Add(new DAttribute(Auto));

                fl.AnonymousMethod.Parameters.Add(p);
            }
            else if (laKind == OpenParenthesis)
                fl.AnonymousMethod.Parameters = Parameters(fl.AnonymousMethod);

            if (Expect(GoesTo))
            {
                fl.AnonymousMethod.Body = new BlockStatement { Location= la.Location };

                var ae = AssignExpression(fl.AnonymousMethod);

                fl.AnonymousMethod.Body.Add(new ReturnStatement
                {
                    Location = ae.Location,
                    EndLocation = ae.EndLocation,
                    ReturnExpression=ae
                });

                fl.AnonymousMethod.Body.EndLocation = t.EndLocation;
            }

            fl.EndLocation = fl.AnonymousMethod.EndLocation = t.EndLocation;

            if (Scope != null)
                Scope.Add(fl.AnonymousMethod);

            return fl;
        }
开发者ID:gavin-norman,项目名称:Mono-D,代码行数:45,代码来源:Parser_Impl.cs

示例6: PrimaryExpression


//.........这里部分代码省略.........
            #region ArrayLiteral | AssocArrayLiteral
            if (laKind == (OpenSquareBracket))
            {
                Step();
                var startLoc = t.Location;

                // Empty array literal
                if (laKind == CloseSquareBracket)
                {
                    Step();
                    return new ArrayLiteralExpression(null) {Location=startLoc, EndLocation = t.EndLocation };
                }

                /*
                 * If it's an initializer, allow NonVoidInitializers as values.
                 * Normal AssignExpressions otherwise.
                 */
                bool isInitializer = TrackerVariables.IsParsingInitializer;

                var firstExpression = isInitializer? NonVoidInitializer(Scope) : AssignExpression(Scope);

                // Associtative array
                if (laKind == Colon)
                {
                    Step();

                    var ae = isInitializer ?
                        new ArrayInitializer { Location = startLoc } :
                        new AssocArrayExpression { Location=startLoc };
                    LastParsedObject = ae;

                    var firstValueExpression = isInitializer? NonVoidInitializer(Scope) : AssignExpression();

                    ae.Elements.Add(new KeyValuePair<IExpression,IExpression>(firstExpression, firstValueExpression));

                    while (laKind == Comma)
                    {
                        Step();

                        if (laKind == CloseSquareBracket)
                            break;

                        var keyExpr = AssignExpression();
                        var valExpr=Expect(Colon) ?
                            (isInitializer?
                                NonVoidInitializer(Scope) :
                                AssignExpression(Scope)) :
                            null;

                        ae.Elements.Add(new KeyValuePair<IExpression,IExpression>(keyExpr,valExpr));
                    }

                    Expect(CloseSquareBracket);
                    ae.EndLocation = t.EndLocation;
                    return ae;
                }
                else // Normal array literal
                {
                    var ae = new List<IExpression>();
                    LastParsedObject = ae;

                    ae.Add(firstExpression);

                    while (laKind == Comma)
                    {
                        Step();
开发者ID:EnergonV,项目名称:D_Parser,代码行数:67,代码来源:Parser_Impl.cs

示例7: Statement


//.........这里部分代码省略.........
					Expect(CloseParenthesis);

					if(!IsEOF)
						ss.ScopedStatement = Statement(Scope: Scope, Parent: ss);
					ss.EndLocation = t.EndLocation;

					return ss;
				case Case:
					Step();

					var sscs = new SwitchStatement.CaseStatement() { Location = la.Location, Parent = Parent };
					sscs.ArgumentList = Expression(Scope);

					Expect(Colon);

					// CaseRangeStatement
					if (laKind == DoubleDot)
					{
						Step();
						Expect(Case);
						sscs.LastExpression = AssignExpression();
						Expect(Colon);
					}

					var sscssl = new List<IStatement>();

					while (laKind != Case && laKind != Default && laKind != CloseCurlyBrace && !IsEOF)
					{
						var stmt = Statement(Scope: Scope, Parent: sscs);

						if (stmt != null)
						{
							stmt.Parent = sscs;
							sscssl.Add(stmt);
						}
					}

					sscs.ScopeStatementList = sscssl.ToArray();
					sscs.EndLocation = t.EndLocation;

					return sscs;
				case Default:
					Step();

					var ssds = new SwitchStatement.DefaultStatement()
					{
						Location = la.Location,
						Parent = Parent
					};

					Expect(Colon);

					var ssdssl = new List<IStatement>();

					while (laKind != Case && laKind != Default && laKind != CloseCurlyBrace && !IsEOF)
					{
						var stmt = Statement(Scope: Scope, Parent: ssds);

						if (stmt != null)
						{
							stmt.Parent = ssds;
							ssdssl.Add(stmt);
						}
					}

					ssds.ScopeStatementList = ssdssl.ToArray();
开发者ID:DinrusGroup,项目名称:D_Parser,代码行数:67,代码来源:Parser_Impl.cs

示例8: PrimaryExpression


//.........这里部分代码省略.........
                    }
                    return new IdentifierExpression(a, t.LiteralFormat) { Location = startLoc, EndLocation = t.EndLocation };
                }
                //else if (t.LiteralFormat == LiteralFormat.CharLiteral)return new IdentifierExpression(t.LiteralValue) { LiteralFormat=t.LiteralFormat,Location = startLoc, EndLocation = t.EndLocation };
                return new IdentifierExpression(t.LiteralValue, t.LiteralFormat) { Location = startLoc, EndLocation = t.EndLocation };
            }
            #endregion

            #region ArrayLiteral | AssocArrayLiteral
            if (laKind == (OpenSquareBracket))
            {
                Step();
                var startLoc = t.Location;

                // Empty array literal
                if (laKind == CloseSquareBracket)
                {
                    Step();
                    return new ArrayLiteralExpression() {Location=startLoc, EndLocation = t.EndLocation };
                }

                var firstExpression = AssignExpression();

                // Associtative array
                if (laKind == Colon)
                {
                    Step();

                    var ae = new AssocArrayExpression() { Location=startLoc};
                    LastParsedObject = ae;

                    var firstValueExpression = AssignExpression();

                    ae.KeyValuePairs.Add(firstExpression, firstValueExpression);

                    while (laKind == Comma)
                    {
                        Step();
                        var keyExpr = AssignExpression();
                        Expect(Colon);
                        var valueExpr = AssignExpression();

                        ae.KeyValuePairs.Add(keyExpr, valueExpr);
                    }

                    Expect(CloseSquareBracket);
                    ae.EndLocation = t.EndLocation;
                    return ae;
                }
                else // Normal array literal
                {
                    var ae = new ArrayLiteralExpression() { Location=startLoc};
                    LastParsedObject = ae;
                    var expressions = new List<IExpression>();
                    expressions.Add(firstExpression);

                    while (laKind == Comma)
                    {
                        Step();
                        if (laKind == CloseSquareBracket) // And again, empty expressions are allowed
                            break;
                        expressions.Add(AssignExpression());
                    }

                    ae.Expressions = expressions;
开发者ID:nazriel,项目名称:Mono-D,代码行数:66,代码来源:Parser_Impl.cs

示例9: NewExpression

        IExpression NewExpression(IBlockNode Scope = null)
        {
            Expect(New);
            var startLoc = t.Location;

            IExpression[] newArgs = null;
            // NewArguments
            if (laKind == (OpenParenthesis))
            {
                Step();
                if (laKind != (CloseParenthesis))
                    newArgs = ArgumentList(Scope).ToArray();
                Expect(CloseParenthesis);
            }

            /*
             * If there occurs a class keyword here, interpretate it as an anonymous class definition
             * http://digitalmars.com/d/2.0/expression.html#NewExpression
             *
             * NewArguments ClassArguments BaseClasslist_opt { DeclDefs }
             *
             * http://digitalmars.com/d/2.0/class.html#anonymous
             *
                NewAnonClassExpression:
                    new PerenArgumentListopt class PerenArgumentList_opt SuperClass_opt InterfaceClasses_opt ClassBody

                PerenArgumentList:
                    (ArgumentList)
             *
             */
            if (laKind == (Class))
            {
                Step();
                var ac = new AnonymousClassExpression(); LastParsedObject = ac;
                ac.NewArguments = newArgs;

                // ClassArguments
                if (laKind == (OpenParenthesis))
                {
                    Step();
                    if (laKind == (CloseParenthesis))
                        Step();
                    else
                        ac.ClassArguments = ArgumentList(Scope).ToArray();
                }

                var anclass = new DClassLike(Class) { IsAnonymous=true };
                LastParsedObject = anclass;

                anclass.Name = "(Anonymous Class)";

                // BaseClasslist_opt
                if (laKind == (Colon))
                    //TODO : Add base classes to expression
                    anclass.BaseClasses = BaseClassList();
                // SuperClass_opt InterfaceClasses_opt
                else if (laKind != OpenCurlyBrace)
                    anclass.BaseClasses = BaseClassList(false);

                //TODO: Add the parsed results to node tree somehow
                ClassBody(anclass);

                ac.AnonymousClass = anclass;

                ac.Location = startLoc;
                ac.EndLocation = t.EndLocation;

                if (Scope != null)
                    Scope.Add(ac.AnonymousClass);

                return ac;
            }

            // NewArguments Type
            else
            {
                var initExpr = new NewExpression()
                {
                    NewArguments = newArgs,
                    Type = BasicType(),
                    IsArrayArgument = laKind == OpenSquareBracket,
                    Location=startLoc
                };
                LastParsedObject = initExpr;

                var args = new List<IExpression>();
                while (laKind == OpenSquareBracket)
                {
                    Step();
                    if(laKind!=CloseSquareBracket)
                        args.Add(AssignExpression(Scope));
                    Expect(CloseSquareBracket);
                }

                if (laKind == (OpenParenthesis))
                {
                    Step();
                    if (laKind != CloseParenthesis)
                        args = ArgumentList(Scope);
                    Expect(CloseParenthesis);
//.........这里部分代码省略.........
开发者ID:nazriel,项目名称:Mono-D,代码行数:101,代码来源:Parser_Impl.cs

示例10: DeclDef

        void DeclDef(IBlockNode module)
        {
            //AttributeSpecifier
            if (IsAttributeSpecifier())
                AttributeSpecifier();

            //ImportDeclaration
            else if (laKind == Import)
                ImportDeclaration();

            //Constructor
            else if (laKind == (This))
                module.Add(Constructor(module is DClassLike ? (module as DClassLike).ClassType == DTokens.Struct : false));

            //Destructor
            else if (laKind == (Tilde) && Lexer.CurrentPeekToken.Kind == (This))
                module.Add(Destructor());

            //Invariant
            else if (laKind == (Invariant))
                module.Add(_Invariant());

            //UnitTest
            else if (laKind == (Unittest))
            {
                Step();
                var dbs = new DMethod(DMethod.MethodType.Unittest);
                dbs.StartLocation = t.Location;
                FunctionBody(dbs);
                dbs.EndLocation = t.EndLocation;
                module.Add(dbs);
            }

            //ConditionalDeclaration
            else if (laKind == (Version) || laKind == (Debug) || laKind == (If))
            {
                Step();
                var n = t.ToString();

                if (t.Kind == (If))
                {
                    if (DAttribute.ContainsAttribute(DeclarationAttributes, Static))
                    {
                        //HACK: Assume that there's only our 'static' attribute applied to the 'if'-statement
                        DeclarationAttributes.Clear();
                    }
                    else
                        SynErr(Static, "Conditional declarations must be static");

                    if (Expect(OpenParenthesis))
                    {
                        var condition = AssignExpression();
                        Expect(CloseParenthesis);
                    }
                }
                else if (laKind == (Assign))
                {
                    Step();
                    Step();
                    Expect(Semicolon);
                }
                else if (t.Kind == (Version))
                {
                    Expect(OpenParenthesis);
                    n += "(";
                    Step();
                    n += t.ToString();
                    Expect(CloseParenthesis);
                    n += ")";
                }
                else if (t.Kind == (Debug) && laKind == (OpenParenthesis))
                {
                    Expect(OpenParenthesis);
                    n += "(";
                    Step();
                    n += t.ToString();
                    Expect(CloseParenthesis);
                    n += ")";
                }

                if (laKind == (Colon))
                    Step();
            }

            //TODO
            else if (laKind == (Else))
            {
                Step();
            }

            //StaticAssert
            else if (laKind == (Assert))
            {
                Step();

                if (DAttribute.ContainsAttribute(DeclarationAttributes, Static))
                {
                    //HACK: Assume that there's only our 'static' attribute applied to the 'if'-statement
                    DeclarationAttributes.Clear();
                }
//.........这里部分代码省略.........
开发者ID:nazriel,项目名称:Mono-D,代码行数:101,代码来源:Parser_Impl.cs

示例11: Decl

        List<INode> Decl(IBlockNode Scope, DAttribute StorageClass = null)
        {
            var startLocation = la.Location;
            var initialComment = GetComments();
            ITypeDeclaration ttd = null;

            CheckForStorageClasses(Scope);

            // Autodeclaration
            if(StorageClass == null)
                StorageClass = DTokens.ContainsStorageClass(DeclarationAttributes);

            if (laKind == Enum)
            {
                Step();
                PushAttribute(StorageClass = new Modifier(Enum) { Location = t.Location, EndLocation = t.EndLocation },false);
            }

            // If there's no explicit type declaration, leave our node's type empty!
            if ((StorageClass != Modifier.Empty &&
                laKind == (Identifier) && (DeclarationAttributes.Count > 0 || Lexer.CurrentPeekToken.Kind == OpenParenthesis))) // public auto var=0; // const foo(...) {}
            {
                if (Lexer.CurrentPeekToken.Kind == Assign || Lexer.CurrentPeekToken.Kind ==OpenParenthesis)
                { }
                else if (Lexer.CurrentPeekToken.Kind == Semicolon)
                {
                    SemErr(t.Kind, "Initializer expected for auto type, semicolon found!");
                }
                else
                    ttd = BasicType();
            }
            else if(!IsEOF)
                ttd = BasicType();

            if (IsEOF)
            {
                /*
                 * T! -- tix.Arguments == null
                 * T!(int, -- last argument == null
                 * T!(int, bool, -- ditto
                 * T!(int) -- now every argument is complete
                 */
                var tix=ttd as TemplateInstanceExpression;
                if (tix != null) {
                    if (tix.Arguments == null || tix.Arguments.Length == 0 ||
                        (tix.Arguments [tix.Arguments.Length - 1] is TokenExpression &&
                        (tix.Arguments [tix.Arguments.Length - 1] as TokenExpression).Token == DTokens.INVALID)) {
                        return null;
                    }
                } else if (ttd is MemberFunctionAttributeDecl && (ttd as MemberFunctionAttributeDecl).InnerType == null) {
                    return null;
                }
            }

            // Declarators
            var firstNode = Declarator(ttd,false, Scope);
            if (firstNode == null)
                return null;
            firstNode.Description = initialComment;
            firstNode.Location = startLocation;

            // Check for declaration constraints
            if (laKind == (If))
                Constraint(firstNode);

            // BasicType Declarators ;
            if (laKind==Assign || laKind==Comma || laKind==Semicolon)
            {
                // DeclaratorInitializer
                if (laKind == (Assign))
                {
                    var init = Initializer (Scope);
                    var dv = firstNode as DVariable;
                    if (dv != null)
                        dv.Initializer = init;
                }
                firstNode.EndLocation = t.EndLocation;
                var ret = new List<INode>();
                ret.Add(firstNode);

                // DeclaratorIdentifierList
                while (laKind == Comma)
                {
                    Step();
                    if (IsEOF || Expect (Identifier)) {
                        var otherNode = new DVariable ();

                        // Note: In DDoc, all declarations that are made at once (e.g. int a,b,c;) get the same pre-declaration-description!
                        otherNode.Description = initialComment;

                        otherNode.AssignFrom (firstNode);
                        otherNode.Location = t.Location;
                        if (t.Kind == DTokens.Identifier)
                            otherNode.Name = t.Value;
                        else if(IsEOF)
                            otherNode.NameHash = IncompleteIdHash;
                        otherNode.NameLocation = t.Location;

                        if (laKind == OpenParenthesis)
                            TemplateParameterList (otherNode);
//.........这里部分代码省略.........
开发者ID:Extrawurst,项目名称:D_Parser,代码行数:101,代码来源:Parser_Impl.cs


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