parser: recognize comments in macro calls#487
Conversation
|
I was too lazy to file an issue that explains the error found by the fuzzer. Another option would have been to parse comments, but I don't see when you would need them, we have {{ x!(// }}
) }}:) |
|
I'm not sure it's a good idea, or at least not the right way to handle it. For bigger (rust) macros, it's very common to have code comments to explain what's going on. And for crates like |
91cd838 to
9ad5078
Compare
|
I implemented recognizing comments, but I would still advice against using them. |
| struct InnerLineDoc; | ||
|
|
||
| #[derive(Template)] | ||
| #[template(ext = "html", source = "{{ e!(/*! hello) }}")] |
There was a problem hiding this comment.
What happens for this case:
{{ e!(//)
}}
?
There was a problem hiding this comment.
error: expected
)but found}
The line comment // makes the parser skip the closing paren ), so the next character it sees is }, but it expects ) to close the macro call.
I added tests to ensure that behavior (and found a typo in my implementation this way, oops).
9ad5078 to
750b78c
Compare
|
Thanks a lot! |
Fixes issue https://issues.oss-fuzz.com/issues/425145246