diff src/compiler.sml @ 1157:76f607cefdb1

Fix detection of blank lines in .urp
author Adam Chlipala <adamc@hcoop.net>
date Sun, 07 Feb 2010 09:38:27 -0500
parents de48dc2c9ee8
children ed3e5329b60e
line wrap: on
line diff
--- a/src/compiler.sml	Sun Feb 07 09:14:06 2010 -0500
+++ b/src/compiler.sml	Sun Feb 07 09:38:27 2010 -0500
@@ -286,19 +286,12 @@
 
                 val inf = opener ()
 
-                fun hasAnyLine () =
+                fun hasSpaceLine () =
                     case TextIO.inputLine inf of
                         NONE => false
-                      | SOME "\n" => false
-                      | _ => true
+                      | SOME s => CharVector.exists Char.isSpace s orelse hasSpaceLine ()
 
-                fun hasBlankLine () =
-                    case TextIO.inputLine inf of
-                        NONE => false
-                      | SOME "\n" => hasAnyLine ()
-                      | _ => hasBlankLine ()
-
-                val hasBlankLine = hasBlankLine ()
+                val hasBlankLine = hasSpaceLine ()
 
                 val inf = (TextIO.closeIn inf; opener ())