tree-sitter-ruby icon indicating copy to clipboard operation
tree-sitter-ruby copied to clipboard

Block comment terminator edge case

Open Will-Sommers opened this issue 3 years ago • 0 comments

Hi y'all,

While working on adding Ruby to cursorless I discovered this edge case bug.

The following code is valid Ruby with block comments requiring the =begin/=end block comment beginning and ending identifiers to be on line start. However, the first =end is erroneously recognized as the block comment terminator.

=begin
hello
world =end
=end

The following program results in the following output:

[program](https://tree-sitter.github.io/tree-sitter/playground#) [0, 0] - [4, 0]
  [comment](https://tree-sitter.github.io/tree-sitter/playground#) [0, 0] - [2, 10]
  [assignment](https://tree-sitter.github.io/tree-sitter/playground#) [2, 10] - [3, 4]
    left: [MISSING identifier](https://tree-sitter.github.io/tree-sitter/playground#) [2, 10] - [2, 10]
    right: [identifier](https://tree-sitter.github.io/tree-sitter/playground#) [3, 1] - [3, 4]

Will-Sommers avatar Feb 28 '22 19:02 Will-Sommers