Skip to content

Commit

Permalink
parse use bounds (precise capture syntax) (#252)
Browse files Browse the repository at this point in the history
* feat: implement parsing of precise capture syntax

* chore: tree-sitter generate
  • Loading branch information
m4rch3n1ng authored Feb 28, 2025
1 parent 4130d3b commit 6e883a2
Show file tree
Hide file tree
Showing 5 changed files with 93,782 additions and 91,778 deletions.
19 changes: 18 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,9 +832,26 @@ module.exports = grammar({
bounded_type: $ => prec.left(-1, choice(
seq($.lifetime, '+', $._type),
seq($._type, '+', $._type),
seq($._type, '+', $.lifetime),
seq($._type, '+', choice(
$.lifetime,
$.use_bounds,
)),
)),

use_bounds: $ => seq(
'use',
token(prec(1, '<')),
sepBy(
',',
choice(
$.lifetime,
$._type_identifier,
),
),
optional(','),
'>',
),

type_arguments: $ => seq(
token(prec(1, '<')),
sepBy1(',', seq(
Expand Down
100 changes: 98 additions & 2 deletions src/grammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions src/node-types.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6e883a2

Please sign in to comment.