3rdparty/bgfx/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpTokens.cpp
// We are pasting if
//   1. we are preceding a pasting operator within this stream
// or
//   2. the entire macro is preceding a pasting operator (lastTokenPastes)
//      and we are also on the last token
We are pasting if
1. we are preceding a pasting operator within this stream
or
2. the entire macro is preceding a pasting operator (lastTokenPastes)
and we are also on the last token
We are pasting if 1 . we are preceding a pasting operator within this stream or 2 . the entire macro is preceding a pasting operator ( lastTokenPastes ) and we are also on the last token
bool TPpContext::TokenStream::peekTokenizedPasting(bool lastTokenPastes)
{
    size_t savePos = current;
    int subtoken;
    do {
        subtoken = getSubtoken();
    } while (subtoken == ' ');
    current = savePos;
    if (subtoken == PpAtomPaste)
        return true;
    if (! lastTokenPastes)
        return false;
    savePos = current;
    bool moreTokens = false;
    do {
        subtoken = getSubtoken();
        if (subtoken == EndOfInput)
            break;
        if (subtoken != ' ') {
            moreTokens = true;
            break;
        }
    } while (true);
    current = savePos;
    return !moreTokens;
}
bool TPpContext :: TokenStream :: peekTokenizedPasting ( bool lastTokenPastes ) { size_t savePos = current ; int subtoken ; do { subtoken = getSubtoken ( ) ; } while ( subtoken == ' ' ) ; current = savePos ; if ( subtoken == PpAtomPaste ) return true ; if ( ! lastTokenPastes ) return false ; savePos = current ; bool moreTokens = false ; do { subtoken = getSubtoken ( ) ; if ( subtoken == EndOfInput ) break ; if ( subtoken != ' ' ) { moreTokens = true ; break ; } } while ( true ) ; current = savePos ; return ! moreTokens ; }
We are pasting if
1. we are preceding a pasting operator within this stream
or
2. the entire macro is preceding a pasting operator (lastTokenPastes)
and we are also on the last token
We are pasting if 1 . we are preceding a pasting operator within this stream or 2 . the entire macro is preceding a pasting operator ( lastTokenPastes ) and we are also on the last token
// 1. preceding ##? // skip white space // 2. last token and we've been told after this there will be a ## // Getting here means the last token will be pasted, after this // Are we at the last non-whitespace token?