git.delta.rocks / jrsonnet / refs/commits / 6ae8569845ee

difftreelog

fix make yaml bare-key safe list closer to original impl

Yaroslav Bolyukin2023-04-08parent: #58e35be.patch.diff
in: master

2 files changed

modifiedcmds/jrsonnet/src/main.rsdiffbeforeafterboth
23 /// Target shell name23 /// Target shell name
24 shell: Shell,24 shell: Shell,
25 },25 },
26 Deps {
27 path: String,
28 },
26}29}
2730
28#[derive(Parser)]31#[derive(Parser)]
8386
84 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();
modifiedcrates/jrsonnet-stdlib/src/manifest/yaml.rsdiffbeforeafterboth
79 || string.contains(|c| matches!(c, ':' | '{' | '}' | '[' | ']' | ',' | '#' | '`' | '\"' | '\'' | '\\' | '\0'..='\x06' | '\t' | '\n' | '\r' | '\x0e'..='\x1a' | '\x1c'..='\x1f'))79 || string.contains(|c| matches!(c, ':' | '{' | '}' | '[' | ']' | ',' | '#' | '`' | '\"' | '\'' | '\\' | '\0'..='\x06' | '\t' | '\n' | '\r' | '\x0e'..='\x1a' | '\x1c'..='\x1f'))
80 || [80 || [
81 // http://yaml.org/type/bool.html81 // http://yaml.org/type/bool.html
82 // Note: 'y', 'Y', 'n', 'N', is not quoted deliberately, as in libyaml. PyYAML also parse
83 // them as string, not booleans, although it is violating the YAML 1.1 specification.
84 // See https://github.com/dtolnay/serde-yaml/pull/83#discussion_r152628088.
85 "yes", "Yes", "YES", "no", "No", "NO", "True", "TRUE", "true", "False", "FALSE", "false",82 "yes", "Yes", "YES", "no", "No", "NO", "True", "TRUE", "true", "False", "FALSE", "false",
86 "on", "On", "ON", "off", "Off", "OFF", // http://yaml.org/type/null.html83 "on", "On", "ON", "off", "Off", "OFF", // http://yaml.org/type/null.html
87 "null", "Null", "NULL", "~",84 "null", "Null", "NULL", "~",
85 // > Quoted in std.jsonnet, however, in serde_yaml they were quoted:
86 // > Note: 'y', 'Y', 'n', 'N', is not quoted deliberately, as in libyaml. PyYAML also parse
87 // > them as string, not booleans, although it is violating the YAML 1.1 specification.
88 // > See https://github.com/dtolnay/serde-yaml/pull/83#discussion_r152628088.
89 "y", "Y", "n", "N",
90 "-.inf", "+.inf", ".inf",
91 "-", "---", ""
88 ].contains(&string)92 ].contains(&string)
89 || (string.chars().all(|c| matches!(c, '0'..='9' | '-'))93 || (string.chars().all(|c| matches!(c, '0'..='9' | '-'))
90 && string.chars().filter(|c| *c == '-').count() == 2)94 && string.chars().filter(|c| *c == '-').count() == 2)