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

C# Irony类代码示例

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

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



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

示例1: Init

 public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
 {
     base.Init(context, treeNode);
     instruction = (Instructions)Enum.Parse(typeof(Instructions), treeNode.ChildNodes[0].FindTokenAndGetText());
     AddChild("firstOperand", treeNode.ChildNodes[1]);
     AddChild("secondOperand", treeNode.ChildNodes[2]);
 }
开发者ID:Blecki,项目名称:DCPUB,代码行数:7,代码来源:Replacement.cs


示例2: Init

        public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);
            AddChild("LValue", treeNode.ChildNodes[0].ChildNodes[0]);
            AddChild("RValue", treeNode.ChildNodes[2]);
            @operator = treeNode.ChildNodes[1].FindTokenAndGetText();
            ResultType = "word";

            if (opcodes == null)
            {
                opcodes = new Dictionary<string, Instructions>();
                opcodes.Add("=", Instructions.SET);
                opcodes.Add("+=", Instructions.ADD);
                opcodes.Add("-=", Instructions.SUB);
                opcodes.Add("*=", Instructions.MUL);
                opcodes.Add("/=", Instructions.DIV);

                opcodes.Add("-*=", Instructions.MLI);
                opcodes.Add("-/=", Instructions.DVI);

                opcodes.Add("%=", Instructions.MOD);
                opcodes.Add("-%=", Instructions.MDI);
                opcodes.Add("<<=", Instructions.SHL);
                opcodes.Add(">>=", Instructions.SHR);
                opcodes.Add("&=", Instructions.AND);
                opcodes.Add("|=", Instructions.BOR);
                opcodes.Add("^=", Instructions.XOR);
            }
        }
开发者ID:Blecki,项目名称:DCPUB,代码行数:29,代码来源:AssignmentNode.cs


示例3: Init

        public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            if (treeNode.ChildNodes.Count == 1)
            {
                Value = new IntegerAstNode()
                {
                    Value = 1
                };
                PeriodicType = PeriodicTypeAst.Day;
            }
            else
            {

                Value = AddChild("value", treeNode.FirstChild) as ExpressionAstNode;
                string periodType = treeNode.ChildNodes[1].FindTokenAndGetText().ToLower();
                switch (periodType)
                {
                    case "month":
                    case "months": PeriodicType = PeriodicTypeAst.Month; break;
                    case "days":
                    case "day": PeriodicType = PeriodicTypeAst.Day; break;
                    default:
                        throw new ArgumentException("Unregconized period type:" + periodType);
                }
            }
        }
开发者ID:wayne-yeung,项目名称:FxStrategyAnalyzer,代码行数:28,代码来源:ExecutionFrequencyAstNode.cs


示例4: DoEvaluate

 protected override object DoEvaluate(Irony.Interpreter.ScriptThread thread)
 {
     object retval = null;
     thread.CurrentNode = this;  //standard prolog
     if (Left != null)
     {
         if (_TheFunction != null)
         {
             _TheFunction.Left = Left;
             retval = _TheFunction.Evaluate(thread);
         }
         else if (_PropNode != null)
         {
             _PropNode.Left = Left;
             retval = _PropNode.Evaluate(thread);
         }
     }
     if (_queue != null)
     {
         _queue.Left = retval;
         retval = _queue.Evaluate(thread);
     }
     thread.CurrentNode = Parent; //standard epilog
     return retval;
 }
开发者ID:bnaand,项目名称:xBim-Toolkit,代码行数:25,代码来源:SelectMemberAccessNode.cs


示例5: Init

        public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);


            _globalParamDef = new List<GlobalIdentifierAstNode>();

            foreach (var node in treeNode.ChildNodes[0].ChildNodes)
            {
                _globalParamDef.Add((GlobalIdentifierAstNode)node.AstNode );
            }


            PositionSets = new List<DefinePositionSetAstNode>();
            StrategyParameters = new List<StrategyParameterAstNode>();
            Irony.Ast.AstNode targetAstNode;
            foreach (var node in treeNode.ChildNodes[1].ChildNodes)
            {
                targetAstNode = node.FirstChild.AstNode as Irony.Ast.AstNode;
                if (targetAstNode is DefinePositionSetAstNode)
                    PositionSets.Add(targetAstNode as DefinePositionSetAstNode);
                else if (targetAstNode is StrategyParameterAstNode)
                    StrategyParameters.Add(targetAstNode as StrategyParameterAstNode);
            }

            TradingRules = new List<GeneralRuleAstNode>();
            foreach (var node in treeNode.ChildNodes[2].ChildNodes)
            {
                TradingRules.Add(node.AstNode as GeneralRuleAstNode);
            }

        }
