-
Notifications
You must be signed in to change notification settings - Fork 382
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: config: allow comma in bare TOML string
Fixes #5233
- Loading branch information
Showing
1 changed file
with
7 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,9 +63,12 @@ const fn is_bare_char(b: u8) -> bool { | |
| b'>' | b'?' | b'@' | b'\\' | b'^' | b'_' | b'`' | b'|' | b'~' => true, | ||
// there may be an error in integer, float, or date-time, but that's rare | ||
b'+' | b'-' | b'.' | b':' => true, | ||
// comma and equal don't construct a compound value by themselves, but | ||
// they suggest that the value is an inline array or table | ||
b',' | b'=' => false, | ||
// comma doesn't construct a compound value by itself, and it might be | ||
// used in real name #5233 | ||
b',' => true, | ||
// equal doesn't construct a compound value by itself, but it suggest | ||
// that the value is an inline table | ||
b'=' => false, | ||
// unpaired quotes are often typo | ||
b'"' | b'\'' => false, | ||
// symbols that construct an inline array or table | ||
|
@@ -737,6 +740,7 @@ mod tests { | |
// Bare string | ||
assert_eq!(parse("").unwrap().as_str(), Some("")); | ||
assert_eq!(parse("John Doe").unwrap().as_str(), Some("John Doe")); | ||
assert_eq!(parse("Doe, John").unwrap().as_str(), Some("Doe, John")); | ||
assert_eq!( | ||
parse("<[email protected]>").unwrap().as_str(), | ||
Some("<[email protected]>") | ||
|