diff options
| author | Graydon Hoare <[email protected]> | 2010-06-30 14:51:36 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-06-30 14:51:36 -0700 |
| commit | 6c3a2491d8cfdd097c72e1a37970f8a951baf921 (patch) | |
| tree | 5788cb4d5ace4a7630eee2518265c94c5f6dab05 | |
| parent | Fix formatting string. (diff) | |
| download | rust-6c3a2491d8cfdd097c72e1a37970f8a951baf921.tar.xz rust-6c3a2491d8cfdd097c72e1a37970f8a951baf921.zip | |
Add support for parsing COMP_deref lval components (*foo).
| -rw-r--r-- | src/boot/fe/pexp.ml | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/boot/fe/pexp.ml b/src/boot/fe/pexp.ml index 25352e5c..d02a5f6d 100644 --- a/src/boot/fe/pexp.ml +++ b/src/boot/fe/pexp.ml @@ -41,6 +41,7 @@ and plval = | PLVAL_app of (Ast.ident * (Ast.ty array)) | PLVAL_ext_name of (pexp * Ast.name_component) | PLVAL_ext_pexp of (pexp * pexp) + | PLVAL_ext_deref of pexp and pexp = pexp' Common.identified ;; @@ -588,6 +589,13 @@ and parse_bottom_pexp (ps:pstate) : pexp = end end + + | STAR -> + bump ps; + let inner = parse_pexp ps in + let bpos = lexpos ps in + span ps apos bpos (PEXP_lval (PLVAL_ext_deref inner)) + | (INT | UINT | CHAR | BOOL) as tok -> begin bump ps; @@ -1030,6 +1038,11 @@ let rec desugar_lval (ps:pstate) (pexp:pexp) : (Ast.stmt array * Ast.lval) = (Array.append base_stmts ext_stmts, Ast.LVAL_ext (base_lval, Ast.COMP_atom (clone_atom ps ext_atom))) + | PEXP_lval (PLVAL_ext_deref base_pexp) -> + let (base_stmts, base_atom) = desugar_expr_atom ps base_pexp in + let base_lval = atom_lval ps base_atom in + (base_stmts, Ast.LVAL_ext (base_lval, Ast.COMP_deref)) + | _ -> let (stmts, atom) = desugar_expr_atom ps pexp in (stmts, atom_lval ps atom) |