Mercurial > urweb
changeset 1331:a6427d1eda6f
Comments in .urp files
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 11 Dec 2010 13:42:54 -0500 |
parents | 452b14d88a10 |
children | 4dd5d23bace2 |
files | doc/manual.tex src/compiler.sml tests/css.urp |
diffstat | 3 files changed, 17 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/manual.tex Sun Dec 05 18:47:54 2010 +0100 +++ b/doc/manual.tex Sat Dec 11 13:42:54 2010 -0500 @@ -128,7 +128,7 @@ psql -f crud1.sql test \end{verbatim} -A blank line separates the named directives from a list of modules to include in the project. +A blank line separates the named directives from a list of modules to include in the project. Any line may contain a shell-script-style comment, where any suffix of a line starting at a hash character \texttt{\#} is ignored. For each entry \texttt{M} in the module list, the file \texttt{M.urs} is included in the project if it exists, and the file \texttt{M.ur} must exist and is always included.
--- a/src/compiler.sml Sun Dec 05 18:47:54 2010 +0100 +++ b/src/compiler.sml Sat Dec 11 13:42:54 2010 -0500 @@ -310,6 +310,14 @@ Settings.setSafeGets (#safeGets job); Settings.setOnError (#onError job)) +fun inputCommentableLine inf = + Option.map (fn s => + let + val s = #1 (Substring.splitl (fn ch => ch <> #"#") (Substring.full s)) + in + Substring.string (#1 (Substring.splitr (not o Char.isSpace) s)) + end) (TextIO.inputLine inf) + fun parseUrp' accLibs fname = if not (Posix.FileSys.access (fname ^ ".urp", []) orelse Posix.FileSys.access (fname ^ "/lib.urp", [])) andalso Posix.FileSys.access (fname ^ ".ur", []) then @@ -359,9 +367,9 @@ val inf = opener () fun hasSpaceLine () = - case TextIO.inputLine inf of + case inputCommentableLine inf of NONE => false - | SOME s => s = "debug\n" orelse s = "profile\n" + | SOME s => s = "debug" orelse s = "profile" orelse CharVector.exists (fn ch => ch = #" " orelse ch = #"\t") s orelse hasSpaceLine () val hasBlankLine = hasSpaceLine () @@ -412,7 +420,7 @@ OS.Path.mkAbsolute {path = pathify fname, relativeTo = absDir} fun readSources acc = - case TextIO.inputLine inf of + case inputCommentableLine inf of NONE => rev acc | SOME line => let @@ -573,9 +581,9 @@ (Settings.Exact, s) fun read () = - case TextIO.inputLine inf of + case inputCommentableLine inf of NONE => finish [] - | SOME "\n" => finish (readSources []) + | SOME "" => finish (readSources []) | SOME line => let val (cmd, arg) = Substring.splitl (fn x => not (Char.isSpace x)) (Substring.full line)