optimize lexer

Hello,

This patch improve lexer performance by 20%.

Thomas