Skip to content

bug: Infinite loop in tsx parser #323

Open
@macuyler

Description

@macuyler

Did you check existing issues?

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

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

tree-sitter 0.24.6

Describe the bug

When running the tsx parser on input such as the following:

<div style={{ textAlign:>Note: This is important. (And this)</div>

The parser never completes or fails, it seemingly loops forever.

I have successfully reproduced the issue on 8e13e1d.

Steps To Reproduce/Bad Parse Tree

The most basic reproduce case that I could find is:

<a {{b:>c:d(e f)

If you attempt to parse this code with the tsx parser, it will loop forever.

git clone https://github.com/tree-sitter/tree-sitter-typescript
cd tree-sitter-typescript/tsx
echo "<a {{b:>c:d(e f)" > poc.tsx
tree-sitter parse -d poc.tsx

Expected Behavior/Parse Tree

The expected behavior should be a proper parsing failure response.

Repro

<a {{b:>c:d(e f)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions