204 Commits

Author SHA1 Message Date
Hugo Guerrier
565f495544 Adapt Java testing tools to the new GraalVM version 2025-08-22 09:26:09 +00:00
Hugo Guerrier
a0a85d0a81 Don't use 'TruffleString' anymore to decode Langkit's UTF-32 buffers
We now use the standard Java library.
Also exclude the Truffle API from the shaded JAR.
2025-08-22 09:26:09 +00:00
Pierre-Marie de Rodat
6e87e1686d Remove ambient locations for diagnostics 2025-05-26 13:52:53 +00:00
Pierre-Marie de Rodat
b8d7fa75c2 langkit.config: use metaprogramming to implement JSON decoding 2025-04-03 14:41:28 +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
30d4905bbd Remove support to infer DSL location from Python tracebacks
Now that the Python DSL is retired, it no longer makes any sense to call
`langkit.diagnostics.extract_location_from_traceback`, as no traceback
frame will even contain location information that is meaningful for the
DSL. Replace it with explicit `location` constructor arguments instead.
2025-03-24 15:39:29 +00:00
Pierre-Marie de Rodat
06fb6d69f8 lkm: rename the "setenv" command to "printenv" 2025-03-10 16:23:41 +00:00
Pierre-Marie de Rodat
df73d23e3b Stop supporting the Python DSL
Remove the `lexer` and `grammar` arguments for `CompileCtx.__init__` as
well as the `types_from_lkt` config setting, and make the `lkt_spec`
config entry mandatory: all aspects of language specs now have to come
from Lkt source code.
2025-02-17 12:02:08 +01:00
Pierre-Marie de Rodat
708e41a148 Remove langkit.dsl_unparse 2025-02-06 09:31:49 +00:00
Pierre-Marie de Rodat
f749c71c6b langkit.libmanage: always give direct access to C headers
For some commands, like "lkm setenv" or "lkm run", it is not possible to
determine whether direct access to C headers will be needed eventually,
so unconditionally give access to them. Since the only C header present
in the generated sources is the language-specific header, this should
not be a problem in practice.
2025-01-20 15:35:14 +00:00
Pierre-Marie de Rodat
434e426223 langkit.config: enable types_from_lkt by default for LktSpec 2025-01-20 15:18:25 +00:00
Pierre-Marie de Rodat
3fbb1c38b7 langkit.config: rename "lkt" to "lkt_spec" 2025-01-09 19:59:12 +00:00
Pierre-Marie de Rodat
8beccff706 Introduce lkm, the replacement for manage.py scripts
This new command line tool has the same CLI as current manage.py
scripts, but automatically loads "langkit.yaml" files configurations, so
that language specs do not have to write Python code to subclass
ManageScript.
2025-01-07 15:09:51 +00:00
Pierre-Marie de Rodat
8bec684f53 langkit.config: keep LibraryConfig.root_directory init. automatic
The root directory is always supposed to be inferred from the context
(where manage.py or langkit.yaml files are located): do not allow the
YAML configuration to initialize it.
2025-01-07 15:09:51 +00:00
Pierre-Marie de Rodat
389d78a6e7 langkit.config: introduce JSON deserialization
Also rework lkt_compile and lkt_build_and_run test drivers so that the
language spec configuration bits are stored in the testcase's test.yaml
file directly: no need to add glue code in various places (test driver,
lkt_compile.py/lkt_build_and_run.py scripts) to support a new kind of
language spec configuration.
2025-01-07 15:09:51 +00:00
Pierre-Marie de Rodat
109fd493c7 Introduce separate data structure to hold the language spec config
Replace the messy collection of arguments for CompileCtx.__init__ and
CompileCtx.create_all_passes with better organized dataclasses in the
new langkit.config module. Update the codebase to use these data
structures.
2025-01-07 09:54:56 +00:00
Pierre-Marie de Rodat
f9b87d6887 lkt_build_and_run: show subprocess output even for error return codes
When a main fails, we want to have its output included in logs for
debuggability. Previous changes in support code broke that behavior.
2024-12-05 15:26:20 +01:00
Pierre-Marie de Rodat
bdc9fd4c3b Testsuite: fix test output encoding issues on Windows 2024-12-03 14:02:36 +00:00
Pierre-Marie de Rodat
636c6b9bf3 Unparsing: fix the handling of non-UTF-8 sources in the unparse main
Add a --charset argument that the unparse main uses to decode the source
files to reformat, and to encode the reformatted content. Also enhance
the lkt_build_and_run driver so that it can run mains with heterogeneous
encodings (one that outputs UTF-8 and another that outputs ISO-8859-1,
for instance).
2024-11-28 14:47:19 +00:00
Pierre-Marie de Rodat
8cfcffd96a Rehaul the handling of optional passes
Rework the formatting for the listing of optional passes, refactor the
handling of --pass-on/--pass-off (to enable/disable optional passes), fix
a couple of crashes and add a testcase to exercise this little used part
of Langkit.
2024-11-05 08:58:12 +00:00
Pierre-Marie de Rodat
59968f6cdf Remove the unused pretty-printing feature for generated sources 2024-11-05 08:58:12 +00:00
Pierre-Marie de Rodat
d3df67b642 Let language specs enable case insensitivity with a lexer annotation
Whether or not case insensitivity should be enabled is tied to the
language itself, so this setting belongs to the language specification
better than to a CompileCtx argument.
2024-11-05 08:58:12 +00:00
Pierre-Marie de Rodat
9514b56cf6 Let language specs enable unparsers with a grammar annotation
Whether unparsers are generated or not has implications on legality
checks for the grammar, so it makes sense for this to be a property of
the grammar itself: introduce an Lkt annotation as well as a
langkit.parsers.Grammar argument for it, and remove the corresponding
CompileCtx argument.

Also rename "generate_unparser" to "generate_unparsers" for consistency
across the codebase.
2024-11-05 08:58:12 +00:00
Pierre-Marie de Rodat
f7736b7f5f CompileCtx: remove unused constructor arguments 2024-11-05 08:58:12 +00:00
Pierre-Marie de Rodat
be95fe9622 Testsuite: do not call langkit.reset() after emit_and_print_errors
Avoding this will allow lkt_compile/lkt_build_and_run tests to inspect
the compile context of Libfoolang from their "test.py" script, allowing
more "python" tests to transition to these drivers.
2024-10-21 12:57:30 +00:00