# HG changeset patch # User Adam Chlipala # Date 1260890345 18000 # Node ID 0657e5adc9381bb400f28e56a130c3ef2905aa57 # Parent d89f98f0b4bb89c0cea0678c4376e4c2f1db54a1 Convert to task syntax diff -r d89f98f0b4bb -r 0657e5adc938 CHANGELOG --- a/CHANGELOG Sun Dec 13 14:34:18 2009 -0500 +++ b/CHANGELOG Tue Dec 15 10:19:05 2009 -0500 @@ -6,7 +6,7 @@ - More syntactic sugar for SQL - Typing of SQL queries no longer exposes which tables were used in joins but had none of their fields projected -- Module-level initializers +- Tasks ======== 20091203 diff -r d89f98f0b4bb -r 0657e5adc938 lib/ur/basis.urs --- a/lib/ur/basis.urs Sun Dec 13 14:34:18 2009 -0500 +++ b/lib/ur/basis.urs Tue Dec 15 10:19:05 2009 -0500 @@ -757,3 +757,9 @@ val onServerError : (string -> transaction unit) -> transaction unit val show_xml : ctx ::: {Unit} -> use ::: {Type} -> bind ::: {Type} -> show (xml ctx use bind) + + +(** Tasks *) + +type task_kind +val initialize : task_kind diff -r d89f98f0b4bb -r 0657e5adc938 src/cjr.sml --- a/src/cjr.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/cjr.sml Tue Dec 15 10:19:05 2009 -0500 @@ -100,6 +100,8 @@ withtype exp = exp' located +datatype task = Initialize + datatype decl' = DStruct of int * (string * typ) list | DDatatype of (datatype_kind * string * int * (string * int * typ option) list) list @@ -118,7 +120,7 @@ | DCookie of string | DStyle of string - | DInitializer of exp + | DTask of task * exp withtype decl = decl' located diff -r d89f98f0b4bb -r 0657e5adc938 src/cjr_env.sml --- a/src/cjr_env.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/cjr_env.sml Tue Dec 15 10:19:05 2009 -0500 @@ -171,6 +171,6 @@ | DJavaScript _ => env | DCookie _ => env | DStyle _ => env - | DInitializer _ => env + | DTask _ => env end diff -r d89f98f0b4bb -r 0657e5adc938 src/cjr_print.sml --- a/src/cjr_print.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/cjr_print.sml Tue Dec 15 10:19:05 2009 -0500 @@ -2099,7 +2099,7 @@ space, string "*/"] - | DInitializer _ => box [] + | DTask _ => box [] datatype 'a search = Found of 'a @@ -2733,7 +2733,7 @@ string "}", newline] - val initializers = List.mapPartial (fn (DInitializer e, _) => SOME e | _ => NONE) ds + val initializers = List.mapPartial (fn (DTask (Initialize, e), _) => SOME e | _ => NONE) ds in box [string "#include ", newline, diff -r d89f98f0b4bb -r 0657e5adc938 src/cjrize.sml --- a/src/cjrize.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/cjrize.sml Tue Dec 15 10:19:05 2009 -0500 @@ -660,13 +660,17 @@ | L.DJavaScript s => (SOME (L'.DJavaScript s, loc), NONE, sm) | L.DCookie args => (SOME (L'.DCookie args, loc), NONE, sm) | L.DStyle args => (SOME (L'.DStyle args, loc), NONE, sm) - | L.DInitializer e => - (case #1 e of + | L.DTask (e1, e2) => + (case #1 e2 of L.EAbs (_, _, _, e) => let + val tk = case #1 e1 of + L.EFfi ("Basis", "initialize") => L'.Initialize + | _ => (ErrorMsg.errorAt loc "Task kind not fully determined"; + L'.Initialize) val (e, sm) = cifyExp (e, sm) in - (SOME (L'.DInitializer e, loc), NONE, sm) + (SOME (L'.DTask (tk, e), loc), NONE, sm) end | _ => (ErrorMsg.errorAt loc "Initializer has not been fully determined"; (NONE, NONE, sm))) diff -r d89f98f0b4bb -r 0657e5adc938 src/core.sml --- a/src/core.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/core.sml Tue Dec 15 10:19:05 2009 -0500 @@ -134,7 +134,7 @@ | DDatabase of string | DCookie of string * int * con * string | DStyle of string * int * string - | DInitializer of exp + | DTask of exp * exp withtype decl = decl' located diff -r d89f98f0b4bb -r 0657e5adc938 src/core_env.sml --- a/src/core_env.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/core_env.sml Tue Dec 15 10:19:05 2009 -0500 @@ -348,7 +348,7 @@ in pushENamed env x n t NONE s end - | DInitializer _ => env + | DTask _ => env fun patBinds env (p, loc) = case p of diff -r d89f98f0b4bb -r 0657e5adc938 src/core_print.sml --- a/src/core_print.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/core_print.sml Tue Dec 15 10:19:05 2009 -0500 @@ -611,9 +611,13 @@ string "as", space, string s] - | DInitializer e => box [string "initializer", + | DTask (e1, e2) => box [string "task", space, - p_exp env e] + p_exp env e1, + space, + string "=", + space, + p_exp env e2] fun p_file env file = let diff -r d89f98f0b4bb -r 0657e5adc938 src/core_util.sml --- a/src/core_util.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/core_util.sml Tue Dec 15 10:19:05 2009 -0500 @@ -971,10 +971,12 @@ fn c' => (DCookie (x, n, c', s), loc)) | DStyle _ => S.return2 dAll - | DInitializer e => - S.map2 (mfe ctx e, - fn e' => - (DInitializer e', loc)) + | DTask (e1, e2) => + S.bind2 (mfe ctx e1, + fn e1' => + S.map2 (mfe ctx e2, + fn e2' => + (DTask (e1', e2'), loc))) and mfvi ctx (x, n, t, e, s) = S.bind2 (mfc ctx t, @@ -1129,7 +1131,7 @@ in bind (ctx, NamedE (x, n, t, NONE, s)) end - | DInitializer _ => ctx + | DTask _ => ctx in S.map2 (mff ctx' ds', fn ds' => @@ -1193,7 +1195,7 @@ | DDatabase _ => count | DCookie (_, n, _, _) => Int.max (n, count) | DStyle (_, n, _) => Int.max (n, count) - | DInitializer _ => count) 0 + | DTask _ => count) 0 end diff -r d89f98f0b4bb -r 0657e5adc938 src/corify.sml --- a/src/corify.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/corify.sml Tue Dec 15 10:19:05 2009 -0500 @@ -1064,8 +1064,8 @@ ([(L'.DStyle (x, n, s), loc)], st) end - | L.DInitializer e => - ([(L'.DInitializer (corifyExp st e), loc)], st) + | L.DTask (e1, e2) => + ([(L'.DTask (corifyExp st e1, corifyExp st e2), loc)], st) and corifyStr mods ((str, _), st) = case str of @@ -1124,7 +1124,7 @@ | L.DDatabase _ => n | L.DCookie (_, _, n', _) => Int.max (n, n') | L.DStyle (_, _, n') => Int.max (n, n') - | L.DInitializer _ => n) + | L.DTask _ => n) 0 ds and maxNameStr (str, _) = diff -r d89f98f0b4bb -r 0657e5adc938 src/elab.sml --- a/src/elab.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/elab.sml Tue Dec 15 10:19:05 2009 -0500 @@ -170,7 +170,7 @@ | DDatabase of string | DCookie of int * string * int * con | DStyle of int * string * int - | DInitializer of exp + | DTask of exp * exp and str' = StrConst of decl list diff -r d89f98f0b4bb -r 0657e5adc938 src/elab_env.sml --- a/src/elab_env.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/elab_env.sml Tue Dec 15 10:19:05 2009 -0500 @@ -1622,6 +1622,6 @@ in pushENamedAs env x n t end - | DInitializer _ => env + | DTask _ => env end diff -r d89f98f0b4bb -r 0657e5adc938 src/elab_print.sml --- a/src/elab_print.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/elab_print.sml Tue Dec 15 10:19:05 2009 -0500 @@ -799,9 +799,13 @@ | DStyle (_, x, n) => box [string "style", space, p_named x n] - | DInitializer e => box [string "initializer", + | DTask (e1, e2) => box [string "task", space, - p_exp env e] + p_exp env e1, + space, + string "=", + space, + p_exp env e2] and p_str env (str, _) = case str of diff -r d89f98f0b4bb -r 0657e5adc938 src/elab_util.sml --- a/src/elab_util.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/elab_util.sml Tue Dec 15 10:19:05 2009 -0500 @@ -854,7 +854,7 @@ c), loc))) | DStyle (tn, x, n) => bind (ctx, NamedE (x, (CModProj (n, [], "css_class"), loc))) - | DInitializer _ => ctx, + | DTask _ => ctx, mfd ctx d)) ctx ds, fn ds' => (StrConst ds', loc)) | StrVar _ => S.return2 strAll @@ -979,10 +979,12 @@ fn c' => (DCookie (tn, x, n, c'), loc)) | DStyle _ => S.return2 dAll - | DInitializer e => - S.map2 (mfe ctx e, - fn e' => - (DInitializer e', loc)) + | DTask (e1, e2) => + S.bind2 (mfe ctx e1, + fn e1' => + S.map2 (mfe ctx e2, + fn e2' => + (DTask (e1', e2'), loc))) and mfvi ctx (x, n, c, e) = S.bind2 (mfc ctx c, @@ -1125,7 +1127,7 @@ | DDatabase _ => 0 | DCookie (n1, _, n2, _) => Int.max (n1, n2) | DStyle (n1, _, n2) => Int.max (n1, n2) - | DInitializer _ => 0 + | DTask _ => 0 and maxNameStr (str, _) = case str of StrConst ds => maxName ds diff -r d89f98f0b4bb -r 0657e5adc938 src/elaborate.sml --- a/src/elaborate.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/elaborate.sml Tue Dec 15 10:19:05 2009 -0500 @@ -2548,7 +2548,7 @@ | L'.DDatabase _ => [] | L'.DCookie (tn, x, n, c) => [(L'.SgiVal (x, n, (L'.CApp (cookieOf (), c), loc)), loc)] | L'.DStyle (tn, x, n) => [(L'.SgiVal (x, n, styleOf ()), loc)] - | L'.DInitializer _ => [] + | L'.DTask _ => [] and subSgn' counterparts env strLoc sgn1 (sgn2 as (_, loc2)) = ((*prefaces "subSgn" [("sgn1", p_sgn env sgn1), @@ -3669,14 +3669,18 @@ in ([(L'.DStyle (!basis_r, x, n), loc)], (env, denv, gs)) end - | L.DInitializer e => + | L.DTask (e1, e2) => let - val (e', t, gs') = elabExp (env, denv) e - val t' = (L'.CApp ((L'.CModProj (!basis_r, [], "transaction"), loc), - (L'.TRecord (L'.CRecord ((L'.KType, loc), []), loc), loc)), loc) + val (e1', t1, gs1) = elabExp (env, denv) e1 + val (e2', t2, gs2) = elabExp (env, denv) e2 + + val t1' = (L'.CModProj (!basis_r, [], "task_kind"), loc) + val t2' = (L'.CApp ((L'.CModProj (!basis_r, [], "transaction"), loc), + (L'.TRecord (L'.CRecord ((L'.KType, loc), []), loc), loc)), loc) in - checkCon env e' t t'; - ([(L'.DInitializer e', loc)], (env, denv, gs' @ gs)) + checkCon env e1' t1 t1'; + checkCon env e2' t2 t2'; + ([(L'.DTask (e1', e2'), loc)], (env, denv, gs2 @ gs1 @ gs)) end (*val tcs = List.filter (fn TypeClass _ => true | _ => false) (#3 (#2 r))*) diff -r d89f98f0b4bb -r 0657e5adc938 src/elisp/urweb-defs.el --- a/src/elisp/urweb-defs.el Sun Dec 13 14:34:18 2009 -0500 +++ b/src/elisp/urweb-defs.el Tue Dec 15 10:19:05 2009 -0500 @@ -108,7 +108,7 @@ "datatype" "type" "open" "include" urweb-module-head-syms "con" "map" "where" "extern" "constraint" "constraints" - "table" "sequence" "class" "cookie" "initializer") + "table" "sequence" "class" "cookie" "task") "Symbols starting an sexp.") ;; (defconst urweb-not-arg-start-re @@ -135,7 +135,7 @@ (("case" "datatype" "if" "then" "else" "let" "open" "sig" "struct" "type" "val" "con" "constraint" "table" "sequence" "class" "cookie" - "initializer"))))) + "task"))))) (defconst urweb-starters-indent-after (urweb-syms-re "let" "in" "struct" "sig") @@ -190,7 +190,7 @@ '("datatype" "fun" "open" "type" "val" "and" "con" "constraint" "table" "sequence" "class" "cookie" - "initializer")) + "task")) "The starters of new expressions.") (defconst urweb-exptrail-syms diff -r d89f98f0b4bb -r 0657e5adc938 src/elisp/urweb-mode.el --- a/src/elisp/urweb-mode.el Sun Dec 13 14:34:18 2009 -0500 +++ b/src/elisp/urweb-mode.el Tue Dec 15 10:19:05 2009 -0500 @@ -136,7 +136,7 @@ "datatype" "else" "end" "extern" "fn" "map" "fun" "functor" "if" "include" "of" "open" "let" "in" - "rec" "sequence" "sig" "signature" "cookie" "style" "initializer" + "rec" "sequence" "sig" "signature" "cookie" "style" "task" "struct" "structure" "table" "view" "then" "type" "val" "where" "with" @@ -226,7 +226,7 @@ ("\\<\\(\\(data\\)?type\\|con\\|class\\)\\s-+\\(\\sw+\\)" (1 font-lock-keyword-face) (3 (amAttribute font-lock-type-def-face))) - ("\\<\\(val\\|table\\|sequence\\|cookie\\|style\\|initializer\\)\\s-+\\(\\sw+\\>\\s-*\\)?\\(\\sw+\\)\\s-*[=:]" + ("\\<\\(val\\|table\\|sequence\\|cookie\\|style\\|task\\)\\s-+\\(\\sw+\\>\\s-*\\)?\\(\\sw+\\)\\s-*[=:]" (1 font-lock-keyword-face) (3 (amAttribute font-lock-variable-name-face))) ("\\<\\(structure\\|functor\\)\\s-+\\(\\sw+\\)" diff -r d89f98f0b4bb -r 0657e5adc938 src/expl.sml --- a/src/expl.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/expl.sml Tue Dec 15 10:19:05 2009 -0500 @@ -147,7 +147,7 @@ | DDatabase of string | DCookie of int * string * int * con | DStyle of int * string * int - | DInitializer of exp + | DTask of exp * exp and str' = StrConst of decl list diff -r d89f98f0b4bb -r 0657e5adc938 src/expl_env.sml --- a/src/expl_env.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/expl_env.sml Tue Dec 15 10:19:05 2009 -0500 @@ -343,7 +343,7 @@ in pushENamed env x n t end - | DInitializer _ => env + | DTask _ => env fun sgiBinds env (sgi, loc) = case sgi of diff -r d89f98f0b4bb -r 0657e5adc938 src/expl_print.sml --- a/src/expl_print.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/expl_print.sml Tue Dec 15 10:19:05 2009 -0500 @@ -713,9 +713,13 @@ | DStyle (_, x, n) => box [string "style", space, p_named x n] - | DInitializer e => box [string "initializer", + | DTask (e1, e2) => box [string "task", space, - p_exp env e] + p_exp env e1, + space, + string "=", + space, + p_exp env e2] and p_str env (str, _) = case str of diff -r d89f98f0b4bb -r 0657e5adc938 src/explify.sml --- a/src/explify.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/explify.sml Tue Dec 15 10:19:05 2009 -0500 @@ -195,7 +195,7 @@ | L.DDatabase s => SOME (L'.DDatabase s, loc) | L.DCookie (nt, x, n, c) => SOME (L'.DCookie (nt, x, n, explifyCon c), loc) | L.DStyle (nt, x, n) => SOME (L'.DStyle (nt, x, n), loc) - | L.DInitializer e => SOME (L'.DInitializer (explifyExp e), loc) + | L.DTask (e1, e2) => SOME (L'.DTask (explifyExp e1, explifyExp e2), loc) and explifyStr (str, loc) = case str of diff -r d89f98f0b4bb -r 0657e5adc938 src/mono.sml --- a/src/mono.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/mono.sml Tue Dec 15 10:19:05 2009 -0500 @@ -139,7 +139,7 @@ | DCookie of string | DStyle of string - | DInitializer of exp + | DTask of exp * exp withtype decl = decl' located diff -r d89f98f0b4bb -r 0657e5adc938 src/mono_env.sml --- a/src/mono_env.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/mono_env.sml Tue Dec 15 10:19:05 2009 -0500 @@ -129,7 +129,7 @@ | DJavaScript _ => env | DCookie _ => env | DStyle _ => env - | DInitializer _ => env + | DTask _ => env fun patBinds env (p, loc) = case p of diff -r d89f98f0b4bb -r 0657e5adc938 src/mono_print.sml --- a/src/mono_print.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/mono_print.sml Tue Dec 15 10:19:05 2009 -0500 @@ -491,9 +491,13 @@ | DStyle s => box [string "style", space, string s] - | DInitializer e => box [string "initializer", + | DTask (e1, e2) => box [string "task", space, - p_exp env e] + p_exp env e1, + space, + string "=", + space, + p_exp env e2] fun p_file env file = diff -r d89f98f0b4bb -r 0657e5adc938 src/mono_shake.sml --- a/src/mono_shake.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/mono_shake.sml Tue Dec 15 10:19:05 2009 -0500 @@ -57,7 +57,7 @@ (fn ((DExport (_, _, n, _, _), _), (page_cs, page_es)) => (page_cs, IS.add (page_es, n)) | ((DDatabase {expunge = n1, initialize = n2, ...}, _), (page_cs, page_es)) => (page_cs, IS.addList (page_es, [n1, n2])) - | ((DInitializer e, _), st) => usedVars st e + | ((DTask (e1, e2), _), st) => usedVars (usedVars st e2) e1 | (_, st) => st) (IS.empty, IS.empty) file val (cdef, edef) = foldl (fn ((DDatatype dts, _), (cdef, edef)) => @@ -74,7 +74,7 @@ | ((DJavaScript _, _), acc) => acc | ((DCookie _, _), acc) => acc | ((DStyle _, _), acc) => acc - | ((DInitializer _, _), acc) => acc) + | ((DTask _, _), acc) => acc) (IM.empty, IM.empty) file fun typ (c, s) = @@ -141,7 +141,7 @@ | (DJavaScript _, _) => true | (DCookie _, _) => true | (DStyle _, _) => true - | (DInitializer _, _) => true) file + | (DTask _, _) => true) file end end diff -r d89f98f0b4bb -r 0657e5adc938 src/mono_util.sml --- a/src/mono_util.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/mono_util.sml Tue Dec 15 10:19:05 2009 -0500 @@ -528,10 +528,12 @@ | DJavaScript _ => S.return2 dAll | DCookie _ => S.return2 dAll | DStyle _ => S.return2 dAll - | DInitializer e => - S.map2 (mfe ctx e, - fn e' => - (DInitializer e', loc)) + | DTask (e1, e2) => + S.bind2 (mfe ctx e1, + fn e1' => + S.map2 (mfe ctx e2, + fn e2' => + (DTask (e1', e2'), loc))) and mfvi ctx (x, n, t, e, s) = S.bind2 (mft t, @@ -618,7 +620,7 @@ | DJavaScript _ => ctx | DCookie _ => ctx | DStyle _ => ctx - | DInitializer _ => ctx + | DTask _ => ctx in S.map2 (mff ctx' ds', fn ds' => @@ -672,7 +674,7 @@ | DJavaScript _ => count | DCookie _ => count | DStyle _ => count - | DInitializer _ => count) 0 + | DTask _ => count) 0 end diff -r d89f98f0b4bb -r 0657e5adc938 src/monoize.sml --- a/src/monoize.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/monoize.sml Tue Dec 15 10:19:05 2009 -0500 @@ -3478,13 +3478,14 @@ [(L'.DStyle s, loc), (L'.DVal (x, n, t', e, s), loc)]) end - | L.DInitializer e => + | L.DTask (e1, e2) => let - val (e, fm) = monoExp (env, St.empty, fm) e + val (e1, fm) = monoExp (env, St.empty, fm) e1 + val (e2, fm) = monoExp (env, St.empty, fm) e2 in SOME (env, fm, - [(L'.DInitializer e, loc)]) + [(L'.DTask (e1, e2), loc)]) end end diff -r d89f98f0b4bb -r 0657e5adc938 src/prepare.sml --- a/src/prepare.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/prepare.sml Tue Dec 15 10:19:05 2009 -0500 @@ -325,11 +325,11 @@ | DJavaScript _ => (d, st) | DCookie _ => (d, st) | DStyle _ => (d, st) - | DInitializer e => + | DTask (tk, e) => let val (e, st) = prepExp (e, st) in - ((DInitializer e, loc), st) + ((DTask (tk, e), loc), st) end fun prepare (ds, ps) = diff -r d89f98f0b4bb -r 0657e5adc938 src/reduce.sml --- a/src/reduce.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/reduce.sml Tue Dec 15 10:19:05 2009 -0500 @@ -804,11 +804,12 @@ | DDatabase _ => (d, st) | DCookie (s, n, c, s') => ((DCookie (s, n, con namedC [] c, s'), loc), st) | DStyle (s, n, s') => ((DStyle (s, n, s'), loc), st) - | DInitializer e => + | DTask (e1, e2) => let - val e = exp (namedC, namedE) [] e + val e1 = exp (namedC, namedE) [] e1 + val e2 = exp (namedC, namedE) [] e2 in - ((DInitializer e, loc), + ((DTask (e1, e2), loc), (polyC, namedC, namedE)) diff -r d89f98f0b4bb -r 0657e5adc938 src/reduce_local.sml --- a/src/reduce_local.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/reduce_local.sml Tue Dec 15 10:19:05 2009 -0500 @@ -251,7 +251,7 @@ | DDatabase _ => d | DCookie _ => d | DStyle _ => d - | DInitializer e => (DInitializer (exp [] e), loc) + | DTask (e1, e2) => (DTask (exp [] e1, exp [] e2), loc) in map doDecl file end diff -r d89f98f0b4bb -r 0657e5adc938 src/shake.sml --- a/src/shake.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/shake.sml Tue Dec 15 10:19:05 2009 -0500 @@ -79,7 +79,7 @@ in (usedE, usedC) end - | ((DInitializer e, _), st) => usedVars st e + | ((DTask (e1, e2), _), st) => usedVars (usedVars st e1) e2 | (_, acc) => acc) (IS.empty, IS.empty) file val (cdef, edef) = foldl (fn ((DCon (_, n, _, c), _), (cdef, edef)) => (IM.insert (cdef, n, [c]), edef) @@ -106,7 +106,7 @@ (cdef, IM.insert (edef, n, ([], c, dummye))) | ((DStyle (_, n, _), _), (cdef, edef)) => (cdef, IM.insert (edef, n, ([], dummyt, dummye))) - | ((DInitializer _, _), acc) => acc) + | ((DTask _, _), acc) => acc) (IM.empty, IM.empty) file fun kind (_, s) = s @@ -186,7 +186,7 @@ | (DDatabase _, _) => true | (DCookie _, _) => true | (DStyle _, _) => true - | (DInitializer _, _) => true) file + | (DTask _, _) => true) file end end diff -r d89f98f0b4bb -r 0657e5adc938 src/source.sml --- a/src/source.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/source.sml Tue Dec 15 10:19:05 2009 -0500 @@ -167,7 +167,7 @@ | DDatabase of string | DCookie of string * con | DStyle of string - | DInitializer of exp + | DTask of exp * exp and str' = StrConst of decl list diff -r d89f98f0b4bb -r 0657e5adc938 src/source_print.sml --- a/src/source_print.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/source_print.sml Tue Dec 15 10:19:05 2009 -0500 @@ -662,9 +662,13 @@ | DStyle x => box [string "style", space, string x] - | DInitializer e => box [string "initializer", + | DTask (e1, e2) => box [string "task", space, - p_exp e] + p_exp e1, + space, + string "=", + space, + p_exp e2] and p_str (str, _) = case str of diff -r d89f98f0b4bb -r 0657e5adc938 src/unnest.sml --- a/src/unnest.sml Sun Dec 13 14:34:18 2009 -0500 +++ b/src/unnest.sml Tue Dec 15 10:19:05 2009 -0500 @@ -422,7 +422,7 @@ | DDatabase _ => default () | DCookie _ => default () | DStyle _ => default () - | DInitializer _ => explore () + | DTask _ => explore () end and doStr (all as (str, loc), st) = diff -r d89f98f0b4bb -r 0657e5adc938 src/urweb.grm --- a/src/urweb.grm Sun Dec 13 14:34:18 2009 -0500 +++ b/src/urweb.grm Tue Dec 15 10:19:05 2009 -0500 @@ -201,7 +201,7 @@ | LET | IN | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR | WHERE | EXTERN | SQL | SELECT1 | INCLUDE | OPEN | CONSTRAINT | CONSTRAINTS | EXPORT | TABLE | SEQUENCE | VIEW - | COOKIE | STYLE | INITIALIZER + | COOKIE | STYLE | TASK | CASE | IF | THEN | ELSE | ANDALSO | ORELSE | XML_BEGIN of string | XML_END | XML_BEGIN_END of string @@ -479,7 +479,7 @@ end) | COOKIE SYMBOL COLON cexp ([(DCookie (SYMBOL, cexp), s (COOKIEleft, cexpright))]) | STYLE SYMBOL ([(DStyle SYMBOL, s (STYLEleft, SYMBOLright))]) - | INITIALIZER eexp ([(DInitializer eexp, s (INITIALIZERleft, eexpright))]) + | TASK eapps EQ eexp ([(DTask (eapps, eexp), s (TASKleft, eexpright))]) dtype : SYMBOL dargs EQ barOpt dcons (SYMBOL, dargs, dcons) diff -r d89f98f0b4bb -r 0657e5adc938 src/urweb.lex --- a/src/urweb.lex Sun Dec 13 14:34:18 2009 -0500 +++ b/src/urweb.lex Tue Dec 15 10:19:05 2009 -0500 @@ -402,7 +402,7 @@ "class" => (Tokens.CLASS (pos yypos, pos yypos + size yytext)); "cookie" => (Tokens.COOKIE (pos yypos, pos yypos + size yytext)); "style" => (Tokens.STYLE (pos yypos, pos yypos + size yytext)); - "initializer" => (Tokens.INITIALIZER (pos yypos, pos yypos + size yytext)); + "task" => (Tokens.TASK (pos yypos, pos yypos + size yytext)); "Type" => (Tokens.TYPE (pos yypos, pos yypos + size yytext)); "Name" => (Tokens.NAME (pos yypos, pos yypos + size yytext)); diff -r d89f98f0b4bb -r 0657e5adc938 tests/init.ur --- a/tests/init.ur Sun Dec 13 14:34:18 2009 -0500 +++ b/tests/init.ur Tue Dec 15 10:19:05 2009 -0500 @@ -1,6 +1,6 @@ sequence seq table fred : {A : int, B : int} -initializer +task initialize = setval seq 1; dml (INSERT INTO fred (A, B) VALUES (0, 1))