Basic regex lexer implementation with extra debug/trace output