tree-sitter-luadoc
tree-sitter-luadoc copied to clipboard
bug: Line continuations for aliases from LuaCATS Annotations is not parsing
Did you check existing issues?
- [X] I have read all the tree-sitter docs if it relates to using the parser
- [X] I have searched the existing issues
Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)
tree-sitter 0.22.5
Describe the bug
Possibly related to - https://github.com/tree-sitter-grammars/tree-sitter-luadoc/issues/12
There's an example of line continuations in the LuaCATS Annotations page that this parser doesn't currently handle. It's under @alias's examples, here: https://luals.github.io/wiki/annotations/#alias
---@alias DeviceSide
---| '"left"' # The left side of the device
---| '"right"' # The right side of the device
---| '"top"' # The top side of the device
---| '"bottom"' # The bottom side of the device
---| '"front"' # The front side of the device
---| '"back"' # The back side of the device
This same tree parses as expected with llscheck, which further leads me to believe it's a bug.
Steps To Reproduce/Bad Parse Tree
Make a file with
@alias DeviceSide
| '"left"' # The left side of the device
| '"right"' # The right side of the device
| '"top"' # The top side of the device
| '"bottom"' # The bottom side of the device
| '"front"' # The front side of the device
| '"back"' # The back side of the device
Then run tree-sitter parse that_file.lua
Errors with
(documentation [0, 0] - [8, 0]
(alias_annotation [0, 0] - [6, 40]
(identifier [0, 7] - [0, 17])
(ERROR [1, 0] - [6, 1]
(literal_type [1, 2] - [1, 10])
(comment [1, 10] - [1, 40])
(literal_type [2, 2] - [2, 11])
(comment [2, 11] - [2, 42])
(literal_type [3, 2] - [3, 9])
(comment [3, 9] - [3, 38])
(literal_type [4, 2] - [4, 12])
(comment [4, 12] - [4, 44])
(literal_type [5, 2] - [5, 11])
(comment [5, 11] - [5, 42]))
(literal_type [6, 2] - [6, 10])
(comment [6, 10] - [6, 40])))
Expected Behavior/Parse Tree
(documentation [0, 0] - [2, 0]
(alias_annotation [0, 0] - [0, 84]
(identifier [0, 7] - [0, 17])
(union_type [0, 18] - [0, 84]
(literal_type [0, 18] - [0, 26])
(union_type [0, 29] - [0, 84]
(literal_type [0, 29] - [0, 38])
(union_type [0, 41] - [0, 84]
(literal_type [0, 41] - [0, 48])
(union_type [0, 51] - [0, 84]
(literal_type [0, 51] - [0, 61])
(union_type [0, 64] - [0, 84]
(literal_type [0, 64] - [0, 73])
(literal_type [0, 76] - [0, 84]))))))))
or something similar
Repro
tree-sitter parse that_file.lua