开发者ID:wayne-yeung,项目名称:FxStrategyAnalyzer,代码行数:32,代码来源:TradingStrategyAstNode.cs


示例6: Evaluate

        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            _x.Evaluate (context, AstMode.Read);
            _y.Evaluate (context, AstMode.Read);
            _z.Evaluate (context, AstMode.Read);
            _dx.Evaluate (context, AstMode.Read);
            _dy.Evaluate (context, AstMode.Read);
            _dz.Evaluate (context, AstMode.Read);
            _ux.Evaluate (context, AstMode.Read);
            _uy.Evaluate (context, AstMode.Read);
            _uz.Evaluate (context, AstMode.Read);

            double x = Convert.ToDouble (context.Data[8]);
            double y = Convert.ToDouble (context.Data[7]);
            double z = Convert.ToDouble (context.Data[6]);

            double ux = Convert.ToDouble (context.Data[2]);
            double uy = Convert.ToDouble (context.Data[1]);
            double uz = Convert.ToDouble (context.Data[0]);

            double dx = Convert.ToDouble (context.Data[5]);
            double dy = Convert.ToDouble (context.Data[4]);
            double dz = Convert.ToDouble (context.Data[3]);

            Api.LookAt (x, y, z, ux, uy, uz, dx, dy, dz);
        }
开发者ID:Kintaro,项目名称:Hyperion,代码行数:26,代码来源:LookAtNode.cs


示例7: Init

 public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
 {
     base.Init(context, treeNode);
     AddChild("instruction", treeNode.ChildNodes[0]);
     AddChild("firstOperand", treeNode.ChildNodes[1]);
     AddChild("secondOperand", treeNode.ChildNodes[2]);
 }
开发者ID:Blecki,项目名称:DCPUB,代码行数:7,代码来源:WholeInstructionMatcher.cs


示例8: Init

        public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
        {
            base.Init (context, treeNode);

            _paramName = AddChild ("name", treeNode.ChildNodes[0]);
            _array = AddChild ("array", treeNode.ChildNodes[1]);
        }
开发者ID:Kintaro,项目名称:Hyperion,代码行数:7,代码来源:ParamListEntryNode.cs


示例9: convert

        public override bool convert( Irony.Parsing.ParseTreeNode node, Compiler c )
        {
            base.convert( node, c );
            if( node.Term.Name == "DictExpr" )
            {
            var elems = node.ChildNodes[1];
            if( elems.Term.Name != "DictElements" )
                throw new CompilationException( "Expected DictElements", node );

            foreach( var child in elems.ChildNodes )
            {
                if( child.Term.Name != "DictElement" )
                    throw new CompilationException( "Expected DictElement", child );

                Pair p = new Pair()
                {
                    key = c.convertNode( child.ChildNodes[0] ),
                    value = c.convertNode( child.ChildNodes[1] )
                };

                this.pairs.Add( p );
            }

            return true;
            }

            return false;
        }
开发者ID:kayateia,项目名称:climoo,代码行数:28,代码来源:AstDictionary.cs


示例10: DoEvaluate

        protected override object DoEvaluate(Irony.Interpreter.ScriptThread thread)
        {
            // List<object> retval = new List<object>();
            object retval = null;
            thread.CurrentNode = this;  //standard prolog

            string propertyName = property.ChildNodes[0].FindTokenAndGetText();

            if (Left is IEnumerable<object>)
            {
                IEnumerable<object> o = Left as IEnumerable<object>;
                foreach (var origItem in o)
                {
                    IPersistIfcEntity entity = origItem as IPersistIfcEntity;
                    retval = entity.GetPropertyByName(propertyName);
                }
            }
            else if (Left is IPersistIfcEntity)
            {
                IPersistIfcEntity entity = Left as IPersistIfcEntity;
                retval = entity.GetPropertyByName(propertyName);
            }
            thread.CurrentNode = Parent; //standard epilog
            return retval;
        }
开发者ID:bnaand,项目名称:xBim-Toolkit,代码行数:25,代码来源:SelectPropertyNode.cs


示例11: Evaluate

        public override void Evaluate(Irony.Interpreter.EvaluationContext context, AstMode mode)
        {
            _paramName.Evaluate (context, AstMode.Read);
            _array.Evaluate (context, AstMode.Read);

            _name = (_paramName as Irony.Ast.LiteralValueNode).Value as string;
        }
开发者ID:Kintaro,项目名称:Hyperion,代码行数:7,代码来源:ParamListEntryNode.cs


示例12: Init

 public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
 {
     base.Init(context, treeNode);
     if (treeNode.ChildNodes[1].FirstChild.ChildNodes.Count > 0)
         AddChild("value", treeNode.ChildNodes[1].FirstChild.FirstChild);
     this.AsString = treeNode.FindTokenAndGetText();
 }
