[MLton-commit] r7531

Matthew Fluet fluet at mlton.org
Mon May 16 14:05:49 PDT 2011


Properly handle strings with formatting gaps.
----------------------------------------------------------------------

U   mlton/trunk/ide/enscript/sml_all.st
U   mlton/trunk/ide/enscript/sml_simple.st

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

Modified: mlton/trunk/ide/enscript/sml_all.st
===================================================================
--- mlton/trunk/ide/enscript/sml_all.st	2011-05-03 20:30:24 UTC (rev 7530)
+++ mlton/trunk/ide/enscript/sml_all.st	2011-05-16 21:05:48 UTC (rev 7531)
@@ -88,6 +88,11 @@
  */
 state sml_string
 {
+  /\\\\(\s|\n)/ {
+    language_print ($0);
+    call (sml_string_gap);
+  }
+
   /\\\\./ {
     language_print ($0);
   }
@@ -102,6 +107,22 @@
   }
 }
 
+state sml_string_gap
+{
+  /(\s|\n)/ {
+    language_print ($0);
+  }
+
+  /\\\\/ {
+    language_print ($0);
+    return;
+  }
+
+  LANGUAGE_SPECIALS {
+    language_print ($0);
+  }
+}
+
 /*
  * Nested comments
  */

Modified: mlton/trunk/ide/enscript/sml_simple.st
===================================================================
--- mlton/trunk/ide/enscript/sml_simple.st	2011-05-03 20:30:24 UTC (rev 7530)
+++ mlton/trunk/ide/enscript/sml_simple.st	2011-05-16 21:05:48 UTC (rev 7531)
@@ -77,6 +77,11 @@
  */
 state sml_string extends Highlight
 {
+  /\\\\(\s|\n)/ {
+    language_print ($0);
+    call (sml_string_gap);
+  }
+
   /\\\\./ {
     language_print ($0);
   }
@@ -87,6 +92,18 @@
   }
 }
 
+state sml_string_gap extends Highlight
+{
+  /(\s|\n)/ {
+    language_print ($0);
+  }
+
+  /\\\\/ {
+    language_print ($0);
+    return;
+  }
+}
+
 /*
  * Nested comments
  */




More information about the MLton-commit mailing list