__anonymous.enforceStep

Match the current character against the function and return it.

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

Parameters

check
Type: Checker

Function to match against.

Throws

MatchException if the character wasn't matched.

Examples

1 auto stream = parsingStream("hello");
2 
3 // Matcher for "h" and "e"
4 ParsingStream.Checker check = a => a == 'h' || a == 'e';
5 
6 assert(stream.enforceStep(check) == 'h');
7 assert(stream.enforceStep(check) == 'e');
8 assertThrown(stream.enforceStep(check));
9 

Meta