开发者ID:Blecki,项目名称:DCPUB,代码行数:7,代码来源:ReturnStatementNode.cs


示例13: Init

 public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
 {
     base.Init(context, treeNode);
     AddChild("Expression", treeNode.ChildNodes[1].FirstChild);
     AddChild("Block", treeNode.ChildNodes[2]);
     this.AsString = "While";
 }
开发者ID:colinvh,项目名称:DCPUC,代码行数:7,代码来源:WhileStatementNode.cs


示例14: Init

        public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);
            _exchangeRateAccessor = AddChild("exchangeRateAccessor", treeNode.ChildNodes[0]) as ExchangeRateAccessorAstNode;
            _dateExpr = AddChild("dateExpr", treeNode.ChildNodes[1]) as ExpressionAstNode;

        }
开发者ID:wayne-yeung,项目名称:FxStrategyAnalyzer,代码行数:7,代码来源:AtTimeAstNode.cs


示例15: Init

        public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
        {
            base.Init(context, treeNode);

            _positionSetAstNode = (PositionSetAstNode)AddChild("PositionSetAstNode", treeNode.ChildNodes[0]);
            _expressionAstNode = (ExpressionAstNode)AddChild("ExpressionAstNode", treeNode.ChildNodes[1]);
        }
开发者ID:wayne-yeung,项目名称:FxStrategyAnalyzer,代码行数:7,代码来源:OpenPositionAstNode.cs


示例16: DoEvaluate

        protected override object DoEvaluate(Irony.Interpreter.ScriptThread thread)
        {
            thread.CurrentNode = this;
            try
            {
                var res = new MtResult();

                var accessor = thread.Bind(_targetName.AsString, BindingRequestFlags.Write | BindingRequestFlags.ExistingOrNew);
                accessor.SetValueRef(thread, res);

                // To allow recursive definitions, we have
                // to evaluate _expression inside the new context.
                var exprResult = _expression.Evaluate(thread) as MtResult;
                exprResult.GetValue((o) =>
                {
                    res.SetValue((state) =>
                    {
                        return o;
                    });
                });

                return res;
            }
            catch (Exception e)
            {
                throw new Exception("Exception on MtBind.DoEvaluate", e);
            }
            finally
            {
                //thread.CurrentNode = Parent;
            }
        }
开发者ID:fabriceleal,项目名称:Multitasks,代码行数:32,代码来源:MtBind.cs


示例17: Init

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

            var nodes = treeNode.ChildNodes;

            if (nodes.Count != 3)
            {
                throw new Exception("If node extended 3 children, received {0}".SafeFormat(nodes.Count));
            }

            _expression = AddChild(string.Empty, nodes[0]) as AstNode;
            if (_expression == null)
            {
                throw new Exception("No expression for if!");
            }

            _trueBranch = AddChild(string.Empty, nodes[1]) as AstNode;
            if (_expression == null)
            {
                throw new Exception("No true branch for if!");
            }

            _falseBranch = AddChild(string.Empty, nodes[2]) as AstNode;
            if (_expression == null)
            {
                throw new Exception("No false branch for if!");
            }
        }
开发者ID:fabriceleal,项目名称:Multitasks,代码行数:29,代码来源:MtIf.cs


示例18: Init

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

            _target = AddChild(string.Empty, treeNode.ChildNodes[0]) as AstNode;
            _source = AddChild(string.Empty, treeNode.ChildNodes[1]) as AstNode;
        }
开发者ID:fabriceleal,项目名称:Multitasks,代码行数:7,代码来源:MtFlowRightToLeft.cs


示例19: Init

 public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
 {
     base.Init(context, treeNode);
     AsString = treeNode.ChildNodes[0].FindTokenAndGetText();
     foreach (var parameter in treeNode.ChildNodes[1].ChildNodes)
         AddChild("parameter", parameter);
 }
开发者ID:BigEd,项目名称:DCPUC,代码行数:7,代码来源:FunctionCallNode.cs


示例20: Init

        public override void Init(Irony.Parsing.ParsingContext context, Irony.Parsing.ParseTreeNode treeNode)
        {
            base.Init (context, treeNode);

            for (int i = 0; i < 16; ++i)
                _numberNodes[i] = AddChild ("p" + i, treeNode.ChildNodes[1 + i]);
        }
开发者ID:Kintaro,项目名称:Hyperion,代码行数:7,代码来源:ConcatTransformNode.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IsExpression类代码示例发布时间:2022-05-24
下一篇:
C# IronRuby类代码示例发布时间: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