refactor YY_INPUT and begin_input