• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ParseTreeNode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: BuildClass

        // Builds a "class" expression: really could be a class, struct, or module.
        public static void BuildClass(IronyParser parser, Root root, Expression parentExpression, ParseTreeNode currentNode)
        {
            Class c = new Class(parentExpression, currentNode.FindToken().Convert());
            parentExpression.ChildExpressions.Add(c);

            int i = 0;

            // Interpret the declaration modifiers (abstract, public, internal, etc).
            InterpretClassModifiers( root, c, currentNode.ChildNodes[i]);

            i++;

            // Determine if it's a class, module, or struct.
            switch(currentNode.ChildNodes[i].Term.ToString())
            {
                case "module":
                    c.IsModule = true;
                    c.IsFinal = true;
                    c.IsPartial = true;
                    break;
                case "struct":
                    c.IsStruct = true;
                    c.IsModule = false;
                    break;
                default:
                    c.IsStruct = false;
                    c.IsModule = false;
                    break;
            }

            i++;

            // Class name
            c.UnqualifiedName = currentNode.ChildNodes[i].FindTokenAndGetText();

            i++;

            // Get the generic type list.
            if (currentNode.ChildNodes[i].ChildNodes.Count > 0)
            {
                var generics = currentNode.ChildNodes[i].ChildNodes[0].ChildNodes[1];
                foreach (string s in IronyParser.InterpretList(generics))
                    c.GenericTypeNames.Add(s);
            }

            i++;

            // Get the base type list.
            if (currentNode.ChildNodes[i].ChildNodes.Count > 0)
            {
                var baseTypes = currentNode.ChildNodes[i].ChildNodes[0].ChildNodes[0];
                foreach (string s in IronyParser.InterpretList(baseTypes))
                    c.BaseTypeNames.Add(s);
            }

            i+=1;

            // Build the child expressions of the class.
            parser.ConsumeParseTree(root, c, currentNode.ChildNodes[i]);
        }
开发者ID:maleficus1234,项目名称:Pie,代码行数:61,代码来源:ClassBuilder.cs


示例17: Init

    public override void Init(AstContext context, ParseTreeNode parseNode)
		{
			base.Init(context, parseNode);

			foreach (var node in parseNode.ChildNodes)
			{
				if (node.AstNode is Function)
				{
					AddFunction(node.AstNode as Function);
				}
				else if (node.AstNode is AuxiliaryNode)
				{
					var ids = (node.AstNode as AuxiliaryNode).ChildNodes.OfType<IdentifierNode>();

					foreach (var id in ids)
					{
						ExternalFunction ef = new ExternalFunction();
						ef.SetSpan(id.Span);
						ef.Name = id.Symbol;
						AddFunction(ef);
					}
				}
			}

			AsString = "Refal-5 program";
		}
开发者ID:androdev4u,项目名称:XLParser,代码行数:26,代码来源:Program.cs


示例18: GetContent

        public void GetContent(CompilerContext myCompilerContext, ParseTreeNode myParseTreeNode)
        {
            if (myParseTreeNode.ChildNodes[0].HasChildNodes())
            {

                if (myParseTreeNode.ChildNodes[0].ChildNodes[0].ChildNodes.Count > 1)
                {

                    _IndexType = ((ATypeNode)myParseTreeNode.ChildNodes[0].ChildNodes[0].ChildNodes[0].AstNode).ReferenceAndType.TypeName;
                    _IndexAttribute = ((IDNode)myParseTreeNode.ChildNodes[0].ChildNodes[0].ChildNodes[2].AstNode).IDChainDefinition;

                }

                else
                {
                    //_IndexAttribute = myParseTreeNode.ChildNodes[0].ChildNodes[0].Token.ValueString;
                    _IndexAttribute = new IDChainDefinition();
                    _IndexAttribute.AddPart(new ChainPartTypeOrAttributeDefinition(myParseTreeNode.ChildNodes[0].ChildNodes[0].Token.ValueString));
                }

            }

            if (myParseTreeNode.ChildNodes.Count > 1 && myParseTreeNode.ChildNodes[1].HasChildNodes())
            {
                _OrderDirection = myParseTreeNode.ChildNodes[1].FirstChild.Token.ValueString;
            }
            else
            {
                _OrderDirection = String.Empty;
            }

            IndexAttributeDefinition = new IndexAttributeDefinition(_IndexAttribute, _IndexType, _OrderDirection);
        }
开发者ID:TheByte,项目名称:sones,代码行数:33,代码来源:IndexAttributeNode.cs


示例19: Init

        public void Init(ParsingContext context, ParseTreeNode parseNode)
        {
            var aSelectNode = (SelectNode)parseNode.ChildNodes[0].AstNode;

            SelectDefinition = new SelectDefinition(aSelectNode.TypeList, aSelectNode.SelectedElements, aSelectNode.WhereExpressionDefinition,
                aSelectNode.GroupByIDs, aSelectNode.Having, aSelectNode.Limit, aSelectNode.Offset, aSelectNode.OrderByDefinition, aSelectNode.ResolutionDepth);
        }
开发者ID:loubo,项目名称:sones,代码行数:7,代码来源:PartialSelectStmtNode.cs


示例20: Init

        public override void Init(AstContext context, ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            foreach (var node in treeNode.ChildNodes)
            {
                // linearize AuxiliaryNode children
                if (node.AstNode is AuxiliaryNode)
                {
                    var auxNode = node.AstNode as AuxiliaryNode;

                    foreach (var n in auxNode.ChildNodes)
                        ChildNodes.Add(n);

                    foreach (var n in auxNode.ChildParseNodes)
                        ChildParseNodes.Add(n);

                    continue;
                }

                // copy AstNode nodes
                if (node.AstNode is AstNode)
                {
                    ChildNodes.Add(node.AstNode as AstNode);
                    continue;
                }

                // otherwise, save parse nodes
                ChildParseNodes.Add(node);
            }
        }
开发者ID:dbremner,项目名称:irony,代码行数:31,代码来源:AuxiliaryNode.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ParsedDocument类代码示例发布时间:2022-05-24
下一篇:
C# ParseTree类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap