reworked lexer to use named patterns, more tests