Skip to content
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

Improve config delimiters characters check #180

Merged
merged 2 commits into from
Oct 20, 2024

Conversation

GuillaumeGomez
Copy link
Contributor

Finally I have something before the next release. :)

@GuillaumeGomez GuillaumeGomez force-pushed the config-delimiters branch 2 times, most recently from 52a55d3 to fb089fe Compare September 19, 2024 14:54
"> and <+b+>"
--> tests/ui/broken-config.rs:20:21
|
20 | #[template(source = "<+a+> and <+b+>", config = "operator-plus-config.toml", syntax = "plus", ext = "txt")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So in here, the template is perfectly valid but doesn't work. Not sure how to fix that...

Copy link
Collaborator

@Kijewski Kijewski left a comment

Choose a reason for hiding this comment

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

Thank you for the PR! It's much better with your change, to look for an offending character than to enumerate all combinations that could contain this character.

rinja_parser/src/lib.rs Outdated Show resolved Hide resolved
@GuillaumeGomez GuillaumeGomez force-pushed the config-delimiters branch 2 times, most recently from 25cecd0 to daa93c2 Compare October 14, 2024 16:14
@GuillaumeGomez
Copy link
Contributor Author

Finally had some time to update this. I added the missing operators, thanks for the suggestion!

@@ -824,6 +824,15 @@ impl<'a> SyntaxBuilder<'a> {
"delimiters may not contain white spaces. \
The {k} delimiter ({s:?}) contains white spaces",
));
} else if is_closing
&& ['(', ')', '-', '+', '~', '.', '>', '<', '&', '|', '!']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, ) should be fine. We only ever look for ) in conjunction with a (. This way, if someone wants to use e.g. (( expr )) it would still work fine. Sorry that I didn't notice that during my first review!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch!

@GuillaumeGomez
Copy link
Contributor Author

Updated. :)

@Kijewski Kijewski enabled auto-merge October 20, 2024 07:04
Copy link
Collaborator

@Kijewski Kijewski left a comment

Choose a reason for hiding this comment

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

Good work, thanks! :)

@Kijewski Kijewski merged commit f1431a0 into rinja-rs:master Oct 20, 2024
34 checks passed
@GuillaumeGomez GuillaumeGomez deleted the config-delimiters branch October 23, 2024 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants