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


C# ParseTreeNode类代码示例

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


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

示例1: GetContent

 public void GetContent(CompilerContext context, ParseTreeNode parseNode)
 {
     if (parseNode.HasChildNodes())
     {
         ParallelTasks = Convert.ToUInt32(parseNode.ChildNodes[1].Token.Value);
     }
 }
开发者ID:TheByte,项目名称:sones,代码行数:7,代码来源:ParallelTasksNode.cs

示例2: PrepareStringInstanceMethodCall

        private static MethodInfo PrepareStringInstanceMethodCall(string methodName, ParseTreeNode root, CompilerState state, out Expression value, out Expression pattern)
        {
            root.RequireChildren(2);

            MethodInfo method;
            if (0 == StringComparer.OrdinalIgnoreCase.Compare(methodName, "StartsWith"))
            {
                method = ReflectionHelper.StringStartsWith;
            }
            else if (0 == StringComparer.OrdinalIgnoreCase.Compare(methodName, "EndsWith"))
            {
                method = ReflectionHelper.StringEndsWith;
            }
            else if (0 == StringComparer.OrdinalIgnoreCase.Compare(methodName, "IndexOf"))
            {
                method = ReflectionHelper.StringIndexOf;
            }
            else
            {
                throw new Exception("Could not find method " + methodName);
            }

            var arg1Node = root.RequireChild(null, 1, 0, 0);
            value = state.ParentRuntime.Analyze(arg1Node, state);
            value.RequireString(arg1Node);

            var arg2Node = root.RequireChild(null, 1, 0, 1);
            pattern = state.ParentRuntime.Analyze(arg2Node, state);
            pattern.RequireString(arg2Node);
            return method;
        }
开发者ID:adrobyazko-softheme,项目名称:PQL,代码行数:31,代码来源:ExpressionEvaluatorRuntime(Compiler).cs

示例3: AddParseNodeRec

        private void AddParseNodeRec(int depth, ParseTreeNode node)
        {
            if (node == null) return;
            BnfTerm term = node.Term;

            string txt = node.ToString();

            if (term == null) {
                txt = "NullTerm";
            }
            else {
                txt = term.GetParseNodeCaption(node);
            }
            //var t = " "*6;
            for (int i = 0; i < depth; i++) Console.Write("  ");

            if (node.Token != null) {
                Console.WriteLine(node.Token.Value + " " + node.Token.Terminal.ToString());
            }
            else
                Console.WriteLine(node.Term.Name);

               // Console.WriteLine(node.ToString());
            foreach (var child in node.ChildNodes)
                AddParseNodeRec(depth + 1, child);
        }
开发者ID:zackszhu,项目名称:ZodiacLanguage,代码行数:26,代码来源:GrammarAnalysizer.cs

示例4: DirectInit

 public void DirectInit(ParsingContext context, ParseTreeNode parseNode)
 {
     var idChain = ((IDNode)parseNode.ChildNodes[2].AstNode).IDChainDefinition;
     var tupleDefinition = ((TupleNode)parseNode.ChildNodes[3].AstNode).TupleDefinition;
     var AttrName = parseNode.ChildNodes[2].FirstChild.FirstChild.Token.ValueString;
     ToBeRemovedList = new AttributeRemoveList(idChain, AttrName, tupleDefinition);
 }
开发者ID:anukat2015,项目名称:sones,代码行数:7,代码来源:RemoveFromListAttrUpdateAddToRemoveFromNode.cs

示例5: GetContent

        public void GetContent(CompilerContext context, ParseTreeNode parseNode)
        {
            TypesSettingScope? settingType;
            if (parseNode.HasChildNodes() && (parseNode.ChildNodes.Count >= 2))
            {

                switch (parseNode.ChildNodes[1].Token.Text.ToUpper())
                {
                    case "TYPE":
                        settingType = TypesSettingScope.TYPE;
                        _DescribeSettingDefinition = new DescribeSettingDefinition(settingType, myTypeName: (parseNode.ChildNodes[2].ChildNodes[0].AstNode as ATypeNode).ReferenceAndType.TypeName);
                        break;
                    case "ATTRIBUTE":
                        settingType = TypesSettingScope.ATTRIBUTE;
                        _DescribeSettingDefinition = new DescribeSettingDefinition(settingType, myIDChain: (parseNode.ChildNodes[2].ChildNodes[2].AstNode as IDNode).IDChainDefinition);
                        break;
                    case "DB":
                        settingType = TypesSettingScope.DB;
                        _DescribeSettingDefinition = new DescribeSettingDefinition(settingType);
                        break;
                    case "SESSION":
                        settingType = TypesSettingScope.SESSION;
                        _DescribeSettingDefinition = new DescribeSettingDefinition(settingType);
                        break;
                    default:
                        settingType = null;
                        _DescribeSettingDefinition = new DescribeSettingDefinition(settingType);
                        break;
                }

            }
        }
