15 Commits

Author SHA1 Message Date
Pierre-Marie de Rodat
6e88d6ec25 Lkt: revamp the module system 2026-01-20 16:03:43 +00:00
Pierre-Marie de Rodat
6cefc74c93 Set up pre-commit checks and reformat the Python sources with black 2025-03-26 14:04:20 +00:00
Pierre-Marie de Rodat
4bae239699 Testsuite: rework obsolete output refiners
Now that the Python DSL is gone, must line number hiding is
counter-productive: Python line numbers are not expected to show up in
test outputs in the general case, and hiding them hindes debugging when
there is a Python crash in a testcase. Rework the corresponding output
refiners so that this is done only when actually needed.
2025-02-17 12:02:08 +01:00
Pierre-Marie de Rodat
aef63bd2f7 Avoid reparsing units when their source buffer does not change
Also adapt testcases so that they don't rely on unconditionnal
reparsing when the source buffer stays the same.
2024-12-16 09:07:47 +00:00
Pierre-Marie de Rodat
e1c4fe5804 Introduce the lkt_build_and_run test driver
Transition all relevant testcases to it. In the process, port
docstrings/comments from test.py files to expected_concrete_syntax.lkt
(now test.lkt) sources and fix stylechecks issues there.
2024-10-15 14:13:10 +00:00
Romain Beguet
05362a5e93 Improve style and fix formatting issues in dsl_unparse. 2024-07-03 08:23:35 +00:00
Pierre-Marie de Rodat
eb36d66f4f Lkt: rename @export to @exported 2024-06-19 10:18:02 +00:00
Raphaël AMIARD
c9d78f71dc Adapt symbol representation: store reference to symbol table
That'll allow us to go from (thin_symbol, sym_table) to symbol, and vice
versa, where with the old representation there was no other way to go
from symbol to thin than redoing a full-lookup.

That'll help us transition to thin-symbol storage everywhere.
2024-03-22 09:42:03 +01:00
Pierre-Marie de Rodat
1ffd449060 langkit.dsl_unparse: rework empty lines emitted for properties 2023-12-13 13:55:11 +00:00
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
f75832df8a langkit.dsl_unparse: minor style tweaks 2023-12-13 13:55:06 +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
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
c6adec40a2 Python API: bind the event handler API
TN: VA12-016
2022-11-23 12:37:21 +00:00