gleam-lang / tree-sitter-gleam

🌳 A tree-sitter grammar for the Gleam programming language
Apache License 2.0
71 stars 13 forks source link

Fix for comment-in-string bug #27

Closed J3RN closed 2 years ago

J3RN commented 2 years ago

Nodes defined in extras can be expected before an node. Thus, comment could be expected before escape_sequence or quoted_content; aka inside of a string. Naturally, this makes no sense.

I tried wrapping escape_sequence and quoted_content in token.immediate to resolve the issue, but it had no effect (maybe is specific to whitespace?). Instead, I found success in largely copying tree-sitter-rust's solution of using an external scanner for string content.

cc @the-mikedavis

J3RN commented 2 years ago

Great observation @the-mikedavis! Rectified in 935f80f.