- let make_rule sep ((constr,vars),rhs) =
- if (is_big rhs) then
- Box.V([],[Box.H([],[Box.Text([],sep);
- Box.smallskip;
- make_pattern constr vars;
- Box.smallskip;
- Box.Text([],"->")]);
- Box.indent (bigast2box rhs)])
- else
- Box.H([],[Box.Text([],sep);
- Box.smallskip;
- make_pattern constr vars;
- Box.smallskip;
- Box.Text([],"->");
- Box.smallskip;
- Box.Object([],rhs)]) in
- let plbox = match pl with
- [] -> Box.Text([],"[]")
- | r::tl ->
- Box.H([],
- [Box.V([],
- (make_rule "[" r)::(List.map (make_rule "|") tl));
- Box.Text([],"]")]) in
- if is_big arg then
- Box.V(map_attributes attr,
- [Box.Text([],"match");
- Box.H([],[Box.skip;
- bigast2box arg;
- Box.smallskip;
- Box.Text([],"with")]);
- plbox])
- else
- Box.V(map_attributes attr,
- [Box.H(map_attributes attr,
- [Box.Text([],"match");
- Box.smallskip;
- ast2box arg;
- Box.smallskip;
- Box.Text([],"with")]);
- plbox])
+ let make_rule sep ((constr,vars),rhs) =
+ if (is_big rhs) then
+ Box.V([],[Box.H([],[Box.Text([],sep);
+ Box.smallskip;
+ make_pattern constr vars;
+ Box.smallskip;
+ Box.Text([],"\Rightarrow")]);
+ Box.indent (bigast2box rhs)])
+ else
+ Box.H([],[Box.Text([],sep);
+ Box.smallskip;
+ make_pattern constr vars;
+ Box.smallskip;
+ Box.Text([],"\Rightarrow");
+ Box.smallskip;
+ Box.Object([],rhs)]) in
+ let plbox = match pl with
+ [] -> Box.Text([],"[]")
+ | r::tl ->
+ Box.H([],
+ [Box.V([],
+ (make_rule "[" r)::(List.map (make_rule "|") tl));
+ Box.Text([],"]")]) in
+ let ty_box =
+ match ty with
+ | Some ty ->
+ [ Box.H([],[Box.Text([],"[");
+ ast2box ty;
+ Box.Text([],"]")]) ]
+ | None -> []
+ in
+ if is_big arg then
+ Box.V(map_attributes attr,
+ ty_box @
+ [Box.Text([],"match");
+ Box.H([],[Box.skip;
+ bigast2box arg;
+ Box.smallskip;
+ Box.Text([],"with")]);
+ plbox])
+ else
+ Box.V(map_attributes attr,
+ ty_box @
+ [Box.H(map_attributes attr,
+ [Box.Text([],"match");
+ Box.smallskip;
+ ast2box arg;
+ Box.smallskip;
+ Box.Text([],"with")]);
+ plbox])