summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-02-06 15:34:41 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-02-06 15:34:41 -0500
commita978113ec89492e3c612e2409b8dfd0f3c9682cb (patch)
tree030689d7f60d1b5a580b8c638f1c297899b068d7
parent0771f5711f1bfcd0b958049957f91289622e5f85 (diff)
Allow .urp files without initial blank lines
-rw-r--r--demo/alert.urp1
-rw-r--r--demo/batchFun.urp1
-rw-r--r--demo/cookie.urp1
-rw-r--r--demo/counter.urp1
-rw-r--r--demo/form.urp1
-rw-r--r--demo/hello.urp1
-rw-r--r--demo/link.urp1
-rw-r--r--demo/listEdit.urp1
-rw-r--r--demo/listShop.urp1
-rw-r--r--demo/metaform1.urp1
-rw-r--r--demo/metaform2.urp1
-rw-r--r--demo/nested.urp1
-rw-r--r--demo/react.urp1
-rw-r--r--demo/rec.urp1
-rw-r--r--demo/subforms.urp1
-rw-r--r--demo/sum.urp1
-rw-r--r--demo/tcSum.urp1
-rw-r--r--demo/threads.urp1
-rw-r--r--doc/manual.tex2
-rw-r--r--src/compiler.sml25
-rw-r--r--src/demo.sml9
21 files changed, 30 insertions, 24 deletions
diff --git a/demo/alert.urp b/demo/alert.urp
index 5a85a04e..34016b99 100644
--- a/demo/alert.urp
+++ b/demo/alert.urp
@@ -1,2 +1 @@
-
alert
diff --git a/demo/batchFun.urp b/demo/batchFun.urp
index 48f4d27a..a646565e 100644
--- a/demo/batchFun.urp
+++ b/demo/batchFun.urp
@@ -1,2 +1 @@
-
batchFun
diff --git a/demo/cookie.urp b/demo/cookie.urp
index 9e283d4b..871bb87e 100644
--- a/demo/cookie.urp
+++ b/demo/cookie.urp
@@ -1,2 +1 @@
-
cookie
diff --git a/demo/counter.urp b/demo/counter.urp
index d22312c9..e64bdbfb 100644
--- a/demo/counter.urp
+++ b/demo/counter.urp
@@ -1,2 +1 @@
-
counter
diff --git a/demo/form.urp b/demo/form.urp
index 73356d49..335f1dd0 100644
--- a/demo/form.urp
+++ b/demo/form.urp
@@ -1,2 +1 @@
-
form
diff --git a/demo/hello.urp b/demo/hello.urp
index 3e23ae48..ce013625 100644
--- a/demo/hello.urp
+++ b/demo/hello.urp
@@ -1,2 +1 @@
-
hello
diff --git a/demo/link.urp b/demo/link.urp
index 01d60187..2b2328d7 100644
--- a/demo/link.urp
+++ b/demo/link.urp
@@ -1,2 +1 @@
-
link
diff --git a/demo/listEdit.urp b/demo/listEdit.urp
index 592e0546..87bd2452 100644
--- a/demo/listEdit.urp
+++ b/demo/listEdit.urp
@@ -1,2 +1 @@
-
listEdit
diff --git a/demo/listShop.urp b/demo/listShop.urp
index 85d318d4..9b4b3189 100644
--- a/demo/listShop.urp
+++ b/demo/listShop.urp
@@ -1,4 +1,3 @@
-
list
listFun
listShop
diff --git a/demo/metaform1.urp b/demo/metaform1.urp
index 7f04b9b7..c5558e25 100644
--- a/demo/metaform1.urp
+++ b/demo/metaform1.urp
@@ -1,3 +1,2 @@
-
metaform
metaform1
diff --git a/demo/metaform2.urp b/demo/metaform2.urp
index debc0448..623a84d5 100644
--- a/demo/metaform2.urp
+++ b/demo/metaform2.urp
@@ -1,3 +1,2 @@
-
metaform
metaform2
diff --git a/demo/nested.urp b/demo/nested.urp
index 179014dc..79c53955 100644
--- a/demo/nested.urp
+++ b/demo/nested.urp
@@ -1,2 +1 @@
-
nested
diff --git a/demo/react.urp b/demo/react.urp
index 80ed64e1..f7757f40 100644
--- a/demo/react.urp
+++ b/demo/react.urp
@@ -1,2 +1 @@
-
react
diff --git a/demo/rec.urp b/demo/rec.urp
index 979d20d5..6e27e716 100644
--- a/demo/rec.urp
+++ b/demo/rec.urp
@@ -1,2 +1 @@
-
rec
diff --git a/demo/subforms.urp b/demo/subforms.urp
index d2ac98ee..e70e4ef8 100644
--- a/demo/subforms.urp
+++ b/demo/subforms.urp
@@ -1,2 +1 @@
-
subforms
diff --git a/demo/sum.urp b/demo/sum.urp
index e872a81b..92292873 100644
--- a/demo/sum.urp
+++ b/demo/sum.urp
@@ -1,2 +1 @@
-
sum
diff --git a/demo/tcSum.urp b/demo/tcSum.urp
index 8b36efc0..42f743ac 100644
--- a/demo/tcSum.urp
+++ b/demo/tcSum.urp
@@ -1,2 +1 @@
-
tcSum
diff --git a/demo/threads.urp b/demo/threads.urp
index 153e09a9..84fbe4f7 100644
--- a/demo/threads.urp
+++ b/demo/threads.urp
@@ -1,3 +1,2 @@
-
buffer
threads
diff --git a/doc/manual.tex b/doc/manual.tex
index b15d4b6b..c5cfc52f 100644
--- a/doc/manual.tex
+++ b/doc/manual.tex
@@ -128,7 +128,7 @@ createdb test
psql -f crud1.sql test
\end{verbatim}
-A blank line always separates the named directives from a list of modules to include in the project; if there are no named directives, a blank line must begin the file.
+A blank line separates the named directives from a list of modules to include in the project.
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.
diff --git a/src/compiler.sml b/src/compiler.sml
index e72d8b4b..ab3ec10a 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -282,7 +282,25 @@ fun parseUrp' accLibs fname =
fun pu filename =
let
val dir = OS.Path.dir filename
- val inf = TextIO.openIn (OS.Path.joinBaseExt {base = filename, ext = SOME "urp"})
+ fun opener () = TextIO.openIn (OS.Path.joinBaseExt {base = filename, ext = SOME "urp"})
+
+ val inf = opener ()
+
+ fun hasAnyLine () =
+ case TextIO.inputLine inf of
+ NONE => false
+ | SOME "\n" => false
+ | _ => true
+
+ fun hasBlankLine () =
+ case TextIO.inputLine inf of
+ NONE => false
+ | SOME "\n" => hasAnyLine ()
+ | _ => hasBlankLine ()
+
+ val hasBlankLine = hasBlankLine ()
+
+ val inf = (TextIO.closeIn inf; opener ())
fun pathify fname =
if size fname > 0 andalso String.sub (fname, 0) = #"$" then
@@ -591,7 +609,10 @@ fun parseUrp' accLibs fname =
read ()
end
- val job = read ()
+ val job = if hasBlankLine then
+ read ()
+ else
+ finish (readSources [])
in
TextIO.closeIn inf;
Settings.setUrlPrefix (#prefix job);
diff --git a/src/demo.sml b/src/demo.sml
index 55615173..71f72fbf 100644
--- a/src/demo.sml
+++ b/src/demo.sml
@@ -1,4 +1,4 @@
-(* Copyright (c) 2008, Adam Chlipala
+(* Copyright (c) 2008-2010, Adam Chlipala
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -197,7 +197,8 @@ fun make' {prefix, dirname, guided} =
ext = SOME s}
val src' = OS.Path.file src
in
- if String.isPrefix (OS.Path.mkCanonical dirname) src
+ if String.isPrefix (OS.Path.mkAbsolute {path = dirname,
+ relativeTo = OS.FileSys.getDir ()}) src
andalso OS.FileSys.access (src, []) then
(TextIO.output (out, " | <a target=\"showcase\" href=\"");
TextIO.output (out, src');
@@ -205,7 +206,9 @@ fun make' {prefix, dirname, guided} =
TextIO.output (out, src');
TextIO.output (out, "</tt></a>"))
else
- ()
+ print (src ^ " "
+ ^ OS.Path.mkAbsolute {path = dirname,
+ relativeTo = OS.FileSys.getDir ()} ^ "\n")
end
in
ifEx "urs";