-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Description
Please reconsider current rules for quoting scalars:
const bool needs_quotes = (
was_quoted
||
(
( ! s.is_number())
&&
(
// has leading whitespace
s.begins_with_any(" \n\t\r")
||
// looks like reference or anchor or would be treated as a directive
s.begins_with_any("*&%")
||
s.begins_with("<<")
||
// has trailing whitespace
s.ends_with_any(" \n\t\r")
||
// has special chars
(s.first_of("#:-?,\n{}[]'\"") != npos)
)
)
);
List of escaped characters: https://yaml.org/spec/1.2.2/#57-escaped-characters
Plain scalar type: https://yaml.org/spec/1.2.2/#733-plain-style
At least, strings with '-' should not be quoted, there are even examples with such strings in standard.
Metadata
Metadata
Assignees
Labels
No labels