[MLton-commit] r7548

Matthew Fluet fluet at mlton.org
Fri Jun 17 08:21:11 PDT 2011


Changed line directives in ML-Lex and ML-Yacc generated code to be simple file names, rather than absolute paths.
----------------------------------------------------------------------

U   mlton/trunk/mllex/lexgen.sml
U   mlton/trunk/mlyacc/src/yacc.sml

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

Modified: mlton/trunk/mllex/lexgen.sml
===================================================================
--- mlton/trunk/mllex/lexgen.sml	2011-06-17 15:21:02 UTC (rev 7547)
+++ mlton/trunk/mllex/lexgen.sml	2011-06-17 15:21:05 UTC (rev 7548)
@@ -1,3 +1,6 @@
+(* Modified by Matthew Fluet on 2011-06-17.
+ * Use simple file name (rather than absolute paths) in line directives in output.
+ *)
 (* Modified by Vesa Karvonen on 2007-12-19.
  * Create line directives in output.
  *)
@@ -295,7 +298,7 @@
    val OutFile = ref ""
    fun fmtLineDir {line, col} file =
        String.concat ["(*#line ", Int.toString line, ".", Int.toString (col+1),
-                      " \"", OS.FileSys.fullPath file, "\"*)"]
+                      " \"", file, "\"*)"]
    val sayPos =
     fn SOME pos => say (fmtLineDir pos (!InFile))
      | NONE => (say (fmtLineDir {line = !LexOutLine, col = 0} (!OutFile));
@@ -1284,7 +1287,7 @@
 
 fun lexGen(infile) =
     let val outfile = infile ^ ".sml"
-        val () = (InFile := infile; OutFile := outfile)
+        val () = (InFile := OS.Path.file infile; OutFile := OS.Path.file outfile)
       fun PrintLexer (ends) =
     let val sayln = fn x => (say x; say "\n")
      in case !ArgCode

Modified: mlton/trunk/mlyacc/src/yacc.sml
===================================================================
--- mlton/trunk/mlyacc/src/yacc.sml	2011-06-17 15:21:02 UTC (rev 7547)
+++ mlton/trunk/mlyacc/src/yacc.sml	2011-06-17 15:21:05 UTC (rev 7548)
@@ -1,3 +1,6 @@
+(* Modified by Matthew Fluet on 2011-06-17.
+ * Use simple file name (rather than absolute paths) in line directives in output.
+ *)
 (* Modified by Vesa Karvonen on 2007-12-18.
  * Create line directives in output.
  *)
@@ -777,8 +780,8 @@
 
     in  let val result = TextIO.openOut (spec ^ ".sml")
             val sigs = TextIO.openOut (spec ^ ".sig")
-            val specPath = OS.FileSys.fullPath spec
-            val resultPath = OS.FileSys.fullPath (spec ^ ".sml")
+            val specFile = OS.Path.file spec
+            val resultFile = OS.Path.file result
             val line = ref 1
             val col = ref 0
             val pr = fn s => TextIO.output(result,s)
@@ -793,8 +796,8 @@
                String.concat ["(*#line ", Int.toString line, ".",
                               Int.toString (col+1), " \"", path, "\"*)"]
             val fmtPos =
-               fn NONE => (fmtLineDir {line = !line, col = 0} resultPath) ^ "\n"
-                | SOME pos => fmtLineDir pos specPath
+               fn NONE => (fmtLineDir {line = !line, col = 0} resultFile) ^ "\n"
+                | SOME pos => fmtLineDir pos specFile
             val termvoid = makeUniqueId "VOID"
             val ntvoid = makeUniqueId "ntVOID"
             val hasType = fn s => case symbolType s




More information about the MLton-commit mailing list