__anonymous.enforceStep

A chainable version of this method. Matches the current character against the function and gives it via a reference argument.

  1. T enforceStep(Checker check)
  2. ParsingStream!T enforceStep(Checker check, out T match)
    struct __anonymous
    ref
    enforceStep
    (
    Checker check
    ,
    out T match
    )

Parameters

check
Type: Checker

Function to match against.

match
Type: T

Matched character (output).

Return Value

Type: ParsingStream!T

Self, for chaining.

Throws

MatchException if the character wasn't matched.

Examples

1 auto stream = parsingStream("hi!");
2 char a, b, c;
3 ParsingStream.Checker check = x => x.isAlpha;
4 
5 stream
6     .enforceStep(check, a)
7     .enforceStep(check, b);
8 
9 assert(a == 'h');
10 assert(b != 'e');
11 assertThrown!MatchException(stream.enforceStep(check, c));
12 

Meta