difftreelog
fix make yaml bare-key safe list closer to original impl
in: master
2 files changed
cmds/jrsonnet/src/main.rsdiffbeforeafterboth23 /// Target shell name23 /// Target shell name24 shell: Shell,24 shell: Shell,25 },25 },26 Deps {27 path: String,28 },26}29}273028#[derive(Parser)]31#[derive(Parser)]838684 if let Some(sub) = opts.sub {87 if let Some(sub) = opts.sub {85 match sub {88 match sub {89 SubOpts::Deps { path } => todo!(),86 SubOpts::Generate { shell } => {90 SubOpts::Generate { shell } => {87 use clap_complete::generate;91 use clap_complete::generate;88 let app = &mut Opts::command();92 let app = &mut Opts::command();crates/jrsonnet-stdlib/src/manifest/yaml.rsdiffbeforeafterboth--- a/crates/jrsonnet-stdlib/src/manifest/yaml.rs
+++ b/crates/jrsonnet-stdlib/src/manifest/yaml.rs
@@ -79,12 +79,16 @@
|| string.contains(|c| matches!(c, ':' | '{' | '}' | '[' | ']' | ',' | '#' | '`' | '\"' | '\'' | '\\' | '\0'..='\x06' | '\t' | '\n' | '\r' | '\x0e'..='\x1a' | '\x1c'..='\x1f'))
|| [
// http://yaml.org/type/bool.html
- // Note: 'y', 'Y', 'n', 'N', is not quoted deliberately, as in libyaml. PyYAML also parse
- // them as string, not booleans, although it is violating the YAML 1.1 specification.
- // See https://github.com/dtolnay/serde-yaml/pull/83#discussion_r152628088.
"yes", "Yes", "YES", "no", "No", "NO", "True", "TRUE", "true", "False", "FALSE", "false",
"on", "On", "ON", "off", "Off", "OFF", // http://yaml.org/type/null.html
"null", "Null", "NULL", "~",
+ // > Quoted in std.jsonnet, however, in serde_yaml they were quoted:
+ // > Note: 'y', 'Y', 'n', 'N', is not quoted deliberately, as in libyaml. PyYAML also parse
+ // > them as string, not booleans, although it is violating the YAML 1.1 specification.
+ // > See https://github.com/dtolnay/serde-yaml/pull/83#discussion_r152628088.
+ "y", "Y", "n", "N",
+ "-.inf", "+.inf", ".inf",
+ "-", "---", ""
].contains(&string)
|| (string.chars().all(|c| matches!(c, '0'..='9' | '-'))
&& string.chars().filter(|c| *c == '-').count() == 2)