Restrict strings beginning with quote should also ending with quote#13131
Restrict strings beginning with quote should also ending with quote#13131WindSoilder merged 7 commits intonushell:mainfrom
Conversation
|
Technically a breaking change. |
|
Are we ready to land this @WindSoilder? |
|
I am not sure if the logic you added @WindSoilder is specific to the case but for your example I think we could find a more specific error message that there is additional text after the closing delimiter. I think otherwise the |
|
@sholderbach Do you have any good suggestions? Python> "asdfa"asdfa
Cell In[1], line 1
"asdfa"asdfa
^
SyntaxError: invalid syntaxRusterror: suffixes on string literals are invalid
--> crates/nu-parser/src/parser.rs:2836:17
|
2836 | let x = "asdfaf"asdfa;
| ^^^^^^^^^^^^^ invalid suffix `asdfa`It seems that they just say something is invalid |
This reverts commit ef8530b.
It adds an additional check inside `parse_string`, and returns `unbalanced quote` if input string is unbalanced
6b51024 to
46e6abe
Compare
|
I think we can slightly improve on the Rust message with "invalid characters after closing delimiter" but only if that is emitted if we previously rule out the "missing closing delimiter" |
|
Thanks! Here are the new error messages: ❯ "asdfasdf"asdfasdf
Error: nu::parser::extra_token_after_closing_delimiter
× Invaild characters after closing delimiter
╭─[entry #1:1:11]
1 │ "asdfasdf"asdfasdf
· ────┬───
· ╰── invalid characters
╰────
help: Try removing them.
❯ 'asdfasd'adsfadf
Error: nu::parser::extra_token_after_closing_delimiter
× Invaild characters after closing delimiter
╭─[entry #2:1:10]
1 │ 'asdfasd'adsfadf
· ───┬───
· ╰── invalid characters
╰────
help: Try removing them. |
|
Are you ready to land this one @WindSoilder? |
|
Yeah, sure. I think it's ok for now |
Description
Closes: #13010
It adds an additional check inside
parse_string, and returnsunbalanced quoteif input string is unbalancedUser-Facing Changes
After this pr, the following is no longer allowed:
Tests + Formatting
Added 1 test