comparison 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
comparison
equal deleted inserted replaced
1156:b6111b688060 1157:76f607cefdb1
284 val dir = OS.Path.dir filename 284 val dir = OS.Path.dir filename
285 fun opener () = TextIO.openIn (OS.Path.joinBaseExt {base = filename, ext = SOME "urp"}) 285 fun opener () = TextIO.openIn (OS.Path.joinBaseExt {base = filename, ext = SOME "urp"})
286 286
287 val inf = opener () 287 val inf = opener ()
288 288
289 fun hasAnyLine () = 289 fun hasSpaceLine () =
290 case TextIO.inputLine inf of 290 case TextIO.inputLine inf of
291 NONE => false 291 NONE => false
292 | SOME "\n" => false 292 | SOME s => CharVector.exists Char.isSpace s orelse hasSpaceLine ()
293 | _ => true 293
294 294 val hasBlankLine = hasSpaceLine ()
295 fun hasBlankLine () =
296 case TextIO.inputLine inf of
297 NONE => false
298 | SOME "\n" => hasAnyLine ()
299 | _ => hasBlankLine ()
300
301 val hasBlankLine = hasBlankLine ()
302 295
303 val inf = (TextIO.closeIn inf; opener ()) 296 val inf = (TextIO.closeIn inf; opener ())
304 297
305 fun pathify fname = 298 fun pathify fname =
306 if size fname > 0 andalso String.sub (fname, 0) = #"$" then 299 if size fname > 0 andalso String.sub (fname, 0) = #"$" then