a type "[ | w ]" must be printed with the "|", or it won't be
reparseable.
with tests, Changes entry.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch pr-polyvariant-pprint
# Changes to be committed:
# modified: Changes
# modified: parsing/parsetree.mli
# modified: parsing/pprintast.ml
# modified: testsuite/tests/parsetree/source.ml
#
# Untracked files:
# Changes.orig
# parsing/pprintast.ml.orig
# testsuite/tests/parsetree/source.ml.orig
# testsuite/tests/parsetree/source.ml.rej
#
The concrete syntax only allows attributes on tags/constructors/fields
(Rtag, Otag), not on inherited subtypes (Rinherit, Oinherit); we add
this as new enforced invariant in ast_invariants.
Florian Angeletti and myself ran into a problem when trying to use attributes
for ellision of parts of manual example. We wanted to be turn any ast-node
marked with the [@ellipsis] attribute into "..." in the rendering of the
corresponding code block, but for this we need the location of the
attributed node, and it turns out that some constructions supported
attributes without carrying a location:
- Rtag in row_field
- Otag in object_field
- type_exception record
- type_extension record
We added locations in all those positions, guaranteeing the invariant
that all nodes to which attributes can be attached have a precise
position.
PR #1118 had turned polymorphic variant constructors from 'label' to
its definition 'string' for consistency with field names in object
types; instead, we consistently name 'label' the method and instance
variable names throughout the AST. This does not break compatibility
as the two types are synonym, but it should improve readability of
parsing/parsetree.mli.
This commits extends the pattern syntax to support local open in
patterns. Four new constructions mirroring the expression constructions
are added
* `M.(pattern)`
* `M.[pattern_list]` ⟺ M.([pattern_list])
* `M.{labeled_pattern_list}` ⟺ M.({label_pattern_list})
* `M.[| .. |] ⟺ M.( [| .. |] )
At the typing phase, the construction `M.(pattern)` brings all
identifiers defined within M inside the scope and then proceed with the
typing of `pattern`. All others constructions are desugared to the
`M.(..)` construction during parsing.
Questionable implementation details:
* Currently, the local pattern open use the `type_open` function like
the local expression pattern. However, this implies that values defined
inside `M` are also brought to the scope. A specialized
`type_open_for_pattern` would be more efficient.
.. and allow any letter in [g-zG-Z] as modifier (previously 'l','L','n')
Also allow modifier for floats
This give more freedom to ppx rewritters (what about a ppx for zarith)
Checks are performed when translating from Parsetree to Typedtree.
Invalid_literal is raised if the modifier is not recognized ([lLn]?)
Integer_overflow is raised as before.
Lexer: use g-zG-Z for integer literal modifier
Lexer: Allow modifier on float
Clean wrt previous commits
Lexer: use named substring
Cleanup
typo
doc
fix after rebase
rebase on trunk
Update typecore.ml
Fix printast.ml