Binary pattern matching when input is a stream

A stream is not a binary, so you can’t.

That automaton changes its state depending on the current state and the next character of input. Whenever a certain state is reached (an acceptance state) a token is emitted depending on the previously accumulated characters and the current state. This is the very basic idea.

I’m to tired though to construct at least a minimal example. I do hope I will be able to do so during the weekend.