53 lines
2.0 KiB
Diff
53 lines
2.0 KiB
Diff
From f91804ff4772e3ab41f46e28d370f57898700333 Mon Sep 17 00:00:00 2001
|
|
From: Georg Brandl <georg@python.org>
|
|
Date: Thu, 10 Dec 2020 08:19:21 +0100
|
|
Subject: [PATCH] fixes #1625: infinite loop in SML lexer
|
|
|
|
Reason was a lookahead-only pattern which was included in the state
|
|
where the lookahead was transitioning to.
|
|
---
|
|
pygments/lexers/ml.py | 12 ++++++------
|
|
2 files changed, 14 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/pygments/lexers/ml.py b/pygments/lexers/ml.py
|
|
index 8ca8ce3eb..f2ac367c5 100644
|
|
--- a/pygments/lexers/ml.py
|
|
+++ b/pygments/lexers/ml.py
|
|
@@ -142,7 +142,7 @@ def id_callback(self, match):
|
|
(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'),
|
|
@@ -315,15 +315,14 @@ def id_callback(self, match):
|
|
'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),
|
|
+ default('#pop'),
|
|
],
|
|
|
|
'datcon': [
|
|
@@ -445,6 +444,7 @@ class OcamlLexer(RegexLexer):
|
|
],
|
|
}
|
|
|
|
+
|
|
class OpaLexer(RegexLexer):
|
|
"""
|
|
Lexer for the Opa language (http://opalang.org).
|