ThirdParty/Pygments/pygments/lexers/c_cpp.py

changeset 5072
aab59042fefb
parent 4697
c2e9bf425554
child 5713
6762afd9f963
equal deleted inserted replaced
5070:4e4651e88674 5072:aab59042fefb
214 'constexpr', 'nullptr', 'decltype', 'thread_local', 214 'constexpr', 'nullptr', 'decltype', 'thread_local',
215 'alignas', 'alignof', 'static_assert', 'noexcept', 'override', 215 'alignas', 'alignof', 'static_assert', 'noexcept', 'override',
216 'final'), suffix=r'\b'), Keyword), 216 'final'), suffix=r'\b'), Keyword),
217 (r'char(16_t|32_t)\b', Keyword.Type), 217 (r'char(16_t|32_t)\b', Keyword.Type),
218 (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'), 218 (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
219 # C++11 raw strings
220 (r'R"\(', String, 'rawstring'),
219 inherit, 221 inherit,
220 ], 222 ],
221 'root': [ 223 'root': [
222 inherit, 224 inherit,
223 # C++ Microsoft-isms 225 # C++ Microsoft-isms
230 'classname': [ 232 'classname': [
231 (r'[a-zA-Z_]\w*', Name.Class, '#pop'), 233 (r'[a-zA-Z_]\w*', Name.Class, '#pop'),
232 # template specification 234 # template specification
233 (r'\s*(?=>)', Text, '#pop'), 235 (r'\s*(?=>)', Text, '#pop'),
234 ], 236 ],
237 'rawstring': [
238 (r'\)"', String, '#pop'),
239 (r'[^)]+', String),
240 (r'\)', String),
241 ],
235 } 242 }
236 243
237 def analyse_text(text): 244 def analyse_text(text):
238 if re.search('#include <[a-z]+>', text): 245 if re.search('#include <[a-z_]+>', text):
239 return 0.2 246 return 0.2
240 if re.search('using namespace ', text): 247 if re.search('using namespace ', text):
241 return 0.4 248 return 0.4

eric ide

mercurial