code: public void accept(TokenKind tk) {
          if (token.kind == tk) {
              nextToken();
          } else {
              setErrorEndPos(token.pos);
              reportSyntaxError(S.prevToken().endPos, "expected", tk);
          }
      }
docs: If next input token matches given token, skip it, otherwise report
  an error.