Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds C++ alternative tokens as keywords #2421

Merged
merged 1 commit into from Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion pygments/lexers/c_cpp.py
Expand Up @@ -384,7 +384,8 @@ class CppLexer(CFamilyLexer):
'try', 'typeid', 'using', 'virtual', 'constexpr', 'nullptr', 'concept',
'decltype', 'noexcept', 'override', 'final', 'constinit', 'consteval',
'co_await', 'co_return', 'co_yield', 'requires', 'import', 'module',
'typename'),
'typename', 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not',
'not_eq', 'or', 'or_eq', 'xor', 'xor_eq'),
suffix=r'\b'), Keyword),
(r'namespace\b', Keyword, 'namespace'),
(r'(enum)(\s+)', bygroups(Keyword, Whitespace), 'enumname'),
Expand Down
46 changes: 46 additions & 0 deletions tests/snippets/cpp/alternative_tokens.txt
@@ -0,0 +1,46 @@
---input---
and
and_eq
bitand
bitor
compl
not
not_eq
or
or_eq
xor
xor_eq

---tokens---
'and' Keyword
'\n' Text.Whitespace

'and_eq' Keyword
'\n' Text.Whitespace

'bitand' Keyword
'\n' Text.Whitespace

'bitor' Keyword
'\n' Text.Whitespace

'compl' Keyword
'\n' Text.Whitespace

'not' Keyword
'\n' Text.Whitespace

'not_eq' Keyword
'\n' Text.Whitespace

'or' Keyword
'\n' Text.Whitespace

'or_eq' Keyword
'\n' Text.Whitespace

'xor' Keyword
'\n' Text.Whitespace

'xor_eq' Keyword
'\n' Text.Whitespace