开发者ID:TheByte,项目名称:sones,代码行数:32,代码来源:DescrSettingsItemsNode.cs

示例6: InitNode

		/// <summary>
		/// Converts identifiers to compound symbols (strings in double quotes),
		/// expands character strings (in single quotes) to arrays of characters
		/// </summary>
		public static void InitNode(AstContext context, ParseTreeNode parseNode)
		{
			foreach (var node in parseNode.ChildNodes)
			{
				if (node.AstNode is LiteralValueNode)
				{
					if (node.Term.Name == "Char")
					{
						var literal = node.AstNode as LiteralValueNode;
						literal.Value = literal.Value.ToString().ToCharArray();
					}

					parseNode.AstNode = node.AstNode;
				}
				else
				{
					// identifiers in expressions are treated as strings (True is same as "True")
					parseNode.AstNode = new LiteralValueNode()
					{
						Value = node.FindTokenAndGetText(),
						Span = node.Span
					};
				}
			}
		}
开发者ID:androdev4u,项目名称:XLParser,代码行数:29,代码来源:LiteralValueNodeHelper.cs

示例7: Init

 public void Init(ParsingContext context, ParseTreeNode parseNode)
 {
     if (HasChildNodes(parseNode))
     {
         BinExprNode = (BinaryExpressionNode)parseNode.ChildNodes[1].AstNode;
     }
 }
开发者ID:anukat2015,项目名称:sones,代码行数:7,代码来源:HavingExpressionNode.cs

示例8: Init

        public void Init(ParsingContext context, ParseTreeNode parseNode)
        {
            if (HasChildNodes(parseNode))
            {

                //get type
                if (parseNode.ChildNodes[1] != null && parseNode.ChildNodes[1].AstNode != null)
                {
                    _Type = ((AstNode)(parseNode.ChildNodes[1].AstNode)).AsString;
                }
                else
                {
                    throw new NotImplementedQLException("");
                }


                if (parseNode.ChildNodes[3] != null && HasChildNodes(parseNode.ChildNodes[3]))
                {

                    _AttributeAssignList = new List<AAttributeAssignOrUpdate>((parseNode.ChildNodes[3].AstNode as AttributeUpdateOrAssignListNode).ListOfUpdate.Select(e => e as AAttributeAssignOrUpdate));

                }

                if (parseNode.ChildNodes[4] != null && ((WhereExpressionNode)parseNode.ChildNodes[4].AstNode).BinaryExpressionDefinition != null)
                {
                    _WhereExpression = ((WhereExpressionNode)parseNode.ChildNodes[4].AstNode).BinaryExpressionDefinition;
                }

            }
        }
开发者ID:anukat2015,项目名称:sones,代码行数:30,代码来源:InsertOrUpdateNode.cs

示例9: GetContent

        public override void GetContent(CompilerContext context, ParseTreeNode parseNode)
        {
            #region Get the optional type list

            if (parseNode.ChildNodes[1].HasChildNodes())
            {
                _TypesToDump = ((parseNode.ChildNodes[1].ChildNodes[1].AstNode as TypeListNode).Types).Select(tlnode => tlnode.TypeName).ToList();
            }

            #endregion

            _DumpType           = (parseNode.ChildNodes[2].AstNode as DumpTypeNode).DumpType;
            _DumpFormat         = (parseNode.ChildNodes[3].AstNode as DumpFormatNode).DumpFormat;
            _DumpableGrammar    = context.Compiler.Language.Grammar as IDumpable;

            if (_DumpableGrammar == null)
            {
                throw new GraphDBException(new Error_NotADumpableGrammar(context.Compiler.Language.Grammar.GetType().ToString()));
            }

            if (parseNode.ChildNodes[4].HasChildNodes())
            {
                _DumpDestination = parseNode.ChildNodes[4].ChildNodes[1].Token.ValueString;
            }
        }
