-
Notifications
You must be signed in to change notification settings - Fork 99
Description
Did you check existing issues?
- I have read all the tree-sitter docs if it relates to using the parser
- I have searched the existing issues
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
No response
Describe the bug
Tree-sitter parses an image link  as an inline_link when the image link is followed by 8 more images. 8 images in a row will parse correctly. The first image will be parsed incorrect if a 9th image is added. If a 10th image is added the 2nd image will be parsed incorrectly, etc. Breaking the set of images up into groups of 8 or less by adding empty lines results in a correct tree.
I am not a tree-sitter user save that I am an nvim user. I discovered this using the nvim InspectTree command when trying to figure out a side effect of this bug.
Steps To Reproduce/Bad Parse Tree
Create a markdown file containing 9 or more image links
Parse the file
Inspect the resulting tree.
Expected Behavior/Parse Tree
This is the result when parsing a file containing 9 image lines.
(document ; [0, 0] - [9, 0]
(section ; [0, 0] - [9, 0]
(paragraph ; [0, 0] - [9, 0]
(inline ; [0, 0] - [8, 16]
(inline ; [0, 0] - [8, 16]
(inline_link ; [0, 1] - [0, 16] <=== this is incorrect, it should be (image ; ...
(link_text) ; [0, 2] - [0, 5]
(link_destination)) ; [0, 7] - [0, 15]
(image ; [1, 0] - [1, 16]
(image_description) ; [1, 2] - [1, 5]
(link_destination)) ; [1, 7] - [1, 15]
(image ; [2, 0] - [2, 16]
(image_description) ; [2, 2] - [2, 5]
(link_destination)) ; [2, 7] - [2, 15]
(image ; [3, 0] - [3, 16]
(image_description) ; [3, 2] - [3, 5]
(link_destination)) ; [3, 7] - [3, 15]
(image ; [4, 0] - [4, 16]
(image_description) ; [4, 2] - [4, 5]
(link_destination)) ; [4, 7] - [4, 15]
(image ; [5, 0] - [5, 16]
(image_description) ; [5, 2] - [5, 5]
(link_destination)) ; [5, 7] - [5, 15]
(image ; [6, 0] - [6, 16]
(image_description) ; [6, 2] - [6, 5]
(link_destination)) ; [6, 7] - [6, 15]
(image ; [7, 0] - [7, 16]
(image_description) ; [7, 2] - [7, 5]
(link_destination)) ; [7, 7] - [7, 15]
(image ; [8, 0] - [8, 16]
(image_description) ; [8, 2] - [8, 5]
(link_destination))))))) ; [8, 7] - [8, 15]
The input file contained these lines:









Repro
See above.