summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2010-02-28 15:46:41 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2010-02-28 15:46:41 -0500
commit5bfa75dbe0910dd19a8e0f40e2d03e33a4c44eb8 (patch)
tree4aeca801868850579ec9ac59cefcf4a5ed6bf25f /src
parent704a9de8fe5e35ba24185048cf990456141a8bc0 (diff)
Fix parsing of space-free .urp directives; use 'class' for 'c*' tags
Diffstat (limited to 'src')
-rw-r--r--src/compiler.sml3
-rw-r--r--src/monoize.sml18
2 files changed, 19 insertions, 2 deletions
diff --git a/src/compiler.sml b/src/compiler.sml
index f0313c8b..63b28fb7 100644
--- a/src/compiler.sml
+++ b/src/compiler.sml
@@ -292,7 +292,8 @@ fun parseUrp' accLibs fname =
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 --git a/src/monoize.sml b/src/monoize.sml
index 0e122c29..a5dc3929 100644
--- a/src/monoize.sml
+++ b/src/monoize.sml
@@ -2787,12 +2787,28 @@ fun monoExp (env, st, fm) (all as (e, loc)) =
(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