add ptr field to token
transfer buffer logic into lex()