Commit bda6ac11 authored by Andrei Paskevich's avatar Andrei Paskevich

Parser: snapshot types

parent 8f6bff66
......@@ -332,12 +332,14 @@ abstract:
| ABSTRACT { Abstract }
type_field:
| labels(lident) cast
{ { f_ident = $1; f_mutable = false; f_ghost = false;
f_pty = $2; f_loc = floc $startpos $endpos } }
| field_modifiers labels(lident) cast
{ { f_ident = $2; f_mutable = fst $1; f_ghost = snd $1;
f_pty = $3; f_loc = floc $startpos $endpos } }
field_modifiers:
| (* epsilon *) { false, false }
| MUTABLE { true, false }
| GHOST { false, true }
| GHOST MUTABLE { true, true }
......@@ -395,6 +397,7 @@ ty_arg:
| LEFTPAR comma_list2(ty) RIGHTPAR { PTtuple $2 }
| LEFTPAR RIGHTPAR { PTtuple [] }
| LEFTPAR ty RIGHTPAR { PTparen $2 }
| LEFTBRC ty RIGHTBRC { PTpure $2 }
cast:
| COLON ty { $2 }
......
......@@ -33,6 +33,7 @@ type pty =
| PTtuple of pty list
| PTarrow of pty * pty
| PTparen of pty
| PTpure of pty
(*s Patterns *)
......
......@@ -123,7 +123,7 @@ let ty_of_pty tuc pty =
ty_app s.its_ts (List.map get_ty tyl)
| PTarrow (ty1, ty2) ->
ty_func (get_ty ty1) (get_ty ty2)
| PTparen ty ->
| PTpure ty | PTparen ty ->
get_ty ty
in
get_ty pty
......@@ -140,6 +140,8 @@ let ity_of_pty muc pty =
ity_tuple (List.map get_ity tyl)
| PTarrow (ty1, ty2) ->
ity_func (get_ity ty1) (get_ity ty2)
| PTpure ty ->
ity_purify (get_ity ty)
| PTparen ty ->
get_ity ty
in
......@@ -897,6 +899,7 @@ let add_types muc tdl =
Loc.try3 ~loc:(qloc q) ity_app s (List.map down tyl) []
| PTtuple tyl -> ity_tuple (List.map down tyl)
| PTarrow (ty1,ty2) -> ity_func (down ty1) (down ty2)
| PTpure ty -> ity_purify (down ty)
| PTparen ty -> down ty in
down pty in
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment