Fix crash w/ goto_previous_sibling when parent node has leading extra child (#4472)

* Fix crash w/ goto_previous_sibling when parent node has leading extra
child Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>

* Fix lint

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
This commit is contained in:
Max Brunsfeld 2025-05-27 16:56:33 -07:00 committed by GitHub
parent 06537fda83
commit f91255a201
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 90 additions and 46 deletions

View file

@ -0,0 +1,13 @@
======================================
Aliases within the root node
======================================
# this is a comment
foo foo
---
(document
(comment)
(bar)
(foo))

View file

@ -0,0 +1,19 @@
module.exports = grammar({
name: 'aliases_in_root',
extras: $ => [
/\s/,
$.comment,
],
rules: {
document: $ => seq(
alias($.foo, $.bar),
$.foo,
),
foo: $ => "foo",
comment: $ => /#.*/
}
});