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 |