Finite state machines

Thanks for such a comprehensive tutorial @npalardy. Really useful and clearly explained. I of course now hate you as I think I owe it to myself to rewrite my scanner to use state machines. They look much more efficient.