matchSpacefullPattern

Undocumented in source. Be warned that the author may not have intended to support it.
bool
matchSpacefullPattern
(
string pattern
,,
AllowPartialMatch allowPartial = AllowPartialMatch.no
)

Examples

// Test empty parsers.
auto parser = ArgPullParser([]);
assert(!matchSpacefullPattern("v", parser));

// Test that the parser's position is moved forward correctly.
parser = ArgPullParser(["v", "verbose"]);
assert(matchSpacefullPattern("v", parser));
assert(matchSpacefullPattern("verbose", parser));
assert(parser.empty);

// Test that a parser that fails to match isn't moved forward at all.
parser = ArgPullParser(["v", "verbose"]);
assert(!matchSpacefullPattern("lel", parser));
assert(parser.front.value == "v");

// Test that a pattern with spaces works.
parser = ArgPullParser(["give", "me", "chocolate"]);
assert(matchSpacefullPattern("give me", parser));
assert(parser.front.value == "chocolate");

// Test that multiple patterns work.
parser = ArgPullParser(["v", "verbose"]);
assert(matchSpacefullPattern("lel|v|verbose", parser));
assert(matchSpacefullPattern("lel|v|verbose", parser));
assert(parser.empty);

Meta