function getContextualTokenSeparator(match, scope, flags) {
    const matchEndPos = match.index + match[0].length;
    const precedingChar = match.input[match.index - 1];
    const followingChar = match.input[matchEndPos];
    if (
        // No need to separate tokens if at the beginning or end of a group, before or after a
        // group, or before or after a `|`
        /^[()|]$/.test(precedingChar) ||
        /^[()|]$/.test(followingChar) ||
        // No need to separate tokens if at the beginning or end of the pattern
        match.index === 0 ||
        matchEndPos === match.input.length ||
        // No need to separate tokens if at the beginning of a noncapturing group or lookaround.
        // Looks only at the last 4 chars (at most) for perf when constructing long regexes.
        /\(\?(?:[:=!]|<[=!])$/.test(match.input.substring(match.index - 4, match.index)) ||
        // Avoid separating tokens when the following token is a quantifier
        isQuantifierNext(match.input, matchEndPos, flags)
    ) {
        return '';
    }
    // Keep tokens separated. This avoids e.g. inadvertedly changing `\1 1` or `\1(?#)1` to `\11`.
    // This also ensures all tokens remain as discrete atoms, e.g. it prevents converting the
    // syntax error `(? :` into `(?:`.
    return '(?:)';
}
Returns a pattern that can be used in a native RegExp in place of an ignorable token such as an
inline comment or whitespace with flag x. This is used directly as a token handler function
passed to `XRegExp.addToken`.

@private
@param {String} match Match arg of `XRegExp.addToken` handler
@param {String} scope Scope arg of `XRegExp.addToken` handler
@param {String} flags Flags arg of `XRegExp.addToken` handler
@returns {string} Either '' or '(?:)', depending on which is needed in the context of the match.