css and script bodies should be optional
danderson opened this issue · comments
Thanks for writing this parser! I'm using it to make an emacs templ mode, and while working on it I saw that css
and script
functions that have no body get marked as parse errors by treesitter:
css noStyle() {}
script noScript() {}
According to the upstream templ parser, these definitions are valid. Obviously they're a bit useless, but when you're defining a new css/script func, with the current grammar the entire function gets marked as a syntax error briefly while you're typing, until you start writing a body.
I'm still a noob at tree-sitter, but I think a correct fix would be to make the css and script body elements zero-or-one in the grammar?
Oops, sorry, brain fart: css
already accepts empty bodies in the grammar, it's only script
that errors. Sorry!
Hi, thanks for reporting the issue.
I'll look into it.