Beispiel #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;
        }
Beispiel #2
0
 public NegationNode(ExpressionNode arg0)
     : base(arg0)
 {
 }
Beispiel #3
0
 public override void Visit(ExpressionNode node)
 {
     if (!(node is TermNode) && !(node is NegationNode))
         writer.WriteLine(node.OpCode);
 }
Beispiel #4
0
 public virtual void Visit(ExpressionNode node){}
Beispiel #5
0
 public override void Visit(ExpressionNode node)
 {
     node.ValidateArity();
 }
Beispiel #6
0
 public OrNode(ExpressionNode arg0, ExpressionNode arg1, params ExpressionNode[] args) 
     : base(arg0.Cons(arg1.Cons(args)))
 {
 }
Beispiel #7
0
 public L1Expression(ExpressionNode expressionNode)
     :base(expressionNode)
 {
 }
Beispiel #8
0
 protected virtual IAstTreeNode Xform(ExpressionNode node) { return null; }
Beispiel #9
0
 public sealed override void Visit(ExpressionNode node) { VisitAndXform(node, Xform(node)); }