From bb9795918d2f0a1d9141dd86c4884fa9446cb2a9 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Sat, 9 Aug 2008 20:08:29 -0400 Subject: Urlifying records --- src/lacweb.grm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/lacweb.grm') 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) -- cgit v1.2.3