Get an alias seq of capture types, similarly to PatternCaptureTypes, but based on a pattern for match.
Run the rule at given index. Does not store the result.
Iterate on the given pattern tuple.
Get an AliasSeq of capture types held by a given list of Match and MatchCapture types.
Return the matchOr return value for the given pattern.
Check the match type returned by match for the given pattern.
Wrap the tuple in a std.typecons.Tuple if its length isn't 1, otherwise return the sole item.
Match multiple items in order. Each matcher in the pattern will be tested against the source in order, and will advance the range before the next item in the pattern. The full pattern has to match.
Return the matchOr return value for the given pattern.
Union to hold results of each pattern match
Mixin to produce matcher templates for processing Input input range and creating a Match output range.
The parser requires a function with two overloads called supply. Both are expected to output a user data type for storing the parsing result (eg. a list of tokens). The first one should take a slice of the input range as a std.range.Take!Input and will be called for any successful match. The second should take two instances of the data type and combine them into once.
A basic implementation of a supply string (with string as the input range) would be this:
Notes:
* Performance of the parser heavily depends on std.range.popFrontN, so it's the fastest if the range supports slicing and has length. Alternatively, the range may define a popFrontN method itself. * The mixin can work both in module scope and at struct/class scope. No context is required for the matcher functions to work.
Internally the template only defines aliases to closures rather than functions. This allows them to work without an instance in structs and classes, but they may still use context for template parameters.