fix(cpp): highlight digit separators in defines - #4444
Conversation
Signed-off-by: Dhruv Maniya <dhruvmaniya1998@gmail.com>
Signed-off-by: Dhruv Maniya <dhruvmaniya1998@gmail.com>
Build Size ReportChanges to minified artifacts in 8 files changedTotal change +8 B View Changes
|
|
We either need more parsing examples or we'll need to lock this down to just #define if that's the intended scope - not all the other pre-processor directives. |
Baltsat
left a comment
There was a problem hiding this comment.
I checked the exact head (854c6ed) with the full test and lint suite. The new NUMBERS entry applies to every PREPROCESSOR, so #if, #elif, and #line now highlight separator literals too, while the fixtures still cover only #define.
There is also a continued-definition case that currently breaks in both grammars:
#define LIMIT 10'\
000This renders 10 as a number and the remainder as a string. After phase-2 line splicing, the logical token is 10'000, so it should remain one number token.
Could you add a regression for this form and make the numeric mode survive the continuation? Please also either add examples for the intended non-#define directives or confine the behavior to #define, as requested in the earlier scope review.
Changes
#definevaluesThis prevents literals such as
100'000in a macro definition from treating the apostrophe as the start of a string while preserving normal preprocessor string handling.Resolves #4443
Validation
npm run buildONLY_LANGUAGES="c cpp" npm run test-markup(18 passed)npm test(1578 passed,3 pending)git diff --checkChecklist
CHANGES.mdDevelopment note: implemented with Codex assistance and validated locally with the full Node.js test suite.