Mercurial > urweb
comparison src/lacweb.grm @ 170:a158f8c5aa55
Parsing basic patterns
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 29 Jul 2008 16:38:15 -0400 |
parents | adc4e42e3adc |
children | 8221b95cc24c |
comparison
equal
deleted
inserted
replaced
169:2232ab355f66 | 170:a158f8c5aa55 |
---|---|
49 | TYPE | NAME | 49 | TYPE | NAME |
50 | ARROW | LARROW | DARROW | 50 | ARROW | LARROW | DARROW |
51 | FN | PLUSPLUS | MINUSMINUS | DOLLAR | TWIDDLE | 51 | FN | PLUSPLUS | MINUSMINUS | DOLLAR | TWIDDLE |
52 | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR | WHERE | EXTERN | 52 | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR | WHERE | EXTERN |
53 | INCLUDE | OPEN | CONSTRAINT | CONSTRAINTS | EXPORT | 53 | INCLUDE | OPEN | CONSTRAINT | CONSTRAINTS | EXPORT |
54 | CASE | |
54 | 55 |
55 | XML_BEGIN of string | XML_END | 56 | XML_BEGIN of string | XML_END |
56 | NOTAGS of string | 57 | NOTAGS of string |
57 | BEGIN_TAG of string | END_TAG of string | 58 | BEGIN_TAG of string | END_TAG of string |
58 | 59 |
96 | rexp of (con * exp) list | 97 | rexp of (con * exp) list |
97 | xml of exp | 98 | xml of exp |
98 | xmlOne of exp | 99 | xmlOne of exp |
99 | tag of string * exp | 100 | tag of string * exp |
100 | tagHead of string * exp | 101 | tagHead of string * exp |
102 | |
103 | branch of pat * exp | |
104 | branchs of (pat * exp) list | |
105 | pat of pat | |
106 | pterm of pat | |
101 | 107 |
102 | attrs of (con * exp) list | 108 | attrs of (con * exp) list |
103 | attr of con * exp | 109 | attr of con * exp |
104 | attrv of exp | 110 | attrv of exp |
105 | 111 |
308 (EAbs ("_", SOME (TRecord (CRecord [], loc), loc), eexp), loc) | 314 (EAbs ("_", SOME (TRecord (CRecord [], loc), loc), eexp), loc) |
309 end) | 315 end) |
310 | 316 |
311 | LPAREN eexp RPAREN DCOLON cexp (EAnnot (eexp, cexp), s (LPARENleft, cexpright)) | 317 | LPAREN eexp RPAREN DCOLON cexp (EAnnot (eexp, cexp), s (LPARENleft, cexpright)) |
312 | eexp MINUSMINUS cexp (ECut (eexp, cexp), s (eexpleft, cexpright)) | 318 | eexp MINUSMINUS cexp (ECut (eexp, cexp), s (eexpleft, cexpright)) |
319 | CASE eexp OF barOpt branch branchs (ECase (eexp, branch :: branchs), s (CASEleft, branchsright)) | |
313 | 320 |
314 eterm : LPAREN eexp RPAREN (#1 eexp, s (LPARENleft, RPARENright)) | 321 eterm : LPAREN eexp RPAREN (#1 eexp, s (LPARENleft, RPARENright)) |
315 | 322 |
316 | path (EVar path, s (pathleft, pathright)) | 323 | path (EVar path, s (pathleft, pathright)) |
317 | cpath (EVar cpath, s (cpathleft, cpathright)) | 324 | cpath (EVar cpath, s (cpathleft, cpathright)) |
327 | 334 |
328 | XML_BEGIN xml XML_END (xml) | 335 | XML_BEGIN xml XML_END (xml) |
329 | XML_BEGIN XML_END (EApp ((EVar (["Basis"], "cdata"), s (XML_BEGINleft, XML_ENDright)), | 336 | XML_BEGIN XML_END (EApp ((EVar (["Basis"], "cdata"), s (XML_BEGINleft, XML_ENDright)), |
330 (EPrim (Prim.String ""), s (XML_BEGINleft, XML_ENDright))), | 337 (EPrim (Prim.String ""), s (XML_BEGINleft, XML_ENDright))), |
331 s (XML_BEGINleft, XML_ENDright)) | 338 s (XML_BEGINleft, XML_ENDright)) |
339 | |
340 branch : pat DARROW eexp (pat, eexp) | |
341 | |
342 branchs: ([]) | |
343 | BAR branch branchs (branch :: branchs) | |
344 | |
345 pat : pterm (pterm) | |
346 | cpath pterm (PCon (#1 cpath, #2 cpath, SOME pterm), s (cpathleft, ptermright)) | |
347 | |
348 pterm : SYMBOL (PVar SYMBOL, s (SYMBOLleft, SYMBOLright)) | |
349 | cpath (PCon (#1 cpath, #2 cpath, NONE), s (cpathleft, cpathright)) | |
350 | UNDER (PWild, s (UNDERleft, UNDERright)) | |
351 | LPAREN pat RPAREN (pat) | |
332 | 352 |
333 rexp : ([]) | 353 rexp : ([]) |
334 | ident EQ eexp ([(ident, eexp)]) | 354 | ident EQ eexp ([(ident, eexp)]) |
335 | ident EQ eexp COMMA rexp ((ident, eexp) :: rexp) | 355 | ident EQ eexp COMMA rexp ((ident, eexp) :: rexp) |
336 | 356 |