123 Commits

Author SHA1 Message Date
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
Raphaël AMIARD
f2c6d30415 RA22-015: Rework unparsing annotations 2020-06-30 15:43:53 +02:00
Pierre-Marie de Rodat
21ce84653d Add the infrastructure to use node definitions from Lkt units
This leaves an unimplemented "langkit.lkt_lowering.create_nodes"
function and a "nodes_from_lkt" switch that tests can use to enable the
import of node definitions (nodes, fields, env specs, properties) from
Lkt files rather than from the Python DSL. Once the transition to Lkt is
over, this switch will disappear.

TN: RA22-015
2020-06-11 14:37:13 +02:00
Pierre-Marie de Rodat
cfd80a7acf Reorganize testsuite scripts
In particular, rename "testsuite_support" to "drivers". This will make
it much more comfortable for developpers to use tab-completion in
shells, as there will no longer be a conflict between
"testsuite_support" and "tests" directories.

TN: T511-017
2020-05-29 15:42:27 +02:00
Pierre-Marie de Rodat
2b9b33d6a0 Remove __future__ imports and adjust stylechecks
TN: T511-017
2020-05-26 12:33:48 +02:00
Pierre-Marie de Rodat
0d9ef993b8 Testsuite: define LKT_PATH in drivers rather than in testcases
Unlike what happens on Linux, it seems that on Windows, modifying
`os.environ` in the Python interpreter has no effect on the environment
variables seen in the same process by Ada code. As a consequence, in
order for Liblktlang to have access to the desired LKT_PATH environment
variable, define it in the test drivers so that test processes inherit
it and so that Liblktlang has always access to it.

TN: RA22-015
2020-03-16 19:12:16 +01:00
Pierre-Marie de Rodat
1455ee51fb Lkt: use the native OS path separator for LKT_PATH
Unconditionally using ":" does not work on Windows, as all absolute
directory names contain it (C:\foo\bar).

TN: RA22-015
2020-03-16 19:12:16 +01:00
Pierre-Marie de Rodat
dcffaba4a4 Add support for LKT lexers, transition tests
TN: RA22-015
2020-03-16 10:41:18 +01:00
Pierre-Marie de Rodat
8f9232f99e Regenerate lexer_example.lkt
TN: RA22-015
2020-03-16 10:41:18 +01:00
Pierre-Marie de Rodat
de58c96d16 Testsuite: factorize common lexers in the concrete syntax
TN: RA22-015
2020-03-16 10:41:18 +01:00
Pierre-Marie de Rodat
d366fbfd30 Make concrete syntax unparsing tunable
In particular, make it possible to emit (or not) lexers, grammars and
node definitions to multiple files, and to emit import statements.

TN: RA22-015
2020-03-16 10:41:18 +01:00
Pierre-Marie de Rodat
383670d486 Extend support for LKT grammars, transition tests
TN: RA22-015
2020-02-27 13:43:20 +01:00
Pierre-Marie de Rodat
5416661fba Start translating LKT grammar rules to internal parsers
TN: RA22-015
2020-02-26 12:09:38 +01:00