84 Commits

Author SHA1 Message Date
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
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
50b4d439e3 Move Symbolization_Result from $.Common to Langkit_Support.Symbols
This type and the associated helpers don't vary from one generated
library to another, so we can naturally hoist it to Langkit_Support.

TN: U118-054
2021-01-25 12:52:15 +01:00
Raphaël AMIARD
fa11d4bdd3 T917-024/SA28-035: Don't use negative ranges for token slocs. 2020-09-21 15:16:26 +02:00
Raphaël AMIARD
eff5ae2cd9 T910-014: Improve App
- Allow just subclassing App.process_unit, by providing a default main
  that iterates on units and calls process_unit on each

- Allow passing args to python App programmatically
2020-09-11 17:54:55 +02:00
Raphaël AMIARD
3b19d67528 SA28-035: Don't store source locations in token data
Instead, compute them lazily from offset data.

This creates a slight breakage in the generated slocs for token with
negative spans. Since there is not much you could do with the end sloc
of a token with a negative span range before, this is considered a
minor breakage.
2020-09-08 16:57:26 +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
6600963d0f dsl_unparse: fix handling for abstract properties
TN: RA22-015
2020-06-23 16:19:45 +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
adaebf3a3a Lkt lowering: handle enum nodes (qualifier ones included)
TN: RA22-015
2020-06-15 16:11:44 +02:00
Pierre-Marie de Rodat
55fe04716e dsl_unparse: fix syntax for qualifier enum nodes
TN: RA22-015
2020-06-12 14:01:11 +02:00
Raphaël AMIARD
a7cd8f3a39 RA22-015: New syntax for enum classes 2020-06-11 17:07:45 +02:00
Pierre-Marie de Rodat
cc52e46c10 Generate and interpret the @@has_abstract_list node annotation
TN: RA22-015
2020-06-11 14:37:13 +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
2b40a5ce99 Lkt: start handling the lowering of nodes
TN: RA22-015
2020-06-11 14:37:13 +02:00
Pierre-Marie de Rodat
ef315c4345 Python API: fix ASTNode.dump_str with Python3
Fixes #353
2020-06-01 17:51:37 +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
d3db6f97a3 dsl_unparse: make the order of fields in New() expressions deterministic
TN: T511-017
2020-05-26 12:33:48 +02:00
Raphaël AMIARD
4e14e1f2b3 RA22-015: don't emit EnvAssoc 2020-05-14 17:07:42 +02:00
Pierre-Marie de Rodat
f352c7a361 Python API: do not dec_ref C array values when coming from struct fields
TN: T423-042
2020-04-28 11:48:45 +02:00