comparison src/elaborate.sml @ 718:f152f215a02c

style declarations
author Adam Chlipala <adamc@hcoop.net>
date Sun, 12 Apr 2009 10:08:11 -0400
parents baaae037e7f6
children 5c099b1308ae
comparison
equal deleted inserted replaced
717:e28637743279 718:f152f215a02c
1900 val hnormSgn = E.hnormSgn 1900 val hnormSgn = E.hnormSgn
1901 1901
1902 fun tableOf () = (L'.CModProj (!basis_r, [], "sql_table"), ErrorMsg.dummySpan) 1902 fun tableOf () = (L'.CModProj (!basis_r, [], "sql_table"), ErrorMsg.dummySpan)
1903 fun sequenceOf () = (L'.CModProj (!basis_r, [], "sql_sequence"), ErrorMsg.dummySpan) 1903 fun sequenceOf () = (L'.CModProj (!basis_r, [], "sql_sequence"), ErrorMsg.dummySpan)
1904 fun cookieOf () = (L'.CModProj (!basis_r, [], "http_cookie"), ErrorMsg.dummySpan) 1904 fun cookieOf () = (L'.CModProj (!basis_r, [], "http_cookie"), ErrorMsg.dummySpan)
1905 fun styleOf () = (L'.CModProj (!basis_r, [], "css_class"), ErrorMsg.dummySpan)
1905 1906
1906 fun dopenConstraints (loc, env, denv) {str, strs} = 1907 fun dopenConstraints (loc, env, denv) {str, strs} =
1907 case E.lookupStr env str of 1908 case E.lookupStr env str of
1908 NONE => (strError env (UnboundStr (loc, str)); 1909 NONE => (strError env (UnboundStr (loc, str));
1909 denv) 1910 denv)
2399 (L'.CConcat (pc, cc), loc)), loc)), loc)] 2400 (L'.CConcat (pc, cc), loc)), loc)), loc)]
2400 | L'.DSequence (tn, x, n) => [(L'.SgiVal (x, n, sequenceOf ()), loc)] 2401 | L'.DSequence (tn, x, n) => [(L'.SgiVal (x, n, sequenceOf ()), loc)]
2401 | L'.DClass (x, n, k, c) => [(L'.SgiClass (x, n, k, c), loc)] 2402 | L'.DClass (x, n, k, c) => [(L'.SgiClass (x, n, k, c), loc)]
2402 | L'.DDatabase _ => [] 2403 | L'.DDatabase _ => []
2403 | L'.DCookie (tn, x, n, c) => [(L'.SgiVal (x, n, (L'.CApp (cookieOf (), c), loc)), loc)] 2404 | L'.DCookie (tn, x, n, c) => [(L'.SgiVal (x, n, (L'.CApp (cookieOf (), c), loc)), loc)]
2405 | L'.DStyle (tn, x, n, c) => [(L'.SgiVal (x, n, (L'.CApp (styleOf (), c), loc)), loc)]
2404 2406
2405 and subSgn env sgn1 (sgn2 as (_, loc2)) = 2407 and subSgn env sgn1 (sgn2 as (_, loc2)) =
2406 ((*prefaces "subSgn" [("sgn1", p_sgn env sgn1), 2408 ((*prefaces "subSgn" [("sgn1", p_sgn env sgn1),
2407 ("sgn2", p_sgn env sgn2)];*) 2409 ("sgn2", p_sgn env sgn2)];*)
2408 case (#1 (hnormSgn env sgn1), #1 (hnormSgn env sgn2)) of 2410 case (#1 (hnormSgn env sgn1), #1 (hnormSgn env sgn2)) of
3387 val (c', k, gs') = elabCon (env, denv) c 3389 val (c', k, gs') = elabCon (env, denv) c
3388 val (env, n) = E.pushENamed env x (L'.CApp (cookieOf (), c'), loc) 3390 val (env, n) = E.pushENamed env x (L'.CApp (cookieOf (), c'), loc)
3389 in 3391 in
3390 checkKind env c' k (L'.KType, loc); 3392 checkKind env c' k (L'.KType, loc);
3391 ([(L'.DCookie (!basis_r, x, n, c'), loc)], (env, denv, enD gs' @ gs)) 3393 ([(L'.DCookie (!basis_r, x, n, c'), loc)], (env, denv, enD gs' @ gs))
3394 end
3395 | L.DStyle (x, c) =>
3396 let
3397 val (c', k, gs') = elabCon (env, denv) c
3398 val (env, n) = E.pushENamed env x (L'.CApp (styleOf (), c'), loc)
3399 in
3400 checkKind env c' k (L'.KRecord (L'.KUnit, loc), loc);
3401 ([(L'.DStyle (!basis_r, x, n, c'), loc)], (env, denv, enD gs' @ gs))
3392 end 3402 end
3393 3403
3394 (*val tcs = List.filter (fn TypeClass _ => true | _ => false) (#3 (#2 r))*) 3404 (*val tcs = List.filter (fn TypeClass _ => true | _ => false) (#3 (#2 r))*)
3395 in 3405 in
3396 (*prefaces "elabDecl" [("e", SourcePrint.p_decl dAll), 3406 (*prefaces "elabDecl" [("e", SourcePrint.p_decl dAll),