Mercurial > urweb
comparison src/urweb.grm @ 1749:f9e5a8e09cdf
Simplify type of Basis.tag, regarding 'class' attribute; new compatibility parsing of 'class' values given as string literals
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 06 May 2012 13:07:13 -0400 |
parents | 4a03aa3251cb |
children | 277480862cef |
comparison
equal
deleted
inserted
replaced
1748:95dd9f427bb2 | 1749:f9e5a8e09cdf |
---|---|
244 end | 244 end |
245 | ECApp (e, _) => tnamesOf e | 245 | ECApp (e, _) => tnamesOf e |
246 | EDisjointApp e => tnamesOf e | 246 | EDisjointApp e => tnamesOf e |
247 | _ => [] | 247 | _ => [] |
248 | 248 |
249 fun classOut (s, pos) = (EVar ([], String.translate (fn #"-" => "_" | ch => str ch) s, Infer), pos) | |
250 | |
251 fun parseClass s pos = | |
252 case String.tokens Char.isSpace s of | |
253 [] => (EVar (["Basis"], "null", Infer), pos) | |
254 | class :: classes => | |
255 foldl (fn (s, e) => (EApp ((EApp ((EVar (["Basis"], "classes", Infer), pos), e), pos), classOut (s, pos)), pos)) | |
256 (classOut (class, pos)) classes | |
257 | |
249 %% | 258 %% |
250 %header (functor UrwebLrValsFn(structure Token : TOKEN)) | 259 %header (functor UrwebLrValsFn(structure Token : TOKEN)) |
251 | 260 |
252 %term | 261 %term |
253 EOF | 262 EOF |
1519 tag : tagHead attrs (let | 1528 tag : tagHead attrs (let |
1520 val pos = s (tagHeadleft, attrsright) | 1529 val pos = s (tagHeadleft, attrsright) |
1521 | 1530 |
1522 val e = (EVar (["Basis"], "tag", Infer), pos) | 1531 val e = (EVar (["Basis"], "tag", Infer), pos) |
1523 val eo = case #1 attrs of | 1532 val eo = case #1 attrs of |
1524 NONE => (EVar (["Basis"], "None", Infer), pos) | 1533 NONE => (EVar (["Basis"], "null", Infer), pos) |
1525 | SOME e => (EApp ((EVar (["Basis"], "Some", Infer), pos), | 1534 | SOME (EPrim (Prim.String s), pos) => parseClass s pos |
1526 e), pos) | 1535 | SOME e => e |
1527 val e = (EApp (e, eo), pos) | 1536 val e = (EApp (e, eo), pos) |
1528 val eo = case #2 attrs of | 1537 val eo = case #2 attrs of |
1529 NONE => (EVar (["Basis"], "None", Infer), pos) | 1538 NONE => (EVar (["Basis"], "None", Infer), pos) |
1530 | SOME e => (EApp ((EVar (["Basis"], "Some", Infer), pos), | 1539 | SOME e => (EApp ((EVar (["Basis"], "Some", Infer), pos), |
1531 e), pos) | 1540 e), pos) |