diff --git a/pygments/lexers/functional.py b/pygments/lexers/functional.py index ee44f7c..3d6841e 100644 --- a/pygments/lexers/functional.py +++ b/pygments/lexers/functional.py @@ -632,7 +632,7 @@ class SMLLexer(RegexLexer): (r'#\s+(%s)' % symbolicid_re, Name.Label), # Some reserved words trigger a special, local lexer state change (r'\b(datatype|abstype)\b(?!\')', Keyword.Reserved, 'dname'), - (r'(?=\b(exception)\b(?!\'))', Text, ('ename')), + (r'\b(exception)\b(?!\')', Keyword.Reserved, 'ename'), (r'\b(functor|include|open|signature|structure)\b(?!\')', Keyword.Reserved, 'sname'), (r'\b(type|eqtype)\b(?!\')', Keyword.Reserved, 'tname'), @@ -803,15 +803,14 @@ class SMLLexer(RegexLexer): 'ename': [ include('whitespace'), - (r'(exception|and)\b(\s+)(%s)' % alphanumid_re, + (r'(and\b)(\s+)(%s)' % alphanumid_re, bygroups(Keyword.Reserved, Text, Name.Class)), - (r'(exception|and)\b(\s*)(%s)' % symbolicid_re, + (r'(and\b)(\s*)(%s)' % symbolicid_re, bygroups(Keyword.Reserved, Text, Name.Class)), (r'\b(of)\b(?!\')', Keyword.Reserved), + (r'(%s)|(%s)' % (alphanumid_re, symbolicid_re), Name.Class), - include('breakout'), - include('core'), - (r'\S+', Error), + ('', Text, '#pop'), ], 'datcon': [