[MLton-commit] r7533

Matthew Fluet fluet at mlton.org
Mon May 23 19:34:32 PDT 2011


Tweaks to Pygments SML lexer.
----------------------------------------------------------------------

U   mlton/trunk/ide/pygments/sml_lexer/__init__.py

----------------------------------------------------------------------

Modified: mlton/trunk/ide/pygments/sml_lexer/__init__.py
===================================================================
--- mlton/trunk/ide/pygments/sml_lexer/__init__.py	2011-05-23 22:34:35 UTC (rev 7532)
+++ mlton/trunk/ide/pygments/sml_lexer/__init__.py	2011-05-24 02:34:31 UTC (rev 7533)
@@ -5,7 +5,7 @@
 
 import re
 
-from pygments.lexer import RegexLexer, bygroups, include
+from pygments.lexer import RegexLexer, bygroups
 from pygments.token import *
 
 
@@ -45,10 +45,10 @@
         ## Modules
     ]
 
-    alphanumid_re = r'[a-zA-Z][a-zA-Z0-9_\']*'
-    symbolicid_re = r'[!%&$#+\-/:<=>?@\\~`^|*]+'
-    long_id_re = r'((%s\.)*)((%s)|(%s))' % (alphanumid_re, alphanumid_re, symbolicid_re)
-    primed_alphanumid_re = r'\'[a-zA-Z0-9_\']*'
+    alphanumid_re = r"[a-zA-Z][a-zA-Z0-9_']*"
+    symbolicid_re = r"[!%&$#+\-/:<=>?@\\~`^|*]+"
+    long_id_re = r"((%s\.)*)((%s)|(%s))" % (alphanumid_re, alphanumid_re, symbolicid_re)
+    primed_alphanumid_re = r"'[a-zA-Z0-9_']*"
 
     def long_id_callback(self, match):
         strids = match.group(1)
@@ -90,10 +90,6 @@
             (r'\s+', Whitespace),
             (r'\(\*', Comment.Multiline, 'comment'),
 
-            (long_id_re, long_id_callback),
-            (r'(%s)' % '|'.join([re.escape(z) for z in nonid_reserved]), Punctuation),
-            (primed_alphanumid_re, Name),
-
             (r'~?[0-9]+\.[0-9]+((e|E)~?[0-9]+)?', Number.Float),
             (r'~?[0-9]+(e|E)~?[0-9]+', Number.Float),
             (r'0wx[0-9a-fA-F]+', Number.Hex),
@@ -102,8 +98,12 @@
             (r'~?[0-9]+', Number.Integer),
 
             (r'"', String, 'string'),
-            (r'(#)(")', bygroups(Text, String), 'string'),
+            (r'(#)(")', bygroups(Punctuation, String), 'string'),
 
+            (long_id_re, long_id_callback),
+            (r'(%s)' % '|'.join([re.escape(z) for z in nonid_reserved]), Punctuation),
+            (primed_alphanumid_re, Name),
+
             (r'.', Error, 'error')
         ],
         'error': [




More information about the MLton-commit mailing list