rework lexer to deal with open/close tags and add some unit tests for the lexer