Pure python lexer implementation. It's somewhat designed to be a drop-in replacement for PLY's lexer for us with yacc.