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.
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.
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.