Closed elianiva closed 3 years ago
Will look into it later. Looks like something from C side of the parser. That part is a bit complicated, and I am busy with tree-sitter-zig for now. But sure, I will fix this within this week maybe.
Here's the thing. In normal HTML DIV
and div
are basically the same. That also applies to the native LINK
and link
. In the case of the custom parser, the parser was considering Link
, Input
etc which are self-closing tags as link
and input
respectively. It saw that the you have Link
has child elements and thus spurted out errors. That being said, in HTML, SCRIPT
and script
are allowed. This is even the case with Svelte (go, try!).
I fixed this issue. But I swear, HTML is one of the most difficult formats to parse!
BTW. What to do with your PR?
ah, I see. I'll just going to rename my component then, I can see that HTML parser is a PITA :laughing:
Thanks!
Actually you don't have to rename your component. Link
will work just fine. I removed the uppercase/lowercase independence, so people who would write SCRIPT
instead of script
would have to rename the tag to lowercase.
I was writing a HTML/Svelte parser in Zig recently because tree-sitter is a heavy dependency (2 MB) and yes, its a PITA
I noticed that certain component doesn't get parsed correctly, see this scenario for better explanation.
The first element is parsed correctly, it looks like this:
but the second element gets parsed as this: