summaryrefslogtreecommitdiff
path: root/src/lacweb.grm
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-03 17:02:42 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-03 17:02:42 -0400
commit411808e8dced75f376c7a95bb79d989cde704fd9 (patch)
tree99774d5b0191f26a1d7f9ae73b91bcc6123aa0c9 /src/lacweb.grm
parenta4a7692d226262376d2cea2480033227f885cd7e (diff)
XML tags with contents
Diffstat (limited to 'src/lacweb.grm')
-rw-r--r--src/lacweb.grm30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/lacweb.grm b/src/lacweb.grm
index 115c528a..2fcc8d89 100644
--- a/src/lacweb.grm
+++ b/src/lacweb.grm
@@ -298,9 +298,27 @@ xml : xmlOne xml (let
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)
+