127 Commits

Author SHA1 Message Date
Pierre-Marie de Rodat
ca751250b4 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.

(cherry picked from commit e1c4fe5804)
2024-11-28 15:40:33 +00:00
Pierre-Marie de Rodat
bf3e3b8e76 Sort diagnostics by sloc range after (re) parsing
(cherry picked from commit 345b52a4f7)
2024-11-28 10:39:33 +00:00
Pierre-Marie de Rodat
68e87c2cb0 python_api/app: fix testcase for Python <3.9
(cherry picked from commit df84be5d5d)
2024-11-28 09:20:31 +00:00
Pierre-Marie de Rodat
3bf2f2c86f Modernize type annotations
(cherry picked from commit 54a7dd3a6c)
2024-11-28 09:20:31 +00:00
Pierre-Marie de Rodat
957c30bd93 Switch to property syntax all argument-less built in properties
(cherry picked from commit 35d5d6a4b8)
2024-11-27 14:32:43 +00:00
Pierre-Marie de Rodat
a1c844d5ee Lkt: remove the root type argument for builtin generic types
For AnalysisUnit and LexicalEnv, there is no type argument left, so they
are not generic types anymore.
2024-07-04 12:37:30 +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
ec4872e418 Lkt: change naming convention for token names for lower to camel
This makes the convention consistent with the DSL, and avoids
workarounds for conflicts with Lkt keywords: in Libadalang, the Null
token can stay Null, instead of null_tok (no API breakage needed).
2024-06-28 08:41:26 +00:00
Pierre-Marie de Rodat
dca25f78d6 Lkt: rename @has_abstract_list to @with_abstract_list 2024-06-19 10:18:02 +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
9d0d41a826 Add Source_Location as a compiled type
Future work on Lkt will use this compiled type so that properties can
return precisely located errors on string literals.

Note that the exposition of this new compiled type to the OCaml and Java
APIs is incomplete, and is deferred to future developments.
2024-01-11 17:29:43 +00: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
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