function finishToken(type, val) {
    tokEnd = tokPos;
    if (options.locations) {
      tokEndLoc = new line_loc_t();
    }
    tokType = type;
    skipSpace();
    tokVal = val;
    tokRegexpAllowed = type.beforeExpr;
  }
Called at the end of every token. Sets `tokEnd`, `tokVal`, and
`tokRegexpAllowed`, and skips the space after the token, so that
the next one's `tokStart` will point at the right position.

@param {!Object} type
@param {*=} val