Commit Graph

22 Commits (master)

Author SHA1 Message Date
Thomas Refis 8e928caea7
a better representation for modules with no name (#8908) 2019-10-09 14:15:37 +01:00
David Allsopp 1626a018d8 Remove unnecessary executable bit from sources (#2270)
Various files which seem to have acquired Git executable bits.
File contents are unchanged; only permissions are changed.
2019-02-28 16:29:26 +01:00
Leo White 403003cad5 Add support for "let" operators 2018-11-27 13:30:55 +00:00
Runhang Li 97329f30ed Extend `open` to arbritrary module expressions in structures and to
applicative module paths in signatures
2018-11-26 16:20:37 +00:00
Thomas Refis 6805595f57 introduce local substitutions in signatures
type [params] id := type_expr { and [params] id := type_expr }
    module Uid := extended-module-path
2018-11-09 16:43:43 +00:00
Gabriel Scherer e348103ab8 parsetree.{row,object}_field: move attributes in the wrapper record
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.
2018-08-20 19:57:47 +02:00
Gabriel Scherer 48b06a44ae ast_{iter,mapper}: always traverse the attributes right after the location
Now that each node that supports attributes also has a location,
we want to make the attributed node's location robustly available
to AST traversal functions.

The best way to do this would be to change the "attributes" traverser
to take the node's location as extra parameter. However, doing this
changes the type of the traverser interface, with a risk of breaking
user code. This may be the right long-term change, but for now
we go with something weaker: we ensure that the attributes of a node
are always traversed right after the node's location, which lets
user track attributed location (if they wish) through a side-effect.
2018-08-20 19:57:47 +02:00
Gabriel Scherer 85785b173a parsetree: make sure that all nodes that store attributes also store a location
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.
2018-08-20 19:57:47 +02:00
Hugo Heuzard 8043144494 Add locations to attributes
Changes

fix typo
2018-08-06 13:19:28 +01:00
Hugo Heuzard 7835cbb9bd Add tests for attributes
fix style
2018-04-09 22:29:46 +01:00
Hugo Heuzard 002815c4bb allow to attach @@ attributes on exceptions 2018-04-09 22:29:46 +01:00
Leo White 5cb27d8ebb Merge pull request #792 from sliquister/generalize-destr-subst2
Fixing the limitations on destructive substitutions
2017-09-15 09:29:29 +01:00
Valentin Gatien-Baron f29cd5ab6d Support syntax: S with M.N.t := ... 2017-08-01 07:32:08 -04:00
Runhang Li c39b975d43 merge trunk and update test 2017-07-23 09:31:58 +08:00
Alain Frisch fd47ba9649 Support 'let open' in class and class type expressions (#1249)
* Support 'let open' in class and class type expressions.

* Adapt ocamlprof.

* Adapt ocamldoc.

* Add tests.

* Changelog.

* Manual.
2017-07-20 08:17:30 +02:00
Mark Li 9dc86f8417
Support inherited field in object type expression.
Also add location on object field label and polymorphic variant tags.
2017-03-22 21:47:34 -07:00
Damien Doligez 0b4fbc2b30 fix whitespace, long lines, headers 2016-08-01 16:06:59 +02:00
octachron 96806cf633 GPR#187: local open for patterns
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.
2016-05-09 09:35:05 -04:00
alainfrisch 502e4f9336 More warnings when compiling the compiler. 2016-03-15 22:46:35 +01:00
alainfrisch 43f90e9f58 Local let exceptions. 2016-03-15 22:02:55 +01:00
Damien Doligez 5401ce8473 Update headers for the new license.
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
Nicolas Ojeda Bar ff1ecd8fcd Add Ast_iterator 2016-01-27 23:02:23 +01:00