Skip to content

bug: Non-local error on single "-" in value #12

@qvalentin

Description

@qvalentin

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

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

No response

Describe the bug

A value consisting of just a single dash, will cause the syntax to raise a non-local error, causing syntax highlighting for the rest of the file to break.

Image

Steps To Reproduce/Bad Parse Tree

hi: test
hi2: -
hi3: test

This is probably not valid yaml.

(ERROR ; [0, 0] - [1, 4]
  (block_mapping_pair ; [0, 0] - [0, 8]
    key: (flow_node ; [0, 0] - [0, 2]
      (plain_scalar ; [0, 0] - [0, 2]
        (string_scalar))) ; [0, 0] - [0, 2]
    value: (flow_node ; [0, 4] - [0, 8]
      (plain_scalar ; [0, 4] - [0, 8]
        (string_scalar)))) ; [0, 4] - [0, 8]
  (block_mapping_pair ; [1, 0] - [1, 4]
    key: (flow_node ; [1, 0] - [1, 3]
      (plain_scalar ; [1, 0] - [1, 3]
        (string_scalar))))) ; [1, 0] - [1, 3]

Expected Behavior/Parse Tree

A local error in the block_mapping_pair node.

Repro

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions