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
Match the current character against the function, return true if matched and proceed to the next character.