210 Commits

Author SHA1 Message Date
Pierre-Marie de Rodat
8f220c9e25 Allow lang. specs to extend the set of exceptions properties may raise
So far, properties were allowed to raise Property_Error exceptions only:
other exceptions were considered as a low-level bug (i.e. assumed not
possible), which could corrupt the process state.

This commits allows language specs to allow additional kinds of
exceptions to be raised in property errors.

For #632
2022-07-19 09:42:07 +00:00
Pierre-Marie de Rodat
72ee3c87f5 GDB helpers: fix indentation of multi-line values in the "state" command 2022-06-20 15:12:29 +00:00
Pierre-Marie de Rodat
fa79e76f46 Testsuite: create a new "lkt_compile" test driver
All tests which just check the presence/absence of errors when compiling
Lkt language specs have the same "test.py" script: put a reference
script in "python_support", create a new test driver to let tests use
it easily and migrate relevant tests to it.

For GitHub issue #622
2022-06-08 12:24:31 +00:00
Pierre-Marie de Rodat
db86f7b519 Testsuite: adapt for Python 3.8+
See the rationale in path_wrapper.py's docstring.

TN: V401-020
2022-04-14 14:07:44 +00:00
Pierre-Marie de Rodat
aa0213b1a6 Add a mode to generate standalone libraries (no dep on Langkit_Support)
TN: V323-024
2022-04-05 12:43:08 +00:00
Pierre-Marie de Rodat
e61e501d1b Add a testcase to check GDB helpers
Do not run this test in the GitLab CI as the GDB that comes from Alire
does not have Python scripting support enabled.

TN: S521-024
2022-03-22 13:08:43 +00:00
Pierre-Marie de Rodat
e0d5c7bbea python_support/lexer_example.py: remove obsolete file
Testcases have now been using the Lkt example lexer for a long time:
the Python lexer is no longer needed.

TN: S521-024
2022-03-22 13:08:43 +00:00
Pierre-Marie de Rodat
9c24c9e0a3 Testsuite: restrict inner test parallelism
When running all tests, restrict each test to a single core, otherwise
we end up running spamming the host with N*N subprocesses despite
--jobs=N passed to the testsuite. However, keep inner parallelism to N
when running few tests, for dev convenience.
2022-03-22 10:07:34 +00:00
Pierre-Marie de Rodat
e37eed1c3f Testsuite: add a types_from_lkt argument to emit_and_print_errors
This will allow tests for DSL warnings/errors to be written in full Lkt.

For #612
2022-02-24 14:40:57 +00:00
Pierre-Marie de Rodat
72080d8b24 Testsuite: use gnat.supp for Ada mains
The previous commit for this ticket added a Valgrind suppression file
assuming that the testsuite would automatically pick it up. It is not
the case, so explicitly use gnat.supp in tests when running Ada
programs.

TN: V221-024
2022-02-23 20:11:22 +00:00
Pierre-Marie de Rodat
1345038052 CompileCtx: consider that short name has lower case
We happen to use short name only in its lower case form. Switch to the
lower case form only to avoid breaking the "one word, starting upper
case" rule (for instance with LAL for Libadalang).

TN: V126-009
2022-01-27 16:49:27 +01:00
Pierre-Marie de Rodat
10a61b0265 grammar/invalid_lkt: remove extra errors
Remove errors from test material when they are not the errors that are
meant to be checked. An upcoming change will make these extra errors
visible: we do not want them to hide the ones meant to be checked.

TN: RA22-015
2021-12-01 13:36:41 +01:00
Pierre-Marie de Rodat
01b5de688f Enforce strict sound envs for node synthetization
Now that cross-unit links between lexical envs are handled by the named
environments mechanism, we can get rid of this unsoundness without
breaking Libadalang.

TN: T320-010
2021-08-06 14:54:43 +02:00
Pierre-Marie de Rodat
02991cc2b0 Python API: fix bindings when assertions are disabled
Python's -O command-line option disableds the execution of "assert"
statements. In order for the generated Python bindings to work in such a
mode, we need to keep assertion logic only in "assert" statements. This
commit fixes statements that currently don't respect this principle.

