當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。