25 Commits

Author SHA1 Message Date
Pierre-Marie de Rodat
842c61c9f1 Regenerate bootstrap sources 2026-02-12 11:48:42 +00:00
Pierre-Marie de Rodat
15745870c3 Lkt: regenerate bootstrap sources 2026-02-12 11:48:42 +00:00
Killian Perlin
b66eafd4dc Regenerate bootstrap sources 2026-01-29 13:33:06 +00:00
Pierre-Marie de Rodat
63f7bcd73d Regenerate bootstrap sources 2026-01-20 16:03:43 +00:00
Pierre-Marie de Rodat
9a1ffb91f0 Regenerate bootstrap sources 2026-01-20 16:03:43 +00:00
Pierre-Marie de Rodat
58ef2b4385 Regenerate bootstrap sources 2026-01-20 16:03:43 +00:00
Killian Perlin
5e9e82b751 Frontend implementation for query comprehension 2025-11-26 11:08:18 +00:00
Killian Perlin
9c63199a40 Add stream operator support
Update bootstrap
2025-10-30 11:13:02 +01:00
Raphaël AMIARD
354b054174 Allow parsing of any decl in BlockExpr 2025-10-21 13:25:04 +00:00
Raphaël AMIARD
daf063fee3 Refactor lexer/parser rules grammar
* Make the grammar less ambiguous by changing the syntax of the lexer's
  forward declartion from `Foo` to `Foo <- null`

* This in turn allows the sharing of the `decl` grammar rule in the
  grammar, simplifying the grammar and allowing the production of better
  error messages.

* The lexer_decl rule is simplified (lexer_family_decl occured twice)

* GrammarNull is allowed to not have a type suffix
2025-10-21 13:25:04 +00:00
Pierre-Marie de Rodat
37c69d7f80 Lkt: add error recovery to the parsing of block expression
Introduce a new node (`BlockExprClause`) so that:

1. The `;` token belongs to list items in block expressions rather than
   being a separator for that list.

2. The inner expression in block exprs belongs to that list, so that
   there is no `;` token parser that follows the parser for that list.

The conjunction of both points allows us to introduce `skip`/`dont_skip`
parser for error recovery in the parsing of block expressions. The extra
sources that are accepted by the new parser are rejected by the Lkt
frontend.

Note that, due to a Langkit parser bug (likely
eng/libadalang/langkit#652), sometimes there is no parsing error even
though the parse tree contains an error node. This should be addressed
later.
2025-07-09 09:25:10 +00:00
Pierre-Marie de Rodat
a61867e2d5 manage.py: include extension sources + langkit.yaml in bootstrap sources 2025-06-27 12:40:56 +02:00
Raphaël AMIARD
bf4cf11c5a Lktql: Fix some comments 2025-05-23 07:18:07 +00:00
Raphaël AMIARD
932fb6fb1f Significantly refactor the grammar for patterns.
The first iteration was just a relatively basic copy&paste from the LKQL
grammar, that carries a lot of cruft and legacy at this stage. Following
the comments on the initial review for the merge request, it was decided
to take the opportunity to clean the grammar.

* Rename "BasePattern" into "Pattern"
* Remove every pattern abstract intermediate class (ValuePattern and
  NodePattern). The categorizations they introduce is not very useful,
  and they introduce a lot of complexity.
* Rename pattern details
* Remove mentions of "node" patterns, since we want to make the notion
  of matching on a given type more general than just for node types.
* Rename ExtendedNodePattern -> ExtendedPattern, since we might want to
  generalize the notion, and NodeKindPattern was renamed into
  TypePattern already.
* Rewrite most of the docstrings
* Rename Splat -> Ellipsis
* Unify the naming of sub pattern fields (call them all
  `sub_pattern`/`sub_patterns`.
2025-05-23 07:18:07 +00:00
Raphaël AMIARD
eecd91877d Lktql: Add support for patterns in match expressions 2025-05-23 07:18:07 +00:00
Raphaël AMIARD
00bf1a5964 Lktql: Add patterns to the Lkt grammar
Also add some support for unparsing (not complete but good enough for
now)
2025-05-23 07:18:07 +00:00
Remi Segard
fb91422439 Lkt: Add null checks on get_type 2025-05-16 08:15:02 +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
954280b1bd Lkt: cleanly reject the null-conditional operator on cast expressions
`a?.as[T]` would be equivalent to `a.as[T]`, and `a?.as[T].foo` would be
equivalent to `a.as[T]?.foo`, so allowing `a?.as[T]` is not particularly
useful, and is even confusing when combined with the `a.as![T]` form
(semantic of `!` opposed to the one of `?`). Fix the parser to still
correctly analyze this form, but disallow it during the lowering.
2025-03-26 14:02:49 +00:00
Pierre-Marie de Rodat
8aa24c4f0c Lkt: fix the handling of ?.keep[T] expressions
Modify the Lkt KeepExpr node and related parser to correctly parse
`a?.keep[T]` and adapt lowering logic to implement the null-conditional
behavior correctly.
2025-03-26 14:02:49 +00:00
Pierre-Marie de Rodat
38b1e3a6be Lkt: rework the syntax tree to represent null-conditional expressions
Keep track of whether some expression has null-conditional behavior with
`f_null_cond` fields (to note whether `?` is present) rather than
alternative subclasses (`DotExpr`/`NullCondDotExpr`,
`SubscriptExpr`/`NullCondSubscriptExpr`).
2025-03-26 14:02:49 +00:00
Pierre-Marie de Rodat
7940479092 Lkt: use consistent naming for arguments/parameters
Parameters declare the list of arguments that some callable accepts.
2025-03-25 09:08:57 +00:00
Pierre-Marie de Rodat
a923bc4a88 Liblktlang: extend syntax to support generic interfaces in Lkt 2025-02-17 10:41:27 +00:00
Pierre-Marie de Rodat
c9d9e058fa Liblktlang: make LktNode.fetch_prelude public
This will allow `langkit.lkt_lowering` to have easy access to the
prelude's declarations.
2025-02-17 10:41:27 +00:00
Pierre-Marie de Rodat
7bfbc5dc8f Move contrib/lkt to lkt 2025-02-06 09:31:49 +00:00