very rough import of dmd's lexer directly