/// <summary> /// Add characters from another <see cref="CharRange"/>. /// </summary> /// <param name="cr">All characters matched by this CharRange will be added to the current set</param> /// <returns>this</returns> public Builder AddRange(CharRange cr) { Reserve(size + cr.bounds.Length); for (int i = 0; i < cr.bounds.Length; ++i) { normalized = false; inouts[size++] = (cr.bounds[i] << 1) | (i & 1); } return(this); }
/// <summary> /// Intersect with another <see cref="CharRange"/>. /// /// This is implemented by <see cref="Exclude"/>ing cr.Complement() /// </summary> /// <param name="cr">All characters that are NOT matched by this CharRange will be removed from the current set</param> /// <returns>this</returns> public Builder Intersect(CharRange cr) { Exclude(cr.Complement()); return(this); }
/// <summary> /// Create a pattern that matches any single character from the given string. /// </summary> /// <param name="chars">the characters to accept</param> /// <returns>the new pattern</returns> public static Pattern AnyCharIn(string chars) { return(Match(CharRange.CreateBuilder().AddChars(chars).Build())); }
public IMatchable Literal(IRegexContext ctx, CharRange range) => range;