/// <summary> /// Initializes a new instance of the <see cref="Quantifier{TData, TOffset}"/> class. /// </summary> /// <param name="minOccur">The minimum number of occurrences.</param> /// <param name="maxOccur">The maximum number of occurrences.</param> /// <param name="node">The pattern node.</param> public Quantifier(int minOccur, int maxOccur, PatternNode <TData, TOffset> node) : base(node == null ? Enumerable.Empty <PatternNode <TData, TOffset> >() : node.ToEnumerable()) { _greedy = true; _minOccur = minOccur; _maxOccur = maxOccur; }
protected override bool CanAdd(PatternNode <TData, TOffset> child) { if (!base.CanAdd(child) || child is Pattern <TData, TOffset> ) { return(false); } return(true); }
public virtual bool ValueEquals(PatternNode <TData, TOffset> other) { if (IsLeaf && other.IsLeaf) { return(true); } if (!IsLeaf && !other.IsLeaf && Children.Count == other.Children.Count) { return(Children.Zip(other.Children).All(tuple => tuple.Item1.ValueEquals(tuple.Item2))); } return(false); }
public override bool ValueEquals(PatternNode <TData, TOffset> other) { var otherCons = other as Constraint <TData, TOffset>; return(otherCons != null && ValueEquals(otherCons)); }
protected override bool CanAdd(PatternNode <TData, TOffset> child) { return(false); }
protected PatternNode(PatternNode <TData, TOffset> node) : this(node.Children.CloneItems()) { Tag = node.Tag; }
protected override bool CanRemove(PatternNode <TData, TOffset> child) { return(!IsFrozen); }
public override bool ValueEquals(PatternNode <TData, TOffset> other) { var otherPattern = other as Pattern <TData, TOffset>; return(otherPattern != null && ValueEquals(otherPattern)); }
public override bool ValueEquals(PatternNode <TData, TOffset> other) { var otherQuant = other as Quantifier <TData, TOffset>; return(otherQuant != null && ValueEquals(otherQuant)); }
public Quantifier(PatternNode <TData, TOffset> node) : this(0, Infinite, node) { }
protected PatternNode(PatternNode <TData, TOffset> node) : this(node.Children.DeepClone()) { }
public override bool ValueEquals(PatternNode <TData, TOffset> other) { var otherAlter = other as Alternation <TData, TOffset>; return(otherAlter != null && ValueEquals(otherAlter)); }
public override bool ValueEquals(PatternNode <TData, TOffset> other) { var otherGroup = other as Group <TData, TOffset>; return(otherGroup != null && ValueEquals(otherGroup)); }
public Group(string name, PatternNode <TData, TOffset> node) : base(node) { _name = name; }
public Group(PatternNode <TData, TOffset> node) : this(null, node) { }