示例#1
0
 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;
     }
 }