tree-sitter / tree-sitter-typescript

TypeScript grammar for tree-sitter
MIT License
332 stars 103 forks source link

bug: parser stuck in infinite loop with multiple open clauses #281

Closed WesleyYue closed 18 minutes ago

WesleyYue commented 4 months ago

Did you check existing issues?

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

Parsing the following code hangs forever on v0.20.5

try {
  console.log("foo");
} catch (err) {
  if (true) {
    console.log("bar");
  } else {
    throw new MyError(a, b

Steps To Reproduce/Bad Parse Tree

No parse tree. Hangs forever.

Expected Behavior/Parse Tree

Expect to not hang :)

Repro

try {
  console.log("foo");
} catch (err) {
  if (true) {
    console.log("bar");
  } else {
    throw new MyError(a, b
wentinghome commented 3 days ago

I run into the same problem , any luck for a fix @WesleyYue ?

Did you check existing issues?

  • [x] I have read all the tree-sitter docs if it relates to using the parser
  • [x] I have searched the existing issues of tree-sitter-typescript

Tree-Sitter CLI Version, if relevant (output of tree-sitter --version)

No response

Describe the bug

Parsing the following code hangs forever on v0.20.5

try {
  console.log("foo");
} catch (err) {
  if (true) {
    console.log("bar");
  } else {
    throw new MyError(a, b

Steps To Reproduce/Bad Parse Tree

No parse tree. Hangs forever.

Expected Behavior/Parse Tree

Expect to not hang :)

Repro

try {
  console.log("foo");
} catch (err) {
  if (true) {
    console.log("bar");
  } else {
    throw new MyError(a, b