示例#1
0
        protected override IAstTreeNode Xform(ExpressionNode node)
        {
            foreach (var child in node.Children)
            {
                var childExpression = child as ExpressionNode;

                if (childExpression != null &&
                    node.OpCode == childExpression.OpCode &&
                    node.GetArity() == Arity.BinaryPlus)
                {
                    var clone = (ExpressionNode)node.Clone();
                    clone.Children.RemoveAll(cchild => cchild.Id == child.Id);
                    clone.Children.AddRange(child.Children);
                    return clone;
                }
            }

            return null;
        }
示例#2
0
 public NegationNode(ExpressionNode arg0)
     : base(arg0)
 {
 }
示例#3
0
 public override void Visit(ExpressionNode node)
 {
     if (!(node is TermNode) && !(node is NegationNode))
         writer.WriteLine(node.OpCode);
 }
示例#4
0
 public virtual void Visit(ExpressionNode node){}
示例#5
0
 public override void Visit(ExpressionNode node)
 {
     node.ValidateArity();
 }
示例#6
0
文件: OrNode.cs 项目: xeno-by/rapt
 public OrNode(ExpressionNode arg0, ExpressionNode arg1, params ExpressionNode[] args) 
     : base(arg0.Cons(arg1.Cons(args)))
 {
 }
示例#7
0
 public L1Expression(ExpressionNode expressionNode)
     :base(expressionNode)
 {
 }
示例#8
0
 protected virtual IAstTreeNode Xform(ExpressionNode node) { return null; }
示例#9
0
 public sealed override void Visit(ExpressionNode node) { VisitAndXform(node, Xform(node)); }