Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please don't merge this!
The purpose is to visualize the diff between the current state of the ast+parser of ocamlformat and the cst+parser of ocamlformat-ng prototype (https://github.com/tarides/ocamlformat-ng), the files in this branch have been made closer to the current main branch of ocamlformat, but this doesn't build.
To display the diff:
git diff main cst -- vendor/parser-extended/
This is a suggestion of roadmap (non-exhaustive) of the changes left to report in ocamlformat, it should be easier to start with the type changes before working on the ext_attributes and the parentheses. Refer to parsetree.mli:
1. Enrich existing type constructors
ptyp_alias
(Add location to ptyp_alias #2239)pexp_pack
(Add optional package_type to pexp_pack #2234)pval_prim
(Add locations to pval_prim strings #2238)pcstr_record
(Add location to pcstr_record #2237)pcsig_self
(Make pcsig_self optionnal #2216)pcstr_self
(Make pcstr_self optional #2236)fun_param
(Define type function_param and replace Sugar.arg_kind #2466)2. Improve representation of poly/newtype
pexp_poly
,pexp_newtype
,ptyp_newtype_poly
(Simplify representation of class field values and methods #2529)3. Add location in Longident.t type
Longident.t. loc
withLongident.t
4. Add extension and attributes
*_ext_attributes
(Moves module attributes after the module keyword #2247), as these fields are kept together in the parser.5. Preserve parentheses
Pexp_parens
Ppat_parens
Ptyp_parens
Pcl_parens
Pmty_parens
Pmod_parens
Bonus
module_expr
andmodule_type
probably need to be reworked tooSugar.ml
by reverting the normalization made in the parserWhile reporting some of the changes into ocamlformat, if design choices make the files diverge from ocamlformat-ng please update the files in this branch.
Also don't forget to propagate the changes in
parser-recovery/lib/parser.mly
and rundune build @all
to regenerate the diffs.