210 Commits

Author SHA1 Message Date
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
Pierre-Marie de Rodat
54a7dd3a6c Modernize type annotations 2024-10-16 15:23:56 +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
Hugo Guerrier
3080f208d3 Limit the number of threads taken by native-image to 1 2024-10-10 09:53:06 +00:00
Pierre-Marie de Rodat
18fa52f05a Transition to leftovers tests to types_from_lkt=True 2024-09-11 13:00:20 +00:00
Pierre-Marie de Rodat
5dbb6ea5a9 Testsuite: blacklist calls to build_and_run from DSL locations 2024-08-19 09:58:04 +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
5d5a1029cb Lkt: rename @unparse_newline_after to @with_unparsing_newline 2024-06-19 10:18:02 +00:00
Pierre-Marie de Rodat
0ca47a255c Lkt: rename @unparse_spacing to @unparsing_spacing 2024-06-19 10:18:02 +00:00
Pierre-Marie de Rodat
8da114fb26 Unparsing: keep track of the link to original tokens
This change enhances the unparsing engine so that template instantiation
keeps track of tokens from the source code to reformat as the unparsed
token are produced.

This is preparatory work to preserve formatting information from the
original source code (empty lines and comments), but no change of
behavior is expected at this stage.
2024-06-10 12:38:13 +00:00
Pierre-Marie de Rodat
a998c198dd Bind libraries and programs with -E/-Es depending on build mode 2024-05-29 09:42:28 +00:00
Pierre-Marie de Rodat
2467c2962b Unparsing: introduce built-in default configs for generated libraries 2024-05-24 11:58:44 +00:00
Pierre-Marie de Rodat
3df6923bcc Testsuite: enable lkt_compile tests to check the CompileCtx
Transition the remaining Lkt tests that needed this feature from the
Python driver to the lkt_compile one.
2024-05-13 10:55:03 +00:00
Pierre-Marie de Rodat
7feab1de46 Fix invalid escape sequences in Python code
With recent Python versions, this triggers a SyntaxWarning: address
them.
2024-04-23 14:47:22 +00:00
Romain Beguet
be7e345064 Implement a generic collection mechanism for lexical env lookup caches.
This also repurposes the `All_Diags_Trace` GNATCOLL trace which was
introduced recently but in fact never used.
2024-03-11 09:11:33 +00:00
Pierre-Marie de Rodat
73ef5560c0 Lexer: use the first text found for a token in order to unparse it 2024-02-28 09:51:39 +00:00
Pierre-Marie de Rodat
e2f68bb610 Introduce the "is_comment" trivia annotation
This new annotation will allow unparsers to determine which trivia
should be preserve during unparsing (no trivia is preserve right now).
2024-02-19 12:19:08 +00:00
Pierre-Marie de Rodat
af1fd458bf Testsuite: rework GPR main specifications
Rework the way testcases specify lists of GPR mains to run so that it is
possible to run the same main multiple times with different arguments.
2024-01-10 15:08:06 +00:00
Pierre-Marie de Rodat
f9a101856f Make "generate_unparser" a CompileCtx constructor parameter
Whether to generate unparsers or not has non-trivial implications on the
language spec. For this reason, it does not make much sense to keep this
setting as a code generation option: it should instead be a property of
the language spec itself.
2024-01-10 12:36:41 +00:00
Pierre-Marie de Rodat
dfcf584cbe Langkit_Support.Generic_API.Unparsing: add Prettier output prototype 2024-01-10 12:36:41 +00:00