Handle multiple top-level alternations correctly

This commit is contained in:
Hendrik van Antwerpen 2022-01-11 18:06:28 +01:00
parent 8b28f3a8c4
commit ec9b00e5c6
2 changed files with 19 additions and 1 deletions

View file

@ -4003,6 +4003,24 @@ fn test_capture_quantifiers() {
(3, "z", CaptureQuantifier::Zero),
],
},
Row {
description: "multiple alternatives",
language: get_language("javascript"),
pattern: r#"
[
(array (identifier) @x)
(function_declaration name: (identifier)+ @x)
]
[
(array (identifier) @x)
(function_declaration name: (identifier)+ @x)
]
"#,
capture_quantifiers: &[
(0, "x", CaptureQuantifier::OneOrMore),
(1, "x", CaptureQuantifier::OneOrMore),
],
},
];
allocations::record(|| {