Skip to content

Commit 6e883a2

Browse files
authored
parse use bounds (precise capture syntax) (#252)
* feat: implement parsing of precise capture syntax * chore: tree-sitter generate
1 parent 4130d3b commit 6e883a2

File tree

5 files changed

+93782
-91778
lines changed

5 files changed

+93782
-91778
lines changed

grammar.js

+18-1
Original file line numberDiff line numberDiff line change
@@ -832,9 +832,26 @@ module.exports = grammar({
832832
bounded_type: $ => prec.left(-1, choice(
833833
seq($.lifetime, '+', $._type),
834834
seq($._type, '+', $._type),
835-
seq($._type, '+', $.lifetime),
835+
seq($._type, '+', choice(
836+
$.lifetime,
837+
$.use_bounds,
838+
)),
836839
)),
837840

841+
use_bounds: $ => seq(
842+
'use',
843+
token(prec(1, '<')),
844+
sepBy(
845+
',',
846+
choice(
847+
$.lifetime,
848+
$._type_identifier,
849+
),
850+
),
851+
optional(','),
852+
'>',
853+
),
854+
838855
type_arguments: $ => seq(
839856
token(prec(1, '<')),
840857
sepBy1(',', seq(

src/grammar.json

+98-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/node-types.json

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)