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


C# Irony类代码示例

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


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


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