# HG changeset patch # User Adam Chlipala # Date 1253034477 14400 # Node ID e2194a6793aeaa1d5468aa65f8f030e9f46a1b54 # Parent 280f81731426aa7901171df7d3e713b645059506 Fix JavaScript char literals; don't generate demo links to nonexistent files diff -r 280f81731426 -r e2194a6793ae demo/more/grid.ur --- a/demo/more/grid.ur Tue Sep 15 12:41:54 2009 -0400 +++ b/demo/more/grid.ur Tue Sep 15 13:07:57 2009 -0400 @@ -84,7 +84,7 @@ fun render grid = -
+ {foldRX2 [fst] [colMeta M.row] [_] (fn [nm :: Name] [p :: (Type * Type)] [rest :: {(Type * Type)}] [[nm] ~ rest] data (meta : colMeta M.row p) => diff -r 280f81731426 -r e2194a6793ae demo/more/grid.urs --- a/demo/more/grid.urs Tue Sep 15 12:41:54 2009 -0400 +++ b/demo/more/grid.urs Tue Sep 15 13:07:57 2009 -0400 @@ -47,4 +47,5 @@ style tr style th style td + style agg end diff -r 280f81731426 -r e2194a6793ae src/demo.sml --- a/src/demo.sml Tue Sep 15 12:41:54 2009 -0400 +++ b/src/demo.sml Tue Sep 15 13:07:57 2009 -0400 @@ -197,7 +197,8 @@ 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, " | "); diff -r 280f81731426 -r e2194a6793ae src/jscomp.sml --- a/src/jscomp.sml Tue Sep 15 12:41:54 2009 -0400 +++ b/src/jscomp.sml Tue Sep 15 13:07:57 2009 -0400 @@ -537,34 +537,34 @@ 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