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

changeset 7983
54c5cfbb1e29
parent 7701
25f42e208e08
equal deleted inserted replaced
7982:48d210e41c65 7983:54c5cfbb1e29
3 pygments.lexers.ml 3 pygments.lexers.ml
4 ~~~~~~~~~~~~~~~~~~ 4 ~~~~~~~~~~~~~~~~~~
5 5
6 Lexers for ML family languages. 6 Lexers for ML family languages.
7 7
8 :copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS. 8 :copyright: Copyright 2006-2021 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
140 (r'#\s*[1-9][0-9]*', Name.Label), 140 (r'#\s*[1-9][0-9]*', Name.Label),
141 (r'#\s*(%s)' % alphanumid_re, Name.Label), 141 (r'#\s*(%s)' % alphanumid_re, Name.Label),
142 (r'#\s+(%s)' % symbolicid_re, Name.Label), 142 (r'#\s+(%s)' % symbolicid_re, Name.Label),
143 # Some reserved words trigger a special, local lexer state change 143 # Some reserved words trigger a special, local lexer state change
144 (r'\b(datatype|abstype)\b(?!\')', Keyword.Reserved, 'dname'), 144 (r'\b(datatype|abstype)\b(?!\')', Keyword.Reserved, 'dname'),
145 (r'(?=\b(exception)\b(?!\'))', Text, ('ename')), 145 (r'\b(exception)\b(?!\')', Keyword.Reserved, 'ename'),
146 (r'\b(functor|include|open|signature|structure)\b(?!\')', 146 (r'\b(functor|include|open|signature|structure)\b(?!\')',
147 Keyword.Reserved, 'sname'), 147 Keyword.Reserved, 'sname'),
148 (r'\b(type|eqtype)\b(?!\')', Keyword.Reserved, 'tname'), 148 (r'\b(type|eqtype)\b(?!\')', Keyword.Reserved, 'tname'),
149 149
150 # Regular identifiers, long and otherwise 150 # Regular identifiers, long and otherwise
313 313
314 # Dealing with what comes after an exception 314 # Dealing with what comes after an exception
315 'ename': [ 315 'ename': [
316 include('whitespace'), 316 include('whitespace'),
317 317
318 (r'(exception|and)\b(\s+)(%s)' % alphanumid_re, 318 (r'(and\b)(\s+)(%s)' % alphanumid_re,
319 bygroups(Keyword.Reserved, Text, Name.Class)), 319 bygroups(Keyword.Reserved, Text, Name.Class)),
320 (r'(exception|and)\b(\s*)(%s)' % symbolicid_re, 320 (r'(and\b)(\s*)(%s)' % symbolicid_re,
321 bygroups(Keyword.Reserved, Text, Name.Class)), 321 bygroups(Keyword.Reserved, Text, Name.Class)),
322 (r'\b(of)\b(?!\')', Keyword.Reserved), 322 (r'\b(of)\b(?!\')', Keyword.Reserved),
323 323 (r'(%s)|(%s)' % (alphanumid_re, symbolicid_re), Name.Class),
324 include('breakout'), 324
325 include('core'), 325 default('#pop'),
326 (r'\S+', Error),
327 ], 326 ],
328 327
329 'datcon': [ 328 'datcon': [
330 include('whitespace'), 329 include('whitespace'),
331 (r'(%s)' % alphanumid_re, Name.Class, '#pop'), 330 (r'(%s)' % alphanumid_re, Name.Class, '#pop'),
442 (r'[A-Z][\w\']*', Name.Class, '#pop'), 441 (r'[A-Z][\w\']*', Name.Class, '#pop'),
443 (r'[a-z_][\w\']*', Name, '#pop'), 442 (r'[a-z_][\w\']*', Name, '#pop'),
444 default('#pop'), 443 default('#pop'),
445 ], 444 ],
446 } 445 }
446
447 447
448 class OpaLexer(RegexLexer): 448 class OpaLexer(RegexLexer):
449 """ 449 """
450 Lexer for the Opa language (http://opalang.org). 450 Lexer for the Opa language (http://opalang.org).
451 451

eric ide

mercurial