139 Commits

Author SHA1 Message Date
Pierre-Marie de Rodat
c8227fe42e Lkt lowering/langkit.dsl_unparse: rework handling of external properties
Merge the @external, @uses_envs and @uses_entity_info annotations into a
single one: @external(uses_envs=true, uses_entity_info=true). This makes
sense, as uses_envs and uses_entity_info are never legal for
non-external properties.
2023-12-13 13:55:11 +00:00
Pierre-Marie de Rodat
dfb2360400 Lkt lowering: handle env specs and missing env-related expressions 2023-12-13 13:55:11 +00:00
Pierre-Marie de Rodat
a84bb14f92 Lkt/langkit.dsl_unparse: add env specs handling 2023-12-13 13:55:10 +00:00
Pierre-Marie de Rodat
f4e0349e71 Testsuite: switch as many tests as possible to types_from_lkt=True 2023-12-13 13:55:10 +00:00
Pierre-Marie de Rodat
96845e1c08 langkit.dsl_unparse: unparse raising casts as ".as![T]" 2023-12-13 13:55:10 +00:00
Pierre-Marie de Rodat
f75832df8a langkit.dsl_unparse: minor style tweaks 2023-12-13 13:55:06 +00:00
Pierre-Marie de Rodat
58c90019ed Lkt: use Entity[N] to designate the entity type for the N node type
With the current low-tech approach to typing/validity checking for Lkt,
it is not possible to infer whether N designates a bare node type or an
entity type. Introduce a different syntax for entity types to avoid this
problem.
2023-12-13 13:36:31 +00:00
Pierre-Marie de Rodat
cf404171ea Python App: add parsing errors handling for requested units
By default, make App instances print parsing errors for all requested
units on the standard output, and let subclasses override this behavior
if needed.

Also extend the Python playground so that parsing errors fit nicely into
the prompt header.
2023-07-25 19:03:32 +00:00
Pierre-Marie de Rodat
c51e3994f5 Python API: fix passing of structs as property arguments 2023-05-16 08:01:46 +00:00
Pierre-Marie de Rodat
9b95a0d6a1 $.Implementation: new Set_Last_Exception overload for big exc. messages 2023-05-10 10:14:50 +00:00
Pierre-Marie de Rodat
157d06edef python_api/event_handler: fix stdout/stderr sync issues
Add flushing close to places that deal with exceptions so that the order
of lines in the output reflect the order of execution for the
corresponding print statements.

The actual buffering behavior differs depending on the Python
interpreter version used, which led to spurious diffs with older
versions.

TN: W306-034
2023-03-14 10:48:38 +00:00
Pierre-Marie de Rodat
d4fb87f1b6 Testsuite: add an output refiner for Python tracebacks
Depending on the Python interpreter version that is used to exercise
generated libraries, the line number, and thus the quoted line of source
code that is present in baselines can vary. Introduce an output refiner
to hide these discrepancies and use them in tests where it is relevant.

TN: W306-034
2023-03-14 10:48:38 +00:00
Pierre-Marie de Rodat
b298a62b39 python_api/app: fix propagation of path_wrapper to subprocesses
TN: VA12-016
2022-12-05 16:13:40 +00:00
Pierre-Marie de Rodat
0b029ac1b0 C API: split analysis context allocation/initialization
Since the analysis context initialization may trigger events (e.g.
"prelude file parsed"), language bindings (in particular Python) may
need to create/register their wrapper around the context that is just
created so that they can use that wrapper when invoking the callback.

Having allocation and initialization as a single atomic step makes this
impossible: this change splits them in the C API and update the
Python/OCaml bindings to allow this.

TN: VA12-016
2022-11-23 12:37:21 +00:00
Pierre-Marie de Rodat
52297d3c8c Python API: allow App subclasses to associate event handlers to contexts
TN: VA12-016
2022-11-23 12:37:21 +00:00
Pierre-Marie de Rodat
dc16344d15 python_api/app: refactor testcase
TN: VA12-016
2022-11-23 12:37:21 +00:00
Pierre-Marie de Rodat
5c9eea0853 python_api/python_app: rename to python_api/app
TN: VA12-016
2022-11-23 12:37:21 +00:00
Pierre-Marie de Rodat
c6adec40a2 Python API: bind the event handler API
TN: VA12-016
2022-11-23 12:37:21 +00:00
Pierre-Marie de Rodat
3a3eb9cd2e C/Python/OCaml APIs: merge "entity_repr" and "node_repr"
Public APIs are supposed to expose entities as black boxes: there is no
concept of bare node, there. For this reason, it makes no sense to have
two distinct "repr"/"image" primitives for them. Remove the existing
"entity_repr" primitive and make "node_repr" use the entity info for its
work.

For #639
2022-11-15 12:17:35 +00:00
Pierre-Marie de Rodat
642f17e237 File readers: allow both diagnostics and contents in a result
It may be interesting for file readers to return both decoded contents
and also diagonstics, for example when doing error recovery while
transcoding the source buffer.

The Read primitives currently does not allow this: Contents is
considered uninitialized when Diagnostics is not empty. Always expect
Contents to be initialized instead to support this case.

TN: VA17-001
2022-11-02 09:12:53 +00:00
Raphaël AMIARD
a4c7be1865 Add App.default_get_files mechanism to Python API
This will allow Libadalang to use GPR's API to get source files.

Needed for libadalang#938
2022-10-26 13:08:45 +00:00
Raphaël AMIARD
92698b017a Fix dsl_unparse wrt. node documentation
Don't include generated part in the docstrings

libadalang#923
2022-05-30 16:06:31 +02:00
Pierre-Marie de Rodat
7698a8d111 dsl_unparse: remove spurious line break in grammars
For GitLab issue #612
2022-05-17 11:52:36 +02:00
Pierre-Marie de Rodat
11ab0daea6 dsl_unparse: add an empty line after import statements
This makes the output sources more readable.

For GitLab issue #612
2022-05-17 11:52:36 +02:00
Pierre-Marie de Rodat
0521a6de67 Lkt: make ASTList derive from RootNode
This is necessary in order to let ASTList[T] have the same properties as
any other node.

TN: RA22-015
2021-12-13 16:19:34 +01:00