Remove duplication in lexer advance function