Skip to content

Capture tree-sitter parser syntax errors #89

@0xGeorgii

Description

@0xGeorgii

Tree-sitter is designed to be resilient and parse partial code. When it encounters invalid syntax:

  1. It creates an ERROR node in the Concrete Syntax Tree (CST)
  2. The ERROR node has kind "ERROR"
  3. ERROR nodes are typically not "named" nodes (according to tree-sitter's naming rules)
  4. ERROR nodes can be detected via:
    • node.kind() == "ERROR" (direct check)
    • node.has_error() (check if subtree contains errors)

Metadata

Metadata

Assignees

No one assigned

    Labels

    parserSource code parser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions