lexer: refactor to support better lookahead

Signed-off-by: Alejandro Mery <amery@geeks.cl>