Fixes GitHub issue #485
TN: U326-020
2021-03-29 17:43:50 +02:00
Pierre-Marie de Rodat
7c352c396a Make version numbers available from the C and Python APIs
TN: U127-029
2021-02-02 16:09:08 +01:00
Pierre-Marie de Rodat
9213e956a2 Testsuite: make it possible to check errors in build_and_run
TN: U127-029
2021-02-02 16:09:08 +01:00
Pierre-Marie de Rodat
4c1391dd5f Introduce a language spec-wide option to enable case insensitivity
When enabled, this new option triggers the lexer engine to perform
"native" case insentivity and provides a default symbol canonicalizer
that just converts names to lower case.

TN: U118-054
2021-01-25 12:52:15 +01:00
Pierre-Marie de Rodat
74b239c808 Introduce a "strict" mode for sound envs
The automatic trigger of PLE when synthetizing a node, while necessary
to get sound environments, creates nasty regressions in Libadalang,
which does not use the sound environment framework yet. Introduce a
switch that triggers the new behavior, and whose absence leaves the old
(and incorrect) behavior. This will allow us to continue working on
sound envs without creating regressions in LAL.

TN: TB19-017
2020-12-07 17:40:10 +01:00
Raphaël AMIARD
ee5cd4ae12 TB24-020: Add type annotations to libmanage.py 2020-12-01 10:16:34 +01:00
Raphaël AMIARD
c77d3d76d8 TB24-020: add the concept of optional passes
As well as command line arguments to list/activate/deactivate them.

This will be useful for the railroad diagram pass, and can be
potentially reused for other optional passes.
2020-12-01 10:16:34 +01:00
Pierre-Marie de Rodat
d8bae3abd3 Rework subcommands handling for manage scripts
Most importantly, this changes the parsing of common command line
options/flags, so that they must be passed *after* the subcommand. For
instance:

    ./manage.py --library-types=static make --no-gdb-hook

becomes:

    ./manage.py make --library-types=static --no-gdb-hook

Having some options before the subcommand and the others after have been
a serious source of confusion for both users and developpers.

This change also reorganizes subparser initialization code to reduce
code duplication in ManageScript derivations: dedicated
overridable "add_extra_subcommands" method (instead of the generic
__init__ override) and reusable "add_subbcommand" method (to create a
subcommand parser with the expected name, description and callback.

Finally, this makes it possible for some subcommands to accept unknown
arguments.

TN: T914-012
2020-11-09 10:34:33 +01:00
Pierre-Marie de Rodat
0733104f2d Fix lang_source_dir for testcases
So far, ManageScript assumed that the lang_source_dir is the directory
that contains the Python source file which defines the ManageScript
subclass. This is wrong for testcases, as there is generally only one
ManageScript subclass, in the testsute/python_support/utils.py source
file.

Introduce a new "root_dir" ManageScript constructor argument to override
this behavior, and use it in the testsuite appropriately.

TN: T914-010
2020-11-02 16:51:44 +01:00
Pierre-Marie de Rodat
f760a5f1a2 Reorganize build procedure for Langkit_Support
This commit stops considering Langkit_Support as a generated project:

* move the "langkit/support" directory to "support" (not
  "langkit_support" for convenience with tab-completion);

* move the meat of the "langkit_support_gpr.mako" template to the static
  "langkit_support.gpr" file, and remove the template;

* remove the "build-langkit_support.py" script and all the corresponding
  libmanage.py/langkit_support.py code;

* enhance the top-level "manage.py" script to build/setenv
  Langkit_Support and import the packaging tools from
  "build-langkit_support.py".

From now on, Langkit_Support is a really a standalone library project,
and thus a "real" dependency for Langkit-generated libraries.

TN: T914-012
2020-10-26 15:36:55 +01:00
Pierre-Marie de Rodat
e0168b2449 Testsuite: statically link test programs
TN: T320-010
2020-09-23 10:00:39 +02:00
Raphaël AMIARD
d4ce7e6cea RA22-015: integrate lkt_check pass into langkit 2020-06-30 15:43:53 +02:00