tree-sitter / tree-sitter-javascript

Javascript grammar for tree-sitter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

let a /* >_< */ = 1

vird opened this issue · comments

commented

The following piece of code is valid but it is parsed incorrectly:

let a /* >_< */ = 1

Here's a link to the TypeScript Playground showing that the snippet above is valid JavaScript or TypeScript:

https://www.typescriptlang.org/play?#code/DYUwLgBAhhD0BUEB8B9APBesIF4IEYg

The output of tree-sitter parse is the following:

> tree-sitter-javascript@0.20.2 parse
> tree-sitter parse 6.js

(program [0, 0] - [1, 0]
  (expression_statement [0, 0] - [0, 19]
    (assignment_expression [0, 0] - [0, 19]
      left: (identifier [0, 0] - [0, 3])
      (ERROR [0, 4] - [0, 5]
        (variable_declarator [0, 4] - [0, 5]
          name: (identifier [0, 4] - [0, 5])))
      (comment [0, 6] - [0, 15])
      right: (number [0, 18] - [0, 19]))))
6.js    0 ms    (ERROR [0, 4] - [0, 5])

thanks! sorry for the regression, I'll be adding support for the import attributes soon and fixing the tsx infinite loop bug (which partially needs a change here), so I'll put out a release with this fix then (few hrs?)