refactor YY_INPUT and begin_token