Mercurial > urweb
comparison src/monoize.sml @ 679:44f23712020d
Chat example working nicely, but without dead channel removal
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 26 Mar 2009 18:26:50 -0400 |
parents | 5ff1ff38e2db |
children | 5bbb542243e8 |
comparison
equal
deleted
inserted
replaced
678:5ff1ff38e2db | 679:44f23712020d |
---|---|
1869 fun findOnload (attrs, acc) = | 1869 fun findOnload (attrs, acc) = |
1870 case attrs of | 1870 case attrs of |
1871 [] => (NONE, acc) | 1871 [] => (NONE, acc) |
1872 | ("Onload", e, _) :: rest => (SOME e, List.revAppend (acc, rest)) | 1872 | ("Onload", e, _) :: rest => (SOME e, List.revAppend (acc, rest)) |
1873 | x :: rest => findOnload (rest, x :: acc) | 1873 | x :: rest => findOnload (rest, x :: acc) |
1874 | 1874 |
1875 val (onload, attrs) = findOnload (attrs, []) | 1875 val (onload, attrs) = findOnload (attrs, []) |
1876 | 1876 |
1877 fun lowercaseFirst "" = "" | 1877 fun lowercaseFirst "" = "" |
1878 | lowercaseFirst s = String.str (Char.toLower (String.sub (s, 0))) | 1878 | lowercaseFirst s = String.str (Char.toLower (String.sub (s, 0))) |
1879 ^ String.extract (s, 1, NONE) | 1879 ^ String.extract (s, 1, NONE) |
1970 | 1970 |
1971 fun normal () = | 1971 fun normal () = |
1972 let | 1972 let |
1973 val (xml, fm) = monoExp (env, st, fm) xml | 1973 val (xml, fm) = monoExp (env, st, fm) xml |
1974 val xml = case extraInner of | 1974 val xml = case extraInner of |
1975 NONE => xml | 1975 NONE => xml |
1976 | SOME ei => (L'.EStrcat (ei, xml), loc) | 1976 | SOME ei => (L'.EStrcat (ei, xml), loc) |
1977 in | 1977 in |
1978 ((L'.EStrcat ((L'.EStrcat (tagStart, (L'.EPrim (Prim.String ">"), loc)), loc), | 1978 ((L'.EStrcat ((L'.EStrcat (tagStart, (L'.EPrim (Prim.String ">"), loc)), loc), |
1979 (L'.EStrcat (xml, | 1979 (L'.EStrcat (xml, |
1980 (L'.EPrim (Prim.String (String.concat ["</", tag, ">"])), | 1980 (L'.EPrim (Prim.String (String.concat ["</", tag, ">"])), |
1981 loc)), loc)), | 1981 loc)), loc)), |
2015 :: str ";" | 2015 :: str ";" |
2016 :: assgns) | 2016 :: assgns) |
2017 end | 2017 end |
2018 in | 2018 in |
2019 case tag of | 2019 case tag of |
2020 "body" => | 2020 "body" => let |
2021 let | |
2022 val onload = case onload of | 2021 val onload = case onload of |
2023 NONE => (L'.EPrim (Prim.String ""), loc) | 2022 NONE => (L'.EPrim (Prim.String ""), loc) |
2024 | SOME e => | 2023 | SOME e => |
2025 let | 2024 let |
2026 val e = (L'.EApp (e, (L'.ERecord [], loc)), loc) | 2025 val e = (L'.EApp (e, (L'.ERecord [], loc)), loc) |
2027 in | 2026 in |
2028 (L'.EJavaScript (L'.Attribute, e, NONE), loc) | 2027 (L'.EJavaScript (L'.Attribute, e, NONE), loc) |
2029 end | 2028 end |
2030 in | 2029 in |
2031 normal ("body", | 2030 normal ("body", |
2032 SOME (L'.EFfiApp ("Basis", "get_listener", [onload]), loc), | 2031 SOME (L'.EFfiApp ("Basis", "get_settings", [onload]), loc), |
2033 SOME (L'.EFfiApp ("Basis", "get_script", [(L'.ERecord [], loc)]), loc)) | 2032 SOME (L'.EFfiApp ("Basis", "get_script", [(L'.ERecord [], loc)]), loc)) |
2034 end | 2033 end |
2035 | 2034 |
2036 | "dyn" => | 2035 | "dyn" => |
2037 (case attrs of | 2036 (case attrs of |