summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pygments/lexers/c_cpp.py3
-rw-r--r--tests/snippets/cpp/alternative_tokens.txt46
2 files changed, 48 insertions, 1 deletions
diff --git a/pygments/lexers/c_cpp.py b/pygments/lexers/c_cpp.py
index b5fd704d..aed8b4a4 100644
--- a/pygments/lexers/c_cpp.py
+++ b/pygments/lexers/c_cpp.py
@@ -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'),
diff --git a/tests/snippets/cpp/alternative_tokens.txt b/tests/snippets/cpp/alternative_tokens.txt
new file mode 100644
index 00000000..69919cc9
--- /dev/null
+++ b/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