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

Incorrect string parsing in Go

Open aresler opened this issue 1 year ago • 1 comments

Steps to reproduce:

str1 := "hello world"
  1. Parse the sample above
  2. Check the nodes

Expected:

(source_file (short_var_declaration left: (expression_list (identifier)) right: (expression_list (interpreted_string_literal (interpreted_string_literal_content)))))

Actual:

(source_file (short_var_declaration left: (expression_list (identifier)) right: (expression_list (interpreted_string_literal))))

As you can see, the interpreted_string_literal_content node is missing.

github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82

aresler avatar Dec 16 '24 22:12 aresler

Maybe it's an expected behavior, I'm not sure, but all the other languages I checked had a parent node for the string literal, and a child node for string content. It's helpful to follow a single standard in this case.

aresler avatar Dec 16 '24 22:12 aresler