summaryrefslogtreecommitdiff
path: root/src/lacweb.grm
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-09 20:08:29 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-09 20:08:29 -0400
commitbb9795918d2f0a1d9141dd86c4884fa9446cb2a9 (patch)
tree538d4d4a08d80201fda8187ec281b39a43669f75 /src/lacweb.grm
parent65edfa17d6df526c57fdb08bf033671c7c6756f6 (diff)
Urlifying records
Diffstat (limited to 'src/lacweb.grm')
-rw-r--r--src/lacweb.grm14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lacweb.grm b/src/lacweb.grm
index a206182b..f1cb5ce3 100644
--- a/src/lacweb.grm
+++ b/src/lacweb.grm
@@ -89,6 +89,7 @@ fun uppercaseFirst "" = ""
| cterm of con
| ctuple of con list
| ident of con
+ | idents of con list
| rcon of (con * con) list
| rconn of (con * con) list
| rcone of (con * con) list
@@ -324,7 +325,7 @@ rcone : ([])
ident : CSYMBOL (CName CSYMBOL, s (CSYMBOLleft, CSYMBOLright))
| INT (CName (Int64.toString INT), s (INTleft, INTright))
- | path (CVar path, s (pathleft, pathright))
+ | SYMBOL (CVar ([], SYMBOL), s (SYMBOLleft, SYMBOLright))
eapps : eterm (eterm)
| eapps eterm (EApp (eapps, eterm), s (eappsleft, etermright))
@@ -369,7 +370,13 @@ eterm : LPAREN eexp RPAREN (#1 eexp, s (LPARENleft, RPARENright))
| FLOAT (EPrim (Prim.Float FLOAT), s (FLOATleft, FLOATright))
| STRING (EPrim (Prim.String STRING), s (STRINGleft, STRINGright))
- | path DOT ident (EField ((EVar path, s (pathleft, pathright)), ident), s (pathleft, identright))
+ | path DOT idents (let
+ val loc = s (pathleft, identsright)
+ in
+ foldl (fn (ident, e) =>
+ (EField (e, ident), loc))
+ (EVar path, s (pathleft, pathright)) idents
+ end)
| FOLD (EFold, s (FOLDleft, FOLDright))
| XML_BEGIN xml XML_END (xml)
@@ -377,6 +384,9 @@ eterm : LPAREN eexp RPAREN (#1 eexp, s (LPARENleft, RPARENright))
(EPrim (Prim.String ""), s (XML_BEGINleft, XML_ENDright))),
s (XML_BEGINleft, XML_ENDright))
+idents : ident ([ident])
+ | ident DOT idents (ident :: idents)
+
etuple : eexp COMMA eexp ([eexp1, eexp2])
| eexp COMMA etuple (eexp :: etuple)