Rework the parser state machine, add macros state.
Some cleanups.