summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-09-15 13:07:57 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-09-15 13:07:57 -0400
commit8e944e62818045b820f45776a396bc1b66ab3056 (patch)
tree2790236bfd930177b19eec97fc9ac1d47e9dd7d4
parent69bdeb0e79c7b33260111c6c6eae332d37d28d0e (diff)
Fix JavaScript char literals; don't generate demo links to nonexistent files
-rw-r--r--demo/more/grid.ur2
-rw-r--r--demo/more/grid.urs1
-rw-r--r--src/demo.sml3
-rw-r--r--src/jscomp.sml56
4 files changed, 32 insertions, 30 deletions
diff --git a/demo/more/grid.ur b/demo/more/grid.ur
index 412fe585..74ce6b38 100644
--- a/demo/more/grid.ur
+++ b/demo/more/grid.ur
@@ -84,7 +84,7 @@ functor Make(M : sig
fun render grid = <xml>
<table class={tabl}>
<tr class={tr}>
- <th/> <th/>
+ <th/> <th/> <th/>
{foldRX2 [fst] [colMeta M.row] [_]
(fn [nm :: Name] [p :: (Type * Type)] [rest :: {(Type * Type)}] [[nm] ~ rest]
data (meta : colMeta M.row p) =>
diff --git a/demo/more/grid.urs b/demo/more/grid.urs
index 51ec79c2..e3d8f828 100644
--- a/demo/more/grid.urs
+++ b/demo/more/grid.urs
@@ -47,4 +47,5 @@ functor Make(M : sig
style tr
style th
style td
+ style agg
end
diff --git a/src/demo.sml b/src/demo.sml
index ebdf4e40..4e2caa99 100644
--- a/src/demo.sml
+++ b/src/demo.sml
@@ -197,7 +197,8 @@ fun make {prefix, dirname, guided} =
ext = SOME s}
val src' = OS.Path.file src
in
- if OS.FileSys.access (src, []) then
+ if String.isPrefix (OS.Path.mkCanonical dirname) src
+ andalso OS.FileSys.access (src, []) then
(TextIO.output (out, " | <a target=\"showcase\" href=\"");
TextIO.output (out, src');
TextIO.output (out, ".html\"><tt>");
diff --git a/src/jscomp.sml b/src/jscomp.sml
index 178591b5..ca4f047b 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -537,34 +537,34 @@ fun process file =
val strcat = strcat loc
fun jsPrim p =
- case p of
- Prim.String s =>
- str ("\""
- ^ String.translate (fn #"'" =>
- if mode = Attribute then
- "\\047"
- else
- "'"
- | #"\"" => "\\\""
- | #"<" =>
- (*if mode = Script then
- "<"
- else*)
- "\\074"
- | #"\\" => "\\\\"
- | #"\n" => "\\n"
- | #"\r" => "\\r"
- | #"\t" => "\\t"
- | ch =>
- if Char.isPrint ch then
- String.str ch
- else
- "\\" ^ padWith (#"0",
- Int.fmt StringCvt.OCT (ord ch),
- 3)) s
- ^ "\"")
- | Prim.Char ch => str ("'" ^ String.str ch ^ "'")
- | _ => str (Prim.toString p)
+ let
+ fun jsChar ch =
+ case ch of
+ #"'" =>
+ if mode = Attribute then
+ "\\047"
+ else
+ "'"
+ | #"\"" => "\\\""
+ | #"<" => "\\074"
+ | #"\\" => "\\\\"
+ | #"\n" => "\\n"
+ | #"\r" => "\\r"
+ | #"\t" => "\\t"
+ | ch =>
+ if Char.isPrint ch then
+ String.str ch
+ else
+ "\\" ^ padWith (#"0",
+ Int.fmt StringCvt.OCT (ord ch),
+ 3)
+ in
+ case p of
+ Prim.String s =>
+ str ("\"" ^ String.translate jsChar s ^ "\"")
+ | Prim.Char ch => str ("'" ^ jsChar ch ^ "'")
+ | _ => str (Prim.toString p)
+ end
fun jsPat depth inner (p, _) succ fail =
case p of