Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit adc6a48

Browse files
authored
adds C++ alternative tokens as keywords (#2421)
1 parent a0df083 commit adc6a48

File tree

2 files changed

+48
-1
lines changed

2 files changed

+48
-1
lines changed

pygments/lexers/c_cpp.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,8 @@ class CppLexer(CFamilyLexer):
384384
'try', 'typeid', 'using', 'virtual', 'constexpr', 'nullptr', 'concept',
385385
'decltype', 'noexcept', 'override', 'final', 'constinit', 'consteval',
386386
'co_await', 'co_return', 'co_yield', 'requires', 'import', 'module',
387-
'typename'),
387+
'typename', 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not',
388+
'not_eq', 'or', 'or_eq', 'xor', 'xor_eq'),
388389
suffix=r'\b'), Keyword),
389390
(r'namespace\b', Keyword, 'namespace'),
390391
(r'(enum)(\s+)', bygroups(Keyword, Whitespace), 'enumname'),
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---input---
2+
and
3+
and_eq
4+
bitand
5+
bitor
6+
compl
7+
not
8+
not_eq
9+
or
10+
or_eq
11+
xor
12+
xor_eq
13+
14+
---tokens---
15+
'and' Keyword
16+
'\n' Text.Whitespace
17+
18+
'and_eq' Keyword
19+
'\n' Text.Whitespace
20+
21+
'bitand' Keyword
22+
'\n' Text.Whitespace
23+
24+
'bitor' Keyword
25+
'\n' Text.Whitespace
26+
27+
'compl' Keyword
28+
'\n' Text.Whitespace
29+
30+
'not' Keyword
31+
'\n' Text.Whitespace
32+
33+
'not_eq' Keyword
34+
'\n' Text.Whitespace
35+
36+
'or' Keyword
37+
'\n' Text.Whitespace
38+
39+
'or_eq' Keyword
40+
'\n' Text.Whitespace
41+
42+
'xor' Keyword
43+
'\n' Text.Whitespace
44+
45+
'xor_eq' Keyword
46+
'\n' Text.Whitespace

0 commit comments

Comments
 (0)