开发者ID:TheByte,项目名称:sones,代码行数:25,代码来源:DumpNode.cs

示例10: GetContent

 public void GetContent(CompilerContext context, ParseTreeNode parseNode)
 {
     if (parseNode.HasChildNodes())
     {
         _DescrAggrDefinition = new DescribeAggregateDefinition(parseNode.ChildNodes[1].Token.ValueString.ToUpper());
     }
 }
开发者ID:TheByte,项目名称:sones,代码行数:7,代码来源:DescrAggrNode.cs

示例11: BuildInterfaceMethod

        // Build an interface method declaration.
        public static void BuildInterfaceMethod(IronyParser parser, Root root, Expression parentExpression, ParseTreeNode currentNode)
        {
            var method = new MethodDeclaration(parentExpression, currentNode.Token.Convert());
            parentExpression.ChildExpressions.Add(method);

            // Build the return type of the interface method.
            method.ReturnTypeName = parser.CheckAlias(currentNode.ChildNodes[0].ChildNodes[0].FindTokenAndGetText());

            // The name of the interface method.
            method.Name = currentNode.ChildNodes[0].ChildNodes[1].FindTokenAndGetText();

            // Build the list of generic type names.
            if (currentNode.ChildNodes[1].ChildNodes.Count > 0)
            {
                var generics = currentNode.ChildNodes[1].ChildNodes[0].ChildNodes[1];
                foreach (string s in IronyParser.InterpretList(generics))
                    method.GenericTypeNames.Add(parser.CheckAlias(s));
            }

            // Build the arguments of the method
            if (currentNode.ChildNodes[2].ChildNodes.Count > 0)
            {
                foreach (var n in currentNode.ChildNodes[2].ChildNodes)
                {
                    MethodDeclarationBuilder.BuildArgument(parser, method, n.ChildNodes[0]);
                }
            }
        }
开发者ID:maleficus1234,项目名称:Pie,代码行数:29,代码来源:InterfaceMethodBuilder.cs

示例12: Init

 public override void Init(ParsingContext context, ParseTreeNode treeNode) {
   base.Init(context, treeNode); 
   Value = treeNode.Token.Value;
   AsString = Value == null ? "null" : Value.ToString();
   if (Value is string)
     AsString = "\"" + AsString + "\""; 
 }
开发者ID:wayne-yeung,项目名称:FxStrategyAnalyzer,代码行数:7,代码来源:LiteralValueNode.cs

示例13: Init

 public override void Init(ParsingContext context, ParseTreeNode treeNode) {
   base.Init(context, treeNode);
   Test = AddChild("Test", treeNode.ChildNodes[0]);
   IfTrue = AddChild("IfTrue", treeNode.ChildNodes[1]);
   if (treeNode.ChildNodes.Count > 2)
     IfFalse = AddChild("IfFalse", treeNode.ChildNodes[2]);
 } 
开发者ID:o2platform,项目名称:O2.Platform.Projects,代码行数:7,代码来源:IfNode.cs

示例14: InitImpl

 private void InitImpl(AstContext context, ParseTreeNode parseNode, ParseTreeNode parametersNode, ParseTreeNode bodyNode) {
   base.Init(context, parseNode);
   Parameters = AddChild("Parameters", parametersNode);
   Body = AddChild("Body", bodyNode);
   AsString = "Lambda[" + Parameters.ChildNodes.Count + "]";
   Body.SetIsTail(); //this will be propagated to the last statement
 }
开发者ID:androdev4u,项目名称:XLParser,代码行数:7,代码来源:LambdaNode.cs

示例15: Init

 public override void Init(ParsingContext context, ParseTreeNode treeNode) {
   base.Init(context, treeNode);
   foreach (var child in treeNode.ChildNodes) {
       AddChild("parameter", child); 
   }
   AsString = "Param list";
 }
开发者ID:o2platform,项目名称:O2.Platform.Projects,代码行数:7,代码来源:ParamListNode.cs


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