Skip to content

bug: Comment causes parsing error #73

@mantou132

Description

@mantou132

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-css

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

No response

Describe the bug

{} in Comment causes parsing error

Steps To Reproduce/Bad Parse Tree

& {
  position: /*${}*/;
}
(stylesheet [0, 0] - [3, 0]
  (rule_set [0, 0] - [2, 1]
    (selectors [0, 0] - [0, 1]
      (nesting_selector [0, 0] - [0, 1]))
    (block [0, 2] - [2, 1]
      (ERROR [1, 2] - [1, 20]
        (tag_name [1, 2] - [1, 10])
        (comment [1, 12] - [1, 19])))))
test.css	Parse:    0.43 ms	    63 bytes/ms	(ERROR [1, 2] - [1, 20])

Expected Behavior/Parse Tree

(stylesheet [0, 0] - [3, 0]
  (rule_set [0, 0] - [2, 1]
    (selectors [0, 0] - [0, 1]
      (nesting_selector [0, 0] - [0, 1]))
    (block [0, 2] - [2, 1]
      (declaration [1, 2] - [1, 20]
        (property_name [1, 2] - [1, 10])
        (comment [1, 12] - [1, 19])
        (integer_value [1, 19] - [1, 19])))))

Repro

See

https://github.com/tree-sitter/tree-sitter-css/pull/52/files

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions