public RegexGroup(RegexGroup parent, bool?caseSensitive = null) { this.parent = parent; this.caseSensitive = caseSensitive; this.current = RegexNoOp.Default; this.pending = null; }
public void AppendExpression(RegexExpression expression) { if (this.pending != null) { this.current = RegexConcatenation.Create(this.current, this.pending); } this.pending = expression; }
public void Quantify(RegexQuantifier quantifier) { if (this.pending == null) { throw new InvalidOperationException("Qualifier is not valid at this place"); } this.pending = RegexQuantified.Create(this.pending, quantifier); this.AppendExpression(null); }
public static RegexExpression Create(RegexExpression left, RegexExpression right) { if (right is RegexNoOp) { return(left); } if (left is RegexNoOp) { return(right); } return(new RegexConcatenation(left, right)); }
public static RegexExpression Create(RegexExpression inner, RegexQuantifier quantifier) { if (quantifier.IsZero) { return(RegexNoOp.Default); } if (quantifier.IsOne) { return(inner); } return(new RegexQuantified(inner, quantifier)); }
public static RegexExpression Create(RegexExpression left, RegexExpression right) { var leftMatch = left as RegexMatchSet; if (leftMatch != null) { var rightMatch = right as RegexMatchSet; if (rightMatch != null) { var handle = new RangeSetHandle.Union(false); handle.Add(leftMatch.Handle); handle.Add(rightMatch.Handle); return(new RegexMatchSet(leftMatch.Text + '|' + rightMatch.Text, handle)); } } return(new RegexAlternation(left, right)); }
public RegexAlternation(RegexExpression left, RegexExpression right) { this.Left = left; this.Right = right; }
public static RegexExpression Create(RegexExpression inner, SymbolId symbol, int?precedence = null) { return(new RegexAccept(inner, symbol, precedence)); }
public RegexAccept(RegexExpression inner, SymbolId symbol, int?precedence) { this.Inner = inner; this.Symbol = symbol; this.Precedence = precedence; }
public static RegexExpression CreateDeep(RegexExpression inner, SymbolId symbol, int?precedence = null) { return(inner.Visit(AcceptDeepVisitor.Default, new KeyValuePair <SymbolId, int?>(symbol, precedence))); }
public void Alternate() { this.alternate = this.Flush(); this.current = RegexNoOp.Default; this.pending = null; }
public RegexConcatenation(RegexExpression left, RegexExpression right) { this.Left = left; this.Right = right; }
public RegexQuantified(RegexExpression inner, RegexQuantifier quantifier) { this.Inner = inner; this.Quantifier = quantifier; }