Skip to content

(C and C++) Defines treat digit separator in defines as string beginning #4443

Description

@jaskij

Describe the issue

#define FOO 10'000

is valid code, using ' as a digit separator. Highlight.js incorrectly treats it as a beginning of a string.

Image

Which language seems to have the issue?

I tested C and C++, both get it wrong.

Are you using highlight or highlightAuto?

No clue. I originally noticed the issue while sending code over Discord and confirmed it again with your demo. I did select the language manually in both cases.

Expected behavior

The ' character should be treated as part of the number.

Additional context

Support for this separator has been around in C++ since C++14, but it's relatively new in C, added in C23.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions