Skip to content

Parser Hangs forever Parsing JS Code #322

Closed
@jpulec

Description

@jpulec

Problem

There appears to be some sequences of characters that can cause the parse function to hang indefinitely. Not sure whether or not this should also be reported in tree-sitter-javascript, but this code was previously parsing fine and now causes this issue in both node-tree-sitter and web-tree-sitter.

This behavior was not seen on web-tree-sitter 0.20.8 and appears to have been introduced starting with the 0.21.x versions.

Steps to reproduce

Create a file with the following contents and attempt to parse it, or just drop the following text string into the Treesitter playground.

{ try { } catch { (, e

Expected behavior

This should finish parsing as an ERROR.

Tree-sitter version (tree-sitter --version)

tree-sitter 0.22.6

Operating system/version

Arch Linux 6.8.9-arch1-2 x86_64

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