Skip to content

Commit

Permalink
cli: config: allow comma in bare TOML string
Browse files Browse the repository at this point in the history
Fixes #5233
  • Loading branch information
yuja committed Jan 3, 2025
1 parent 641ec52 commit 42d7bea
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]>")
Expand Down

0 comments on commit 42d7bea

Please sign in to comment.