Conversation
fde4aa0 to
7d8b1e9
Compare
src/reason-parser/reason_parser.mly
Outdated
| %on_error_reduce structure_item let_binding_body | ||
| as_loc(attribute)+ | ||
| type_longident | ||
| attribute+ |
There was a problem hiding this comment.
Menhir complains these are unreachable from a toplevel expression. Probably because there's as_loc(attribute)+ above.
|
Tests are now failing on versions of OCaml < 4.06 because I implemented parsing of Not sure what's the proper way to parse these on older versions of OCaml; or is it even supported? |
|
It was only added in 4.06.0. See https://github.com/ocaml/ocaml/blob/trunk/Changes#L801 |
|
@hcarty I'm aware. I'm trying to see if there's a way to run those tests only against 4.06.0. |
|
I can't find a way to do it with the current setup. In any case, after thinking about it, I don't see the value of exercising the OCaml parser, since it's something we don't control. I'll test |
|
@anmonteiro I apologize - I misunderstood the question |
|
I think this PR is now ready. Code reviews very much appreciated! |
b262010 to
f2f01cc
Compare
IwanKaramazow
left a comment
There was a problem hiding this comment.
Is it possible to add "type checked" tests covering the new ast constructs?
src/reason-parser/reason_oprint.ml
Outdated
| | Ovar_name (id, tyl) -> | ||
| fprintf ppf "@[%a%a@]" print_typargs tyl print_ident id | ||
| | Ovar_typ o -> print_out_type ppf o | ||
| (* fprintf ppf "@[%a%a@]" print_typargs tyl print_ident id *) |
There was a problem hiding this comment.
Commented out line can probably be omitted?
| | let_bindings SEMI class_expr_lets_and_rest | ||
| { class_of_let_bindings $1 $3 } | ||
| | object_body { mkclass (Pcl_structure $1) } | ||
| | LET? OPEN override_flag as_loc(mod_longident) SEMI class_expr_lets_and_rest |
There was a problem hiding this comment.
Is there a reason why we still need to support let open ... vs just open ... in newly added syntax? I tend to favour just open in favour of less grammar complexity. Thoughts?
There was a problem hiding this comment.
I added these for consistency with the seq_expr_no_seq production.
|
|
||
| class_sig_body_cty: | ||
| | class_sig_body { Pcty_signature $1 } | ||
| | LET? OPEN override_flag as_loc(mod_longident) SEMI as_loc(class_sig_body_cty) |
There was a problem hiding this comment.
Same remark about let open as above.
| let pcd_name = { | ||
| txt = label; | ||
| txt = label.txt; | ||
| loc = pcd_loc; |
There was a problem hiding this comment.
This should probably become label.loc? (And finally fixes the comment duplication?)
5694900 to
3b34a1e
Compare
|
Went through the code review items and:
|
038161b to
3470c12
Compare
|
VERY cool. |
3470c12 to
12aba0b
Compare
12aba0b to
c9dabb1
Compare
6a875d7 to
2b43907
Compare
8cb794f to
fa71b54
Compare
|
superseded by #2487 |
This PR upgrades the parser to the 4.06 AST version.
This paves the way to solving a number of issues that are currently blocked because we use the 4.04 version of the AST. For example, this PR also fixes:
In addition, this PR introduces parsing / printing of some new syntactic constructs made possible by OCaml 4.06:
openstatements in class expressions (e.g.class x = { open M; as self; };(Support 'let open' in class and class type expressions ocaml/ocaml#1249)openstatements in class types (e.g.class type x = { open M; as 'a; };(also Support 'let open' in class and class type expressions ocaml/ocaml#1249)