Himujjal / tree-sitter-svelte

Tree sitter grammar for Svelte
MIT License
77 stars 15 forks source link

each_start_expr cannot parse array of strings #48

Open clarkf opened 6 months ago

clarkf commented 6 months ago

I tried to parse the input from section 6.5 - Group inputs of the svelte tutorial. Emacs' query explorer showed that the query failed, and I was able to reduce it down to a simpler case:

{#each ["a", "b"] as elem}
  {elem}
{/each}

It doesn't seem to fail with a single element, or multiple non-strings ([a, b, c, 1, 2, 3] works fine).

I know this is mostly an neovim focused project, so forgive the parens, but emacs treesit-explore-mode reports the parse result as:

(each_statement
  (each_start_expr { # (special_block_keyword)
   (ERROR (ERROR) " (ERROR) " (ERROR))
   (raw_text_each) (as) (raw_text_expr) })
  (expression { (raw_text_expr) })
  (each_end_expr { / (special_block_keyword) }))

I was able to reproduce this issue (I think) under nivm 0.9.4 and nvim-treesitter 8ae4080. Syntax highlighting got weird, and after a :TSUpdate svelte, the interior of the {#each} was un-highlighted.