# HG changeset patch # User Adam Chlipala # Date 1267390001 18000 # Node ID 983d9b38abc74db895994febbdee18d4d061ef7f # Parent ad15700272f6bf0bd3c079638daa55d4a4c9de06 Fix parsing of space-free .urp directives; use 'class' for 'c*' tags diff -r ad15700272f6 -r 983d9b38abc7 lib/ur/top.ur --- a/lib/ur/top.ur Sun Feb 28 13:06:10 2010 -0500 +++ b/lib/ur/top.ur Sun Feb 28 15:46:41 2010 -0500 @@ -138,15 +138,6 @@ f [nm] [rest] ! r1.nm r2.nm (acc (r1 -- nm) (r2 -- nm))) (fn _ _ => i) -fun foldURX2 [tf1 :: Type] [tf2 :: Type] [ctx :: {Unit}] - (f : nm :: Name -> rest :: {Unit} - -> [[nm] ~ rest] => - tf1 -> tf2 -> xml ctx [] []) = - @@foldUR2 [tf1] [tf2] [fn _ => xml ctx [] []] - (fn [nm :: Name] [rest :: {Unit}] [[nm] ~ rest] v1 v2 acc => - {f [nm] [rest] ! v1 v2}{acc}) - - fun foldR [K] [tf :: K -> Type] [tr :: {K} -> Type] (f : nm :: Name -> t :: K -> rest :: {K} -> [[nm] ~ rest] => @@ -195,6 +186,15 @@ {f [nm] [t] [rest] ! r}{acc}) +fun mapUX2 [tf1 :: Type] [tf2 :: Type] [ctx :: {Unit}] + (f : nm :: Name -> rest :: {Unit} + -> [[nm] ~ rest] => + tf1 -> tf2 -> xml ctx [] []) = + @@foldUR2 [tf1] [tf2] [fn _ => xml ctx [] []] + (fn [nm :: Name] [rest :: {Unit}] [[nm] ~ rest] v1 v2 acc => + {f [nm] [rest] ! v1 v2}{acc}) + + fun mapX2 [K] [tf1 :: K -> Type] [tf2 :: K -> Type] [ctx :: {Unit}] (f : nm :: Name -> t :: K -> rest :: {K} -> [[nm] ~ rest] => diff -r ad15700272f6 -r 983d9b38abc7 lib/ur/top.urs --- a/lib/ur/top.urs Sun Feb 28 13:06:10 2010 -0500 +++ b/lib/ur/top.urs Sun Feb 28 15:46:41 2010 -0500 @@ -70,12 +70,6 @@ tf1 -> tf2 -> tr rest -> tr ([nm] ++ rest)) -> tr [] -> r ::: {Unit} -> folder r -> $(mapU tf1 r) -> $(mapU tf2 r) -> tr r -val foldURX2: tf1 :: Type -> tf2 :: Type -> ctx :: {Unit} - -> (nm :: Name -> rest :: {Unit} - -> [[nm] ~ rest] => - tf1 -> tf2 -> xml ctx [] []) - -> r ::: {Unit} -> folder r -> $(mapU tf1 r) -> $(mapU tf2 r) -> xml ctx [] [] - val foldR : K --> tf :: (K -> Type) -> tr :: ({K} -> Type) -> (nm :: Name -> t :: K -> rest :: {K} -> [[nm] ~ rest] => @@ -109,6 +103,13 @@ tf t -> xml ctx [] []) -> r ::: {K} -> folder r -> $(map tf r) -> xml ctx [] [] +val mapUX2 : tf1 :: Type -> tf2 :: Type -> ctx :: {Unit} + -> (nm :: Name -> rest :: {Unit} + -> [[nm] ~ rest] => + tf1 -> tf2 -> xml ctx [] []) + -> r ::: {Unit} -> folder r + -> $(mapU tf1 r) -> $(mapU tf2 r) -> xml ctx [] [] + val mapX2 : K --> tf1 :: (K -> Type) -> tf2 :: (K -> Type) -> ctx :: {Unit} -> (nm :: Name -> t :: K -> rest :: {K} -> [[nm] ~ rest] => diff -r ad15700272f6 -r 983d9b38abc7 src/compiler.sml --- a/src/compiler.sml Sun Feb 28 13:06:10 2010 -0500 +++ b/src/compiler.sml Sun Feb 28 15:46:41 2010 -0500 @@ -292,7 +292,8 @@ fun hasSpaceLine () = case TextIO.inputLine inf of NONE => false - | SOME s => CharVector.exists (fn ch => ch = #" " orelse ch = #"\t") s orelse hasSpaceLine () + | SOME s => s = "debug\n" orelse s = "profile\n" + orelse CharVector.exists (fn ch => ch = #" " orelse ch = #"\t") s orelse hasSpaceLine () val hasBlankLine = hasSpaceLine () diff -r ad15700272f6 -r 983d9b38abc7 src/monoize.sml --- a/src/monoize.sml Sun Feb 28 13:06:10 2010 -0500 +++ b/src/monoize.sml Sun Feb 28 15:46:41 2010 -0500 @@ -2787,12 +2787,28 @@ (L'.EJavaScript (L'.Script, e), loc), str ");"])) attrs + + val t = (L'.TFfi ("Basis", "string"), loc) + val setClass = (L'.ECase (class, + [((L'.PNone t, loc), + str ""), + ((L'.PSome (t, (L'.PVar ("x", t), loc)), loc), + (L'.EStrcat ((L'.EPrim (Prim.String "d.className=\""), loc), + (L'.EStrcat ((L'.ERel 0, loc), + (L'.EPrim (Prim.String "\";"), loc)), loc)), + loc))], + {disc = (L'.TOption t, loc), + result = t}), loc) in case assgns of - [] => jexp + [] => strcat [str "var d=", + jexp, + str ";", + setClass] | _ => strcat (str "var d=" :: jexp :: str ";" + :: setClass :: assgns) end diff -r ad15700272f6 -r 983d9b38abc7 tests/ctextbox.ur --- a/tests/ctextbox.ur Sun Feb 28 13:06:10 2010 -0500 +++ b/tests/ctextbox.ur Sun Feb 28 15:46:41 2010 -0500 @@ -1,7 +1,15 @@ +style foo + fun main () : transaction page = s <- source "Initial"; - return - + return + + + + + + - - + + + diff -r ad15700272f6 -r 983d9b38abc7 tests/ctextbox.urp --- a/tests/ctextbox.urp Sun Feb 28 13:06:10 2010 -0500 +++ b/tests/ctextbox.urp Sun Feb 28 15:46:41 2010 -0500 @@ -1,3 +1,4 @@ debug +allow url http://localhost/* ctextbox