38 Commits

Author SHA1 Message Date
Pierre-Marie de Rodat
6e88d6ec25 Lkt: revamp the module system 2026-01-20 16:03:43 +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
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
Pierre-Marie de Rodat
345b52a4f7 Sort diagnostics by sloc range after (re) parsing 2024-10-11 09:43:39 +00:00
Romain Beguet
05362a5e93 Improve style and fix formatting issues in dsl_unparse. 2024-07-03 08:23:35 +00:00
Pierre-Marie de Rodat
f75832df8a langkit.dsl_unparse: minor style tweaks 2023-12-13 13:55:06 +00:00
Pierre-Marie de Rodat
642f17e237 File readers: allow both diagnostics and contents in a result
It may be interesting for file readers to return both decoded contents
and also diagonstics, for example when doing error recovery while
transcoding the source buffer.

The Read primitives currently does not allow this: Contents is
considered uninitialized when Diagnostics is not empty. Always expect
Contents to be initialized instead to support this case.

TN: VA17-001
2022-11-02 09:12:53 +00:00
Pierre-Marie de Rodat
7698a8d111 dsl_unparse: remove spurious line break in grammars
For GitLab issue #612
2022-05-17 11:52:36 +02:00
Pierre-Marie de Rodat
11ab0daea6 dsl_unparse: add an empty line after import statements
This makes the output sources more readable.

For GitLab issue #612
2022-05-17 11:52:36 +02:00
Pierre-Marie de Rodat
75d64a42d4 Add sloc info to source buffer decoding errors
This will allow users of Langkit-generated libraries to easily locate
invalid byte sequences in their sources.

TN: UB12-067
2021-11-23 14:18:18 +01:00
Laurent Thévenoux
042d578dd5 U920-002: avoid mismatched type error on root node
As the LexicalEnv.get method always return an array of root nodes
while the root node is defined in user code, we need to turn the Node
and LexicalEnv classes into generic traits and instantiate them using
the actual root node.

To make this works, root node declaration has to be changed from
`class FooNode : Node` to `class FooNode implements Node[FooNode]`,
which required to refactor a bit almost all the lkt tests.
2021-09-27 17:39:36 +02:00
Pierre-Marie de Rodat
f7749fcc6b Testsuite: use "ascii" for non-ASCII test outputs
On Windows, the default encoding (not UTF-8) may not allow non-ASCII
test outputs. Use Python's "ascii" builtin where needed to ensure pure
ASCII test outputs.

TN: U720-016
2021-09-27 14:46:45 +02:00
Pierre-Marie de Rodat
5dbf999964 Python API: remove support for Python2
TN: U720-016
2021-09-24 15:54:42 +02:00
Raphaël AMIARD
3eef9cdc25 RA22-015: make Node a base class rt. a trait 2020-06-30 15:43:53 +02:00
Raphaël AMIARD
119379f643 RA22-015 dsl_unparse: Unparse @with_lexer annotation 2020-06-30 15:43:53 +02:00
Pierre-Marie de Rodat
71f773e0ff Rename SymbolNode to TokenNode
TN: RA22-015
2020-06-17 11:45:07 +02:00
Raphaël AMIARD
2060a7c36d RA22-015: make token_node/root_node traits 2020-06-16 15:19:35 +02:00
Pierre-Marie de Rodat
b72147bbb7 Testsuite: add types_from_lkt=True wherever possible
TN: RA22-015
2020-06-11 14:37:13 +02:00
Pierre-Marie de Rodat
770513f43d Generate and interpret the @token_node node annotation
TN: RA22-015
2020-06-11 14:37:13 +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
de58c96d16 Testsuite: factorize common lexers in the concrete syntax
TN: RA22-015
2020-03-16 10:41:18 +01:00
Pierre-Marie de Rodat
05ca4fbcb1 Slightly change lexer annotation syntax
Since @text, @trivia and @symbol take arguments, enforce parens for
them.

TN: RA22-015
2020-03-16 10:41:18 +01:00
Romain Beguet
0612dde534 RA22-015: Make WithText the default token action. 2020-03-05 17:01:26 +01:00
Romain Beguet
7287f3f275 RA22-015: Fix syntax of token families. 2020-03-05 17:01:26 +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