fixed several bugs in lexer and extracted content of test class for lexer contract