Factor out the scanner state into its own struct.

This way we only have one reference to worry about passing into the
functors, so it'll be easy to add further state later.
Add an explicit NEWLINE token so we can detect the ends of statements.
Test the special behavior we exhibit while inside brackets.