Skip to content

Commit 02da1b2

Browse files
authored
implement range-to patterns (#262)
* implement range-to patterns * chore: tree-sitter generate
1 parent 6e883a2 commit 02da1b2

File tree

5 files changed

+116463
-115549
lines changed

5 files changed

+116463
-115549
lines changed

grammar.js

+21-12
Original file line numberDiff line numberDiff line change
@@ -1454,20 +1454,29 @@ module.exports = grammar({
14541454
$._pattern,
14551455
)),
14561456

1457-
range_pattern: $ => seq(
1458-
choice(
1459-
$._literal_pattern,
1460-
$._path,
1461-
),
1462-
choice(
1463-
seq(
1464-
choice('...', '..=', '..'),
1465-
choice(
1466-
$._literal_pattern,
1467-
$._path,
1457+
range_pattern: $ => choice(
1458+
seq(
1459+
field('left', choice(
1460+
$._literal_pattern,
1461+
$._path,
1462+
)),
1463+
choice(
1464+
seq(
1465+
choice('...', '..=', '..'),
1466+
field('right', choice(
1467+
$._literal_pattern,
1468+
$._path,
1469+
)),
14681470
),
1471+
'..',
14691472
),
1470-
'..',
1473+
),
1474+
seq(
1475+
choice('..=', '..'),
1476+
field('right', choice(
1477+
$._literal_pattern,
1478+
$._path,
1479+
)),
14711480
),
14721481
),
14731482

src/grammar.json

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

src/node-types.json

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

0 commit comments

Comments
 (0)