eric6/ThirdParty/Pygments/pygments/lexers/c_cpp.py

changeset 7547
21b0534faebc
parent 6942
2602857055c5
child 7701
25f42e208e08
equal deleted inserted replaced
7546:bf5f777260a6 7547:21b0534faebc
3 pygments.lexers.c_cpp 3 pygments.lexers.c_cpp
4 ~~~~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~~~~
5 5
6 Lexers for C/C++ languages. 6 Lexers for C/C++ languages.
7 7
8 :copyright: Copyright 2006-2017 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2019 by the Pygments team, see AUTHORS.
9 :license: BSD, see LICENSE for details. 9 :license: BSD, see LICENSE for details.
10 """ 10 """
11 11
12 import re 12 import re
13 13
142 (r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'), 142 (r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
143 (r'.*?\n', Comment), 143 (r'.*?\n', Comment),
144 ] 144 ]
145 } 145 }
146 146
147 stdlib_types = set(( 147 stdlib_types = {
148 'size_t', 'ssize_t', 'off_t', 'wchar_t', 'ptrdiff_t', 'sig_atomic_t', 'fpos_t', 148 'size_t', 'ssize_t', 'off_t', 'wchar_t', 'ptrdiff_t', 'sig_atomic_t', 'fpos_t',
149 'clock_t', 'time_t', 'va_list', 'jmp_buf', 'FILE', 'DIR', 'div_t', 'ldiv_t', 149 'clock_t', 'time_t', 'va_list', 'jmp_buf', 'FILE', 'DIR', 'div_t', 'ldiv_t',
150 'mbstate_t', 'wctrans_t', 'wint_t', 'wctype_t')) 150 'mbstate_t', 'wctrans_t', 'wint_t', 'wctype_t'}
151 c99_types = set(( 151 c99_types = {
152 '_Bool', '_Complex', 'int8_t', 'int16_t', 'int32_t', 'int64_t', 'uint8_t', 152 '_Bool', '_Complex', 'int8_t', 'int16_t', 'int32_t', 'int64_t', 'uint8_t',
153 'uint16_t', 'uint32_t', 'uint64_t', 'int_least8_t', 'int_least16_t', 153 'uint16_t', 'uint32_t', 'uint64_t', 'int_least8_t', 'int_least16_t',
154 'int_least32_t', 'int_least64_t', 'uint_least8_t', 'uint_least16_t', 154 'int_least32_t', 'int_least64_t', 'uint_least8_t', 'uint_least16_t',
155 'uint_least32_t', 'uint_least64_t', 'int_fast8_t', 'int_fast16_t', 'int_fast32_t', 155 'uint_least32_t', 'uint_least64_t', 'int_fast8_t', 'int_fast16_t', 'int_fast32_t',
156 'int_fast64_t', 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t', 156 'int_fast64_t', 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t',
157 'intptr_t', 'uintptr_t', 'intmax_t', 'uintmax_t')) 157 'intptr_t', 'uintptr_t', 'intmax_t', 'uintmax_t'}
158 linux_types = set(( 158 linux_types = {
159 'clockid_t', 'cpu_set_t', 'cpumask_t', 'dev_t', 'gid_t', 'id_t', 'ino_t', 'key_t', 159 'clockid_t', 'cpu_set_t', 'cpumask_t', 'dev_t', 'gid_t', 'id_t', 'ino_t', 'key_t',
160 'mode_t', 'nfds_t', 'pid_t', 'rlim_t', 'sig_t', 'sighandler_t', 'siginfo_t', 160 'mode_t', 'nfds_t', 'pid_t', 'rlim_t', 'sig_t', 'sighandler_t', 'siginfo_t',
161 'sigset_t', 'sigval_t', 'socklen_t', 'timer_t', 'uid_t')) 161 'sigset_t', 'sigval_t', 'socklen_t', 'timer_t', 'uid_t'}
162 162
163 def __init__(self, **options): 163 def __init__(self, **options):
164 self.stdlibhighlighting = get_bool_opt(options, 'stdlibhighlighting', True) 164 self.stdlibhighlighting = get_bool_opt(options, 'stdlibhighlighting', True)
165 self.c99highlighting = get_bool_opt(options, 'c99highlighting', True) 165 self.c99highlighting = get_bool_opt(options, 'c99highlighting', True)
166 self.platformhighlighting = get_bool_opt(options, 'platformhighlighting', True) 166 self.platformhighlighting = get_bool_opt(options, 'platformhighlighting', True)
216 'private', 'protected', 'public', 'reinterpret_cast', 216 'private', 'protected', 'public', 'reinterpret_cast',
217 'restrict', 'static_cast', 'template', 'this', 'throw', 'throws', 217 'restrict', 'static_cast', 'template', 'this', 'throw', 'throws',
218 'try', 'typeid', 'typename', 'using', 'virtual', 218 'try', 'typeid', 'typename', 'using', 'virtual',
219 'constexpr', 'nullptr', 'decltype', 'thread_local', 219 'constexpr', 'nullptr', 'decltype', 'thread_local',
220 'alignas', 'alignof', 'static_assert', 'noexcept', 'override', 220 'alignas', 'alignof', 'static_assert', 'noexcept', 'override',
221 'final'), suffix=r'\b'), Keyword), 221 'final', 'constinit', 'consteval', 'concept', 'co_await',
222 (r'char(16_t|32_t)\b', Keyword.Type), 222 'co_return', 'co_yield', 'requires', 'import', 'module'), suffix=r'\b'), Keyword),
223 (r'char(16_t|32_t|8_t)\b', Keyword.Type),
223 (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'), 224 (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
224 # C++11 raw strings 225 # C++11 raw strings
225 (r'(R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)(")', 226 (r'(R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)(")',
226 bygroups(String.Affix, String, String.Delimiter, String.Delimiter, 227 bygroups(String.Affix, String, String.Delimiter, String.Delimiter,
227 String, String.Delimiter, String)), 228 String, String.Delimiter, String)),

eric ide

mercurial