C define highlighting can be wrong with C++ grammar but not in C grammar
From @jaudiger in https://github.com/microsoft/vscode/issues/82848
- VSCode Version: 1.39.2
- OS Version: Windows 10 (64 bits) + ArchLinux WSL
Steps to Reproduce:
- Use the following code inside a
test.c(uses C grammar) file and atest.h(uses C++ grammar) file:
#define A 1
#define B 2
#define E (A | B)
- The file
test.h(using the C++ grammar) contains a wrong highlighting define for E: A is not of the same color as B.

Does this issue occur when C/C++ extension is disabled?: Yes
I can confirm this issue with mine as well. Might be related to the issue I just posted.

This is caused by the grammar treating any #define foo (/* snip */) as a macro function even when it contains invalid characters.
It should be easy enough to restrict a macro function definition to:
- identifiers
- spaces
- comments
- commas
...as the last item
Standard reference: http://eel.is/c++draft/gram.cpp
A user reported another repro with
#define ITEM_MASK 0x00000001U /**< Documentation
that goes onto the next line */
It seems like that's the same issue as this? Only repros with C++ and not C.