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:
parent
06537fda83
commit
f91255a201
7 changed files with 90 additions and 46 deletions
13
test/fixtures/test_grammars/aliases_in_root/corpus.txt
vendored
Normal file
13
test/fixtures/test_grammars/aliases_in_root/corpus.txt
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
======================================
|
||||
Aliases within the root node
|
||||
======================================
|
||||
|
||||
# this is a comment
|
||||
foo foo
|
||||
|
||||
---
|
||||
|
||||
(document
|
||||
(comment)
|
||||
(bar)
|
||||
(foo))
|
||||
19
test/fixtures/test_grammars/aliases_in_root/grammar.js
vendored
Normal file
19
test/fixtures/test_grammars/aliases_in_root/grammar.js
vendored
Normal 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: $ => /#.*/
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue