summaryrefslogtreecommitdiff
path: root/src/lacweb.grm
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-07-03 16:26:28 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-07-03 16:26:28 -0400
commita4a7692d226262376d2cea2480033227f885cd7e (patch)
treeb3ffa7341fa823b37569845c5890dd24700fae69 /src/lacweb.grm
parentb2eb9f45b9b14e5c7f53d0ad7ca8e84aa7858b59 (diff)
Basic XML stuff
Diffstat (limited to 'src/lacweb.grm')
-rw-r--r--src/lacweb.grm33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/lacweb.grm b/src/lacweb.grm
index 95e13c50..115c528a 100644
--- a/src/lacweb.grm
+++ b/src/lacweb.grm
@@ -40,6 +40,7 @@ val s = ErrorMsg.spanOf
| SYMBOL of string | CSYMBOL of string
| LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE
| EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER
+ | DIVIDE | GT
| CON | LTYPE | VAL | FOLD | UNIT | KUNIT
| TYPE | NAME
| ARROW | LARROW | DARROW
@@ -47,6 +48,10 @@ val s = ErrorMsg.spanOf
| STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR | WHERE | EXTERN
| INCLUDE | OPEN | CONSTRAINT | CONSTRAINTS
+ | XML_BEGIN of string | XML_END
+ | NOTAGS of string
+ | BEGIN_TAG of string | END_TAG of string
+
%nonterm
file of decl list
| decls of decl list
@@ -78,6 +83,8 @@ val s = ErrorMsg.spanOf
| eapps of exp
| eterm of exp
| rexp of (con * exp) list
+ | xml of exp
+ | xmlOne of exp
%verbose (* print summary of errors *)
%pos int (* positions *)
@@ -268,6 +275,32 @@ eterm : LPAREN eexp RPAREN (#1 eexp, s (LPARENleft, RPARENright))
| FOLD (EFold, s (FOLDleft, FOLDright))
+ | XML_BEGIN xml XML_END (xml)
+ | XML_BEGIN XML_END (EApp ((EVar (["Basis"], "cdata"), s (XML_BEGINleft, XML_ENDright)),
+ (EPrim (Prim.String ""), s (XML_BEGINleft, XML_ENDright))),
+ s (XML_BEGINleft, XML_ENDright))
+
rexp : ([])
| ident EQ eexp ([(ident, eexp)])
| ident EQ eexp COMMA rexp ((ident, eexp) :: rexp)
+
+xml : xmlOne xml (let
+ val pos = s (xmlOneleft, xmlright)
+ in
+ (EApp ((EApp (
+ (ECApp ((EVar (["Basis"], "join"), pos),
+ (CWild (KRecord (KUnit, pos), pos), pos)), pos),
+ xmlOne), pos),
+ xml), pos)
+ end)
+ | xmlOne (xmlOne)
+
+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))