MatcherConcept.skip

Perform a semantic equivalent 2 operations: decoding a $(CODEPOINT) at front of inp and testing if it belongs to the set of $(CODEPOINTS) of this matcher.

The effect on inp depends on the kind of function called:

Match. If the codepoint is found in the set then range inp is advanced by its size in code units, otherwise the range is not modifed.

Skip. The range is always advanced by the size of the tested $(CODEPOINT) regardless of the result of test.

Test. The range is left unaffected regardless of the result of test.

  1. bool match(Range inp)
  2. bool skip(Range inp)
    struct MatcherConcept
    bool
    skip
    (
    Range
    )
    (
    ref Range inp
    )
    if (
    is(ElementType!Range : char)
    )
  3. bool test(Range inp)

Examples

string truth = "2² = 4";
auto m = utfMatcher!char(unicode.Number);
assert(m.match(truth)); // '2' is a number all right
assert(truth == "² = 4"); // skips on match
assert(m.match(truth)); // so is the superscript '2'
assert(!m.match(truth)); // space is not a number
assert(truth == " = 4"); // unaffected on no match
assert(!m.skip(truth)); // same test ...
assert(truth == "= 4"); // but skips a codepoint regardless
assert(!m.test(truth)); // '=' is not a number
assert(truth == "= 4"); // test never affects argument

Meta