Mercurial > urweb
diff src/lacweb.grm @ 92:1a4c51fa615c
XML tags with contents
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 03 Jul 2008 17:02:42 -0400 |
parents | 4327abd52997 |
children | 94afff1ff7f6 |
line wrap: on
line diff
--- a/src/lacweb.grm Thu Jul 03 16:26:28 2008 -0400 +++ b/src/lacweb.grm Thu Jul 03 17:02:42 2008 -0400 @@ -298,9 +298,27 @@ xmlOne : NOTAGS (EApp ((EVar (["Basis"], "cdata"), s (NOTAGSleft, NOTAGSright)), (EPrim (Prim.String NOTAGS), s (NOTAGSleft, NOTAGSright))), s (NOTAGSleft, NOTAGSright)) - | BEGIN_TAG DIVIDE GT (EApp ((EApp ((EVar (["Basis"], "tag"), s (BEGIN_TAGleft, GTright)), - (EVar ([], BEGIN_TAG), s (BEGIN_TAGleft, GTright))), - s (BEGIN_TAGleft, GTright)), - (EApp ((EVar (["Basis"], "cdata"), s (BEGIN_TAGleft, GTright)), - (EPrim (Prim.String ""), s (BEGIN_TAGleft, GTright))), - s (BEGIN_TAGleft, GTright))), s (BEGIN_TAGleft, GTright)) + | BEGIN_TAG DIVIDE GT (let + val pos = s (BEGIN_TAGleft, GTright) + in + (EApp ((EApp ((EVar (["Basis"], "tag"), pos), + (EVar ([], BEGIN_TAG), pos)), + pos), + (EApp ((EVar (["Basis"], "cdata"), pos), + (EPrim (Prim.String ""), pos)), + pos)), pos) + end) + + | BEGIN_TAG GT xml END_TAG (let + val pos = s (BEGIN_TAGleft, GTright) + in + if BEGIN_TAG = END_TAG then + (EApp ((EApp ((EVar (["Basis"], "tag"), pos), + (EVar ([], BEGIN_TAG), pos)), + pos), + xml), pos) + else + (ErrorMsg.errorAt pos "Begin and end tags don't match."; + (EFold, pos)) + end) +