Refactor common behavior into helpers.sh.
Test the lexer in a similar fashion.