本文整理汇总了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)");
}
示例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)";
}
示例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;
}
}