Skip to content

Conversation

aalokitbh
Copy link

This PR fixes issue #3928 by adding support for single-quote (') digit separators in C++ integer literals inside #define macros and normal code. Previously, such literals were not highlighted correctly in highlight.js.

Changes made:

  • Updated src/languages/cpp.js to include NUMBERS in PREPROCESSOR.contains so numbers in preprocessor lines are highlighted
  • Added a test snippet in test/markup/cpp/preprocessor.txt

Existing preprocessor tests may highlight numbers differently due to the fix; this is expected.Also the behavior for digit separators in integer literals is changed; all other syntax highlighting remains unchanged.

Closes#3928

@aalokitbh
Copy link
Author

Thanks for the review, @Yang062! 😊
Please let me know if any further changes are needed. Also, is there any chance this PR could be merged or labeled for Hacktoberfest?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants