summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-12-31 13:31:00 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2011-12-31 13:31:00 -0500
commit4e78c1304af5a3bddaa5e9e146b41fb87a108c77 (patch)
tree1d03350e696d6cf64b203f8ab465451a9498df32
parentcc06e6bceb5b5f472c86091dedaa374e7bd72067 (diff)
Error messages about applying 'dynClass' to tags that don't like it
-rw-r--r--src/monoize.sml9
-rw-r--r--src/urweb.grm3
2 files changed, 12 insertions, 0 deletions
diff --git a/src/monoize.sml b/src/monoize.sml
index 2b3abb61..2e663bc3 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -3034,6 +3034,15 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
val (class, fm) = monoExp (env, st, fm) class
val (dynClass, fm) = monoExp (env, st, fm) dynClass
+ val dynamics = ["dyn", "ctextbox", "ccheckbox", "cselect", "coption", "ctextarea"]
+
+ val () = case #1 dynClass of
+ L'.ENone _ => ()
+ | _ => if List.exists (fn x => x = tag) dynamics then
+ E.errorAt loc ("Dynamic tag <" ^ tag ^ "> cannot be combined with 'dynClass' attribute; an additional <span> may be useful")
+ else
+ ()
+
fun tagStart tag' =
let
val t = (L'.TFfi ("Basis", "string"), loc)
diff --git a/src/urweb.grm b/src/urweb.grm
index 7ec580f3..1a9eb855 100644
--- a/src/urweb.grm
+++ b/src/urweb.grm
@@ -1462,6 +1462,9 @@ xmlOne : NOTAGS (EApp ((EVar (["Basis"], "cdata", Infer)
NONE => (EVar (["Basis"], "None", Infer), pos)
| SOME c => (EApp ((EVar (["Basis"], "Some", Infer), pos), c), pos)), pos)
in
+ case #3 tag of
+ NONE => ()
+ | SOME _ => ErrorMsg.errorAt pos "<form> does not support 'dynClass' attribute";
(EApp (e, xmlOpt), pos)
end
else if et = "subform" orelse et = "subforms" then