Skip to content

bug: Comma seperated list of precentages is marked as error in @keyframes #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
2 tasks done
vivax3794 opened this issue Feb 6, 2025 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@vivax3794
Copy link

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)

tree-sitter 0.25.1

Describe the bug

Current the grammar expects just one element in keyframe selectors: https://github.com/tree-sitter/tree-sitter-css/blob/master/grammar.js#L89-L92

    keyframe_block: $ => seq(
      choice($.from, $.to, $.integer_value),
      $.block,
    ),

But in fact its valid to provide multiple values.

Steps To Reproduce/Bad Parse Tree

The grammar produces a error on the following input:

@keyframes hello {
    0%, 50% {}
}

(this syntax can also be seen on the MDN keyframes page https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes#when_properties_are_left_out_of_some_keyframes)

(stylesheet [0, 0] - [3, 0]
  (keyframes_statement [0, 0] - [2, 1]
    (keyframes_name [0, 11] - [0, 16])
    (keyframe_block_list [0, 17] - [2, 1]
      (ERROR [1, 4] - [1, 7]
        (integer_value [1, 4] - [1, 6]
          (unit [1, 5] - [1, 6])))
      (keyframe_block [1, 8] - [1, 14]
        (integer_value [1, 8] - [1, 11]
          (unit [1, 10] - [1, 11]))
        (block [1, 12] - [1, 14])))))

Expected Behavior/Parse Tree

I would expect it to parse correct with the keyframe_block containing multiple integer_value nodes

Repro

@keyframes hello {
    0%, 50% {}
}
@vivax3794 vivax3794 added the bug Something isn't working label Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant