__anonymous.step

Match the current character against the function, return true if matched and proceed to the next character.

  1. bool step(Checker check, out T character)
    struct __anonymous
    bool
    step
    (
    Checker check
    ,
    out T character
    )
  2. bool step(Checker check)

Parameters

check
Type: Checker

Function to match against.

character
Type: T

Reference which will be replaced with the character.

Examples

1 auto stream = parsingStream("hello");
2 char ch;
3 assert( stream.step(a => a == 'h'));  // First character
4 assert(!stream.step(a => a == 'l'));  // Second character is an "e", won't match
5 assert( stream.step(a => a == 'e'));  // Didn't progress, we can try again
6 assert( stream.step(a => a == 'l'));  // Now this will match
7 
8 // Using a reference
9 assert( stream.step(a => isAlpha(a), ch));
10 assert(ch == 'l');
11 

Meta