[MLton-commit] r4055

Stephen Weeks MLton@mlton.org
Wed, 31 Aug 2005 17:08:36 -0700


Fixed bug stemming from recent mllex file-position change, which
caused column numbers on the first line to be off by two.


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

U   mlton/trunk/mlton/control/source.sml

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

Modified: mlton/trunk/mlton/control/source.sml
===================================================================
--- mlton/trunk/mlton/control/source.sml	2005-08-31 18:13:54 UTC (rev 4054)
+++ mlton/trunk/mlton/control/source.sml	2005-09-01 00:08:35 UTC (rev 4055)
@@ -29,7 +29,12 @@
                       
 fun new file = T {file = ref file,
                   lineNum = ref 1,
-                  lineStart = ref 1}
+                  (* mllex file positions start at zero, while we report errors
+                   * starting in column 1, so we need to pretend the first line
+                   * starts at position ~1, which will translate position 0 to
+                   * column 1.
+                   *)
+                  lineStart = ref ~1}
 
 fun newline (T {lineStart, lineNum, ...}, n) =
    (Int.inc lineNum