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


C# ParsingContext.GetOperatorExpressionType方法代码示例

本文整理汇总了C#中Irony.Parsing.ParsingContext.GetOperatorExpressionType方法的典型用法代码示例。如果您正苦于以下问题:C# ParsingContext.GetOperatorExpressionType方法的具体用法?C# ParsingContext.GetOperatorExpressionType怎么用?C# ParsingContext.GetOperatorExpressionType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Irony.Parsing.ParsingContext的用法示例。


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

示例1: Init

 public override void Init(ParsingContext context, ParseTreeNode treeNode)
 {
     base.Init(context, treeNode);
       FindOpAndDetectPostfix(treeNode);
       int argIndex = IsPostfix? 0 : 1;
       Argument = AddChild(NodeUseType.ValueReadWrite, "Arg", treeNode.MappedChildNodes[argIndex]);
       BinaryOpSymbol = OpSymbol[0].ToString(); //take a single char out of ++ or --
       BinaryOp = context.GetOperatorExpressionType(BinaryOpSymbol);
       base.AsString = OpSymbol + (IsPostfix ? "(postfix)" : "(prefix)");
 }
开发者ID:MarcusTheBold,项目名称:Irony,代码行数:10,代码来源:IncDecNode.cs

示例2: Init

 public override void Init(ParsingContext context, ParseTreeNode treeNode)
 {
     base.Init(context, treeNode);
       Left = AddChild("Arg", treeNode.MappedChildNodes[0]);
       Right = AddChild("Arg", treeNode.MappedChildNodes[2]);
       var opToken = treeNode.MappedChildNodes[1].FindToken();
       OpSymbol = opToken.Text;
       Op = context.GetOperatorExpressionType(OpSymbol);
       // Set error anchor to operator, so on error (Division by zero) the explorer will point to
       // operator node as location, not to the very beginning of the first operand.
       ErrorAnchor = opToken.Location;
       AsString = Op + "(operator)";
 }
开发者ID:MarcusTheBold,项目名称:Irony,代码行数:13,代码来源:BinaryOperationNode.cs

示例3: Init

 public override void Init(ParsingContext context, ParseTreeNode treeNode)
 {
     base.Init(context, treeNode);
       Target = AddChild(NodeUseType.ValueWrite, "To", treeNode.MappedChildNodes[0]);
       //Get Op and baseOp if it is combined assignment
       AssignmentOp = treeNode.MappedChildNodes[1].FindTokenAndGetText();
       if (string.IsNullOrEmpty(AssignmentOp))
     AssignmentOp = "=";
       BinaryExpressionType = CustomExpressionTypes.NotAnExpression;
       //There maybe an "=" sign in the middle, or not - if it is marked as punctuation; so we just take the last node in child list
       Expression = AddChild(NodeUseType.ValueRead, "Expr", treeNode.LastChild);
       AsString = AssignmentOp + " (assignment)";
       // TODO: this is not always correct: in Pascal the assignment operator is :=.
       IsAugmented = AssignmentOp.Length > 1;
       if (IsAugmented) {
     //it is combined op
     base.ExpressionType = context.GetOperatorExpressionType(AssignmentOp);
     BinaryExpressionType = OperatorUtility.GetBinaryOperatorForAugmented(this.ExpressionType);
     Target.UseType = NodeUseType.ValueReadWrite;
       }
 }
开发者ID:MarcusTheBold,项目名称:Irony,代码行数:21,代码来源:AssignmentNode.cs


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