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


C# CodeModel.ParseNodeList类代码示例

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


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

示例1: EnumerationFieldNode

        public EnumerationFieldNode(ParseNodeList attributes, AtomicNameNode name,
                                    ParseNode value)
            : base(ParseNodeType.EnumerationFieldDeclaration, name.token) {
            _attributes = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
            _name = (AtomicNameNode)GetParentedNode(name);

            if (value is LiteralNode) {
                LiteralNode literalNode = (LiteralNode)value;
                _value = ((LiteralToken)literalNode.Token).LiteralValue;
            }
            else {
                // TODO: Clearly we need something more general...
                //       C# allows expressions. Likely expressions to be used
                //       include negative values, binary OR'd values,
                //       expressions involving other enum members (esp. hard to deal with)
                // For now, just adding support for negative numbers, as
                // everything else can be worked around in source code.

                UnaryExpressionNode expressionNode = value as UnaryExpressionNode;
                if ((expressionNode != null) && (expressionNode.Operator == TokenType.Minus) &&
                    (expressionNode.Child is LiteralNode)) {

                    try {
                        LiteralToken literalToken =
                            (LiteralToken)((LiteralNode)expressionNode.Child).Token;
                        int numericValue = (int)Convert.ChangeType(literalToken.LiteralValue, typeof(int));

                        _value = -numericValue;
                    }
                    catch {
                    }
                }
            }
        }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:34,代码来源:EnumerationFieldNode.cs

示例2: SwitchNode

 public SwitchNode(Token token,
                   ParseNode condition,
                   ParseNodeList cases)
     : base(ParseNodeType.Switch, token) {
     _condition = GetParentedNode(condition);
     _cases = GetParentedNodeList(cases);
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:7,代码来源:SwitchNode.cs

示例3: ConstantFieldDeclarationNode

 public ConstantFieldDeclarationNode(Token token,
                                     ParseNodeList attributes,
                                     Modifiers modifiers,
                                     ParseNode type,
                                     ParseNodeList initializers)
     : base(ParseNodeType.ConstFieldDeclaration, token, attributes, modifiers, type, initializers, false) {
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:7,代码来源:ConstantFieldDeclarationNode.cs

示例4: DestructorDeclarationNode

 public DestructorDeclarationNode(Token token,
                                  ParseNodeList attributes,
                                  Modifiers modifiers,
                                  AtomicNameNode name,
                                  BlockStatementNode body)
     : base(ParseNodeType.DestructorDeclaration, token, attributes, modifiers, /* return type */ null, name, new ParseNodeList(), body) {
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:7,代码来源:DestructorDeclarationNode.cs

示例5: SwitchSectionNode

 public SwitchSectionNode(Token token,
                          ParseNodeList labels,
                          ParseNodeList statements)
     : base(ParseNodeType.SwitchSection, token) {
     _labels = GetParentedNodeList(labels);
     _statements = GetParentedNodeList(statements);
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:7,代码来源:SwitchSectionNode.cs

示例6: TypeParameterConstraintNode

 public TypeParameterConstraintNode(AtomicNameNode typeParameter, ParseNodeList typeConstraints,
                             bool hasConstructorConstraint)
     : base(ParseNodeType.ConstraintClause, typeParameter.token) {
     _typeParameter = typeParameter;
     _typeConstraints = typeConstraints;
     _hasConstructorConstraint = hasConstructorConstraint;
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:7,代码来源:TypeParameterConstraintNode.cs

示例7: AttributeBlockNode

 public AttributeBlockNode(Token token,
                           AttributeTargets location,
                           ParseNodeList attributes)
     : base(ParseNodeType.AttributeBlock, token) {
     _location = location;
     _attributes = GetParentedNodeList(attributes);
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:7,代码来源:AttributeBlockNode.cs

示例8: NamespaceNode

 public NamespaceNode(Token token, string name,
                      ParseNodeList usingClauses,
                      ParseNodeList members)
     : base(ParseNodeType.Namespace, token) {
     _name = name;
     _usingClauses = GetParentedNodeList(usingClauses);
     _members = GetParentedNodeList(members);
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:8,代码来源:NamespaceNode.cs

示例9: VariableDeclarationNode

 public VariableDeclarationNode(Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                ParseNode type,
                                ParseNodeList initializers,
                                bool isFixed)
     : this(ParseNodeType.VariableDeclaration, token, attributes, modifiers, type, initializers, isFixed) {
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:8,代码来源:VariableDeclarationNode.cs

示例10: TryNode

 public TryNode(Token token,
                ParseNode body,
                ParseNodeList catchClauses,
                ParseNode finallyClause)
     : base(ParseNodeType.Try, token) {
     _body = GetParentedNode(body);
     _catchClauses = GetParentedNodeList(catchClauses);
     _finallyClause = GetParentedNode(finallyClause);
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:9,代码来源:TryNode.cs

示例11: OperatorDeclarationNode

 public OperatorDeclarationNode(Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                TokenType operatorNodeType,
                                ParseNode returnType,
                                ParseNodeList formals,
                                BlockStatementNode body)
     : base(ParseNodeType.OperatorDeclaration, token, attributes, modifiers, returnType, /* name */ null, formals, body) {
     this.operatorTokenType = operatorNodeType;
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:10,代码来源:OperatorDeclarationNode.cs

示例12: PropertyDeclarationNode

 public PropertyDeclarationNode(Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                ParseNode type,
                                NameNode interfaceType,
                                AtomicNameNode name,
                                AccessorNode getOrRemove,
                                AccessorNode setOrAdd)
     : this(ParseNodeType.PropertyDeclaration, token, attributes, modifiers, type, interfaceType, getOrRemove, setOrAdd) {
     _name = (AtomicNameNode)GetParentedNode(name);
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:11,代码来源:PropertyDeclarationNode.cs

示例13: AccessorNode

 public AccessorNode(Token token,
                     ParseNodeList attributes,
                     AtomicNameNode name,
                     BlockStatementNode body,
                     Modifiers modifiers)
     : base(ParseNodeType.AccessorDeclaration, token) {
     _name = (AtomicNameNode)GetParentedNode(name);
     _implementation = (BlockStatementNode)GetParentedNode(body);
     _attributes = GetParentedNodeList(attributes);
     _modifiers = modifiers;
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:11,代码来源:AccessorNode.cs

示例14: ParameterNode

 public ParameterNode(Token token,
                            ParseNodeList attributes,
                            ParameterFlags flags,
                            ParseNode type,
                            AtomicNameNode name)
     : base(ParseNodeType.FormalParameter, token) {
     _attributes = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _flags = flags;
     _type = GetParentedNode(type);
     _name = (AtomicNameNode)GetParentedNode(name);
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:11,代码来源:ParameterNode.cs

示例15: CompilationUnitNode

 public CompilationUnitNode(Token token,
                            ParseNodeList externAliases,
                            ParseNodeList usingClauses,
                            ParseNodeList attributes,
                            ParseNodeList members)
     : base(ParseNodeType.CompilationUnit, token) {
     _externAliases = GetParentedNodeList(externAliases);
     _usingClauses = GetParentedNodeList(usingClauses);
     _attributes = GetParentedNodeList(attributes);
     _members = GetParentedNodeList(GetNamespaces(members));
 }
开发者ID:fugaku,项目名称:scriptsharp,代码行数:11,代码来源:CompilationUnitNode.cs


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