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


C# ParseNodeList.Append方法代码示例

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


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

示例1: IncludeCompilationUnitUsingClauses

        internal void IncludeCompilationUnitUsingClauses() {
            CompilationUnitNode compilationUnit = (CompilationUnitNode)parent;
            if (compilationUnit.UsingClauses.Count != 0) {
                ParseNodeList mergedUsings = new ParseNodeList();
                mergedUsings.Append(compilationUnit.UsingClauses);

                if (_usingClauses.Count != 0) {
                    mergedUsings.Append(_usingClauses);
                }

                _usingClauses = GetParentedNodeList(mergedUsings);
            }
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:13,代码来源:NamespaceNode.cs

示例2: GetAttributeList

        public static ParseNodeList GetAttributeList(ParseNodeList attributeBlocks) {
            if ((attributeBlocks == null)  || (attributeBlocks.Count == 0)) {
                return attributeBlocks;
            }

            ParseNodeList attributes = new ParseNodeList();
            foreach (AttributeBlockNode attributeBlock in attributeBlocks) {
                ParseNodeList localAttributes = attributeBlock.Attributes;
                if (localAttributes.Count != 0) {
                    attributes.Append(localAttributes);
                }
            }

            return attributes;
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:15,代码来源:AttributeNode.cs

示例3: BuildCodeModel

        private void BuildCodeModel() {
            _compilationUnitList = new ParseNodeList();

            CodeModelBuilder codeModelBuilder = new CodeModelBuilder(_options, this);
            CodeModelValidator codeModelValidator = new CodeModelValidator(this);
            CodeModelProcessor validationProcessor = new CodeModelProcessor(codeModelValidator, _options);

            foreach (IStreamSource source in _options.Sources) {
                CompilationUnitNode compilationUnit = codeModelBuilder.BuildCodeModel(source);
                if (compilationUnit != null) {
                    validationProcessor.Process(compilationUnit);

                    _compilationUnitList.Append(compilationUnit);
                }
            }
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:16,代码来源:ScriptCompiler.cs

示例4: GetNamespaces

        private ParseNodeList GetNamespaces(ParseNodeList members) {
            ParseNodeList namespaceList = new ParseNodeList();

            foreach (ParseNode memberNode in members) {
                NamespaceNode namespaceNode = memberNode as NamespaceNode;

                if (namespaceNode == null) {
                    // Top-level type nodes are turned into children of a namespace with
                    // an empty name.

                    Token nsToken = new Token(TokenType.Namespace, memberNode.Token.SourcePath, memberNode.Token.Position);
                    namespaceNode = new NamespaceNode(nsToken, String.Empty, _usingClauses, new ParseNodeList(memberNode));
                }

                namespaceList.Append(namespaceNode);
            }

            return namespaceList;
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:19,代码来源:CompilationUnitNode.cs

示例5: ParseTypeParametersOpt

        private ParseNodeList ParseTypeParametersOpt() {
            ParseNodeList returnValue = new ParseNodeList();
            if (PeekType() == TokenType.OpenAngle) {
                Eat(TokenType.OpenAngle);

                do {
                    returnValue.Append(ParseTypeParameter());
                } while (null != EatOpt(TokenType.Comma));

                Eat(TokenType.CloseAngle);
            }
            return returnValue;
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:13,代码来源:Parser.cs

示例6: ParseConstraintClause

        private TypeParameterConstraintNode ParseConstraintClause() {
            EatWhere();
            AtomicNameNode name = ParseIdentifier();
            Eat(TokenType.Colon);

            bool hasConstructorConstraint = false;
            ParseNodeList typeConstraints = new ParseNodeList();
            do {
                if (PeekType() == TokenType.New) {
                    if (hasConstructorConstraint)
                        ReportError(ParseError.DuplicateConstructorConstraint);

                    hasConstructorConstraint = true;

                    Eat(TokenType.New);
                    Eat(TokenType.OpenParen);
                    Eat(TokenType.CloseParen);
                }
                else {
                    if (hasConstructorConstraint)
                        ReportError(ParseError.ConstructorConstraintMustBeLast);

                    typeConstraints.Append(ParseNamespaceOrTypeName());
                }

            } while (null != EatOpt(TokenType.Comma));

            return new TypeParameterConstraintNode(name, typeConstraints, hasConstructorConstraint);
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:29,代码来源:Parser.cs

示例7: ParseBlock

        private BlockStatementNode ParseBlock() {
            Token token = PeekToken();

            ParseNodeList statements = new ParseNodeList();
            Eat(TokenType.OpenCurly);

            TokenType type = PeekType();
            while (type != TokenType.CloseCurly && type != TokenType.EOF) {
                int mark = Mark();
                statements.Append(ParseStatement());

                // ensure we make progress in an error case
                if (mark == Mark()) {
                    NextToken();
                }

                type = PeekType();
            }
            Eat(TokenType.CloseCurly);

            return new BlockStatementNode(token, statements);
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:22,代码来源:Parser.cs

示例8: ParseNamespaceMembers

        // namespace-member-declarations
        private ParseNodeList ParseNamespaceMembers() {
            ParseNodeList list = new ParseNodeList();
            while (true) {
                TokenType type = PeekType();
                switch (type) {
                    case TokenType.Namespace:
                        list.Append(ParseNamespace());
                        break;

                    case TokenType.Class:
                    case TokenType.Interface:
                    case TokenType.Enum:
                    case TokenType.Delegate:
                    case TokenType.Struct:

                    case TokenType.Abstract:
                    case TokenType.Sealed:

                    case TokenType.Public:
                    case TokenType.Internal:
                    case TokenType.Private:
                    case TokenType.Protected:

                    case TokenType.New:
                    case TokenType.Virtual:
                    case TokenType.Static:
                    case TokenType.Readonly:
                    case TokenType.Extern:
                    case TokenType.Override:
                    case TokenType.Unsafe:

                    case TokenType.OpenSquare:
                        list.Append(ParseTypeDeclaration());
                        break;

                    case TokenType.Identifier:
                        if (PeekPartial())
                            goto case TokenType.Class;
                        goto default;

                    default:
                        return list;
                }
            }
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:46,代码来源:Parser.cs

示例9: ParseClassOrStructMembers

 private ParseNodeList ParseClassOrStructMembers() {
     ParseNodeList list = new ParseNodeList();
     TokenType type = PeekType();
     while (type != TokenType.CloseCurly && type != TokenType.EOF) {
         int mark = Mark();
         list.Append(ParseClassOrStructMember());
         if (mark == Mark()) {
             // didn't consume any tokens!
             // ensure we make some progress
             NextToken();
         }
         type = PeekType();
     }
     return list;
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:15,代码来源:Parser.cs

示例10: ParseFieldInitializers

        private ParseNodeList ParseFieldInitializers(bool isFixed) {
            ParseNodeList list = new ParseNodeList();
            do {
                if (!isFixed)
                    list.Append(new VariableInitializerNode(ParseIdentifier(), ParseVariableInitializer()));
                else
                    list.Append(new VariableInitializerNode(ParseIdentifier(), ParseFixedArrayDimension()));
            } while (EatOpt(TokenType.Comma) != null);

            return list;
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:11,代码来源:Parser.cs

示例11: ParseArrayInitializer

        private ArrayInitializerNode ParseArrayInitializer() {
            Token token = Eat(TokenType.OpenCurly);

            ParseNodeList list = new ParseNodeList();
            while (PeekType() != TokenType.CloseCurly && PeekType() != TokenType.EOF) {
                if (PeekType() == TokenType.OpenCurly) {
                    list.Append(ParseArrayInitializer());
                }
                else {
                    list.Append(ParseExpression());
                }
                if (null == EatOpt(TokenType.Comma)) {
                    break;
                }
            }
            Eat(TokenType.CloseCurly);

            return new ArrayInitializerNode(token, list);
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:19,代码来源:Parser.cs

示例12: ParseAttributes

        private ParseNodeList ParseAttributes() {
            ParseNodeList list = new ParseNodeList();

            while (PeekType() == TokenType.OpenSquare) {
                list.Append(ParseAttributeBlock());
            }

            return list;
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:9,代码来源:Parser.cs

示例13: ParseTry

        private TryNode ParseTry() {
            Token token = Eat(TokenType.Try);
            ParseNode body = ParseBlock();

            ParseNodeList catchClauses = new ParseNodeList();
            while (PeekType() == TokenType.Catch) {
                Token catchToken = Eat(TokenType.Catch);
                ParseNode type;
                AtomicNameNode name;

                if (PeekType() == TokenType.OpenParen) {
                    Eat(TokenType.OpenParen);
                    type = ParseType();
                    if (PeekType() == TokenType.Identifier) {
                        name = ParseIdentifier();
                    }
                    else {
                        name = null;
                    }
                    Eat(TokenType.CloseParen);
                }
                else {
                    type = null;
                    name = null;
                }

                catchClauses.Append(new CatchNode(
                                        catchToken,
                                        type,
                                        name,
                                        ParseBlock()));
            }

            ParseNode finallyClause;
            if (PeekType() == TokenType.Finally) {
                Eat(TokenType.Finally);
                finallyClause = ParseBlock();
            }
            else {
                finallyClause = null;
            }

            return new TryNode(
                            token,
                            body,
                            catchClauses,
                            finallyClause);
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:48,代码来源:Parser.cs

示例14: ParseUsingClauses

        // using-directives
        private ParseNodeList ParseUsingClauses() {
            ParseNodeList list = new ParseNodeList();
            while (PeekType() == TokenType.Using) {
                Token token = Eat(TokenType.Using);
                if (PeekType() == TokenType.Identifier && PeekType(1) == TokenType.Equal) {
                    // using-alias-directive
                    AtomicNameNode name = ParseIdentifier();
                    Eat(TokenType.Equal);
                    list.Append(
                            new UsingAliasNode(
                                token,
                                name,
                                ParseNamespaceOrTypeName()));
                }
                else {
                    // using-namespace-directive
                    list.Append(
                            new UsingNamespaceNode(
                                token,
                                ParseNamespaceOrTypeName()));
                }
                Eat(TokenType.Semicolon);
            }

            return list;
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:27,代码来源:Parser.cs

示例15: ParseExpressionList

 private ExpressionListNode ParseExpressionList(TokenType terminator) {
     Token token = PeekToken();
     ParseNodeList list = new ParseNodeList();
     if (PeekType() != terminator) {
         do {
             list.Append(ParseExpression());
         } while (null != EatOpt(TokenType.Comma));
     }
     return new ExpressionListNode(token, list);
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:10,代码来源:Parser.cs


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