Skip to content

parser: string literal must not be immediately followed by suffix##496

Merged
Kijewski merged 1 commit intoaskama-rs:masterfrom
Kijewski:5353647120908288
Jun 21, 2025
Merged

parser: string literal must not be immediately followed by suffix##496
Kijewski merged 1 commit intoaskama-rs:masterfrom
Kijewski:5353647120908288

Conversation

@Kijewski
Copy link
Copy Markdown
Member

@Kijewski Kijewski requested a review from GuillaumeGomez June 21, 2025 14:56
@Kijewski Kijewski added bug Something isn't working fuzzing error A bug found by fuzzing parser Related to the parser labels Jun 21, 2025
Comment thread askama_parser/src/lib.rs Outdated
fn not_suffix_with_hash<'a>(i: &mut &'a str) -> ParseResult<'a, ()> {
if let Some(suffix) = opt((identifier, '#').take()).parse_next(i)? {
return Err(winnow::error::ErrMode::Cut(ErrorContext::new(
"a space is missing to tell suffix and prefix apart",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me a while to understand this error message. We should mention it's about a string literal and also give an example of what we suggest (between parens (like `r##"" ##`).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that we cannot really tell what the user wanted to write, only that somewhere a space is missing. Is it a suffixed string or a prefixed string? I hope that if the user sees the error message they know what they wanted to write. :)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this message still needs to be improved. Open to suggestions. 😆

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"dear user, what do you even mean by that?"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good enough for me me! 🤣

@GuillaumeGomez
Copy link
Copy Markdown
Collaborator

Message is better so let's go. :)

@Kijewski Kijewski merged commit 76b26cd into askama-rs:master Jun 21, 2025
42 checks passed
@Kijewski Kijewski deleted the 5353647120908288 branch June 21, 2025 17:43
@Kijewski Kijewski mentioned this pull request Jun 21, 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 fuzzing error A bug found by fuzzing parser Related to the parser

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants