| 1 | use documentrust-analyzer cargo yaml 0.3.0 document/; |
| 2 | use documentrust-analyzer cargo yaml 0.3.0 document/::{YamlNoderust-analyzer cargo yaml 0.3.0 document/YamlNode#, YamlNodeDatarust-analyzer cargo yaml 0.3.0 document/YamlNodeData#}; |
| 3 | use ffi::{YamlErrorType, YamlScalarStyle}; |
| 4 | use error::{YamlMark, YamlError, YamlErrorContext}; |
| 5 | |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/; |
| 7 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/; |
| 8 | use regexrust-analyzer cargo regex 1.13.1 crate/::Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#; |
| 9 | |
| 10 | pub trait YamlConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#<T, E> { |
| 11 | fn construct_scalarrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct_scalar().(&self, scalar: documentrust-analyzer cargo yaml 0.3.0 document/::YamlScalarDatarust-analyzer cargo yaml 0.3.0 document/YamlScalarData#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E>; |
| 12 | fn construct_sequencerust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct_sequence().(&self, sequence: documentrust-analyzer cargo yaml 0.3.0 document/::YamlSequenceDatarust-analyzer cargo yaml 0.3.0 document/YamlSequenceData#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E>; |
| 13 | fn construct_mappingrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct_mapping().(&self, mapping: documentrust-analyzer cargo yaml 0.3.0 document/::YamlMappingDatarust-analyzer cargo yaml 0.3.0 document/YamlMappingData#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E>; |
| 14 | |
| 15 | fn constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().<'r>(&self, node: documentrust-analyzer cargo yaml 0.3.0 document/::YamlNoderust-analyzer cargo yaml 0.3.0 document/YamlNode#<'r>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E> { |
| 16 | match node { |
| 17 | YamlNoderust-analyzer cargo yaml 0.3.0 document/YamlNode#::YamlScalarNoderust-analyzer cargo yaml 0.3.0 document/YamlNode#YamlScalarNode#(scalar) => self.construct_scalarrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct_scalar().(scalar), |
| 18 | YamlNoderust-analyzer cargo yaml 0.3.0 document/YamlNode#::YamlSequenceNoderust-analyzer cargo yaml 0.3.0 document/YamlNode#YamlSequenceNode#(sequence) => self.construct_sequencerust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct_sequence().(sequence), |
| 19 | YamlNoderust-analyzer cargo yaml 0.3.0 document/YamlNode#::YamlMappingNoderust-analyzer cargo yaml 0.3.0 document/YamlNode#YamlMappingNode#(mapping) => self.construct_mappingrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct_mapping().(mapping) |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 25 | pub enum YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData# { |
| 26 | YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(isize), |
| 27 | YamlFloatrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlFloat#(f64), |
| 28 | YamlStringrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlString#(Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#), |
| 29 | YamlNullrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlNull#, |
| 30 | YamlBoolrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlBool#(bool), |
| 31 | YamlSequencerust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlSequence#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#>), |
| 32 | YamlMappingrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlMapping#(Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#, YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#)>), |
| 33 | } |
| 34 | |
| 35 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 36 | pub struct YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor# { |
| 37 | dec_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#dec_int_pat.:Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#, |
| 38 | oct_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#oct_int_pat.:Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#, |
| 39 | hex_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#hex_int_pat.:Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#, |
| 40 | bin_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#bin_int_pat.:Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#, |
| 41 | flt_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#flt_pat.:Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#, |
| 42 | pos_inf_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#pos_inf_pat.:Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#, |
| 43 | neg_inf_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#neg_inf_pat.:Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#, |
| 44 | nan_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#nan_pat.:Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#, |
| 45 | null_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#null_pat.:Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#, |
| 46 | true_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#true_pat.:Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#, |
| 47 | false_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#false_pat.:Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex# |
| 48 | } |
| 49 | |
| 50 | fn standard_errorrust-analyzer cargo yaml 0.3.0 constructor/standard_error().(message: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, mark: &YamlMarkrust-analyzer cargo yaml 0.3.0 error/YamlMark#) -> YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError# { |
| 51 | let context = YamlErrorContextrust-analyzer cargo yaml 0.3.0 error/YamlErrorContext# { |
| 52 | byte_offsetrust-analyzer cargo yaml 0.3.0 error/YamlErrorContext#byte_offset.: mark.indexrust-analyzer cargo yaml 0.3.0 error/YamlMark#index., |
| 53 | problem_markrust-analyzer cargo yaml 0.3.0 error/YamlErrorContext#problem_mark.: *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().mark, |
| 54 | contextrust-analyzer cargo yaml 0.3.0 error/YamlErrorContext#context.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 55 | context_markrust-analyzer cargo yaml 0.3.0 error/YamlErrorContext#context_mark.: *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().mark, |
| 56 | }; |
| 57 | |
| 58 | YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError# { |
| 59 | kindrust-analyzer cargo yaml 0.3.0 error/YamlError#kind.: YamlErrorTyperust-analyzer cargo yaml 0.3.0 ffi/YamlErrorType#::YAML_PARSER_ERRORrust-analyzer cargo yaml 0.3.0 ffi/YamlErrorType#YAML_PARSER_ERROR#, |
| 60 | problemrust-analyzer cargo yaml 0.3.0 error/YamlError#problem.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(message), |
| 61 | io_errorrust-analyzer cargo yaml 0.3.0 error/YamlError#io_error.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 62 | contextrust-analyzer cargo yaml 0.3.0 error/YamlError#context.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(context) |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | fn takerust-analyzer cargo yaml 0.3.0 constructor/take().(iter: &mut Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#=char>, n: usize) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# |
| 67 | { |
| 68 | let mut s = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 69 | for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#n { |
| 70 | match iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().() { |
| 71 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) => s.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c), |
| 72 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => break |
| 73 | } |
| 74 | } |
| 75 | return s; |
| 76 | } |
| 77 | |
| 78 | impl YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor# { |
| 79 | pub fn newrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]new().() -> YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor# { |
| 80 | YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor# { |
| 81 | dec_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#dec_int_pat.: Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#::newrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]new().(r"^[-+]?(0|[1-9][0-9_]*)$").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 82 | oct_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#oct_int_pat.: Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#::newrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]new().(r"^([-+]?)0o?([0-7_]+)$").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 83 | hex_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#hex_int_pat.: Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#::newrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]new().(r"^([-+]?)0x([0-9a-fA-F_]+)$").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 84 | bin_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#bin_int_pat.: Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#::newrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]new().(r"^([-+]?)0b([0-1_]+)$").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 85 | flt_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#flt_pat.: Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#::newrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]new().(r"^([-+]?)(\.[0-9]+|[0-9]+(\.[0-9]*)?([eE][-+]?[0-9]+)?)$").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 86 | pos_inf_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#pos_inf_pat.: Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#::newrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]new().(r"^[+]?(\.inf|\.Inf|\.INF)$").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 87 | neg_inf_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#neg_inf_pat.: Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#::newrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]new().(r"^-(\.inf|\.Inf|\.INF)$").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 88 | nan_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#nan_pat.: Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#::newrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]new().(r"^(\.nan|\.NaN|\.NAN)$").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 89 | null_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#null_pat.: Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#::newrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]new().(r"^(null|Null|NULL|~)$").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 90 | true_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#true_pat.: Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#::newrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]new().(r"^(true|True|TRUE|yes|Yes|YES)$").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 91 | false_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#false_pat.: Regexrust-analyzer cargo regex 1.13.1 regex/string/Regex#::newrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]new().(r"^(false|False|FALSE|no|No|NO)$").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().() |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | fn parse_double_quotedrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]parse_double_quoted().(value: &str, mark: &YamlMarkrust-analyzer cargo yaml 0.3.0 error/YamlMark#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#, YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 96 | let mut buf = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 97 | let mut it = value.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().(); |
| 98 | |
| 99 | loop { |
| 100 | match it.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().() { |
| 101 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(buf), |
| 102 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('\\') => { |
| 103 | // escape sequences |
| 104 | match it.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Chars<'a>`][Iterator]next().() { |
| 105 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(standard_errorrust-analyzer cargo yaml 0.3.0 constructor/standard_error().( |
| 106 | "unexpected end of string after escape".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().(), |
| 107 | mark |
| 108 | )), |
| 109 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('0') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\x00'), // null |
| 110 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('a') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\x07'), // ASCII bell |
| 111 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('b') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\x08'), // backspace |
| 112 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('t') | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('\t') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\t'), // horizontal tab |
| 113 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('n') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\n'), // linefeed |
| 114 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('v') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\x0b'), // vertical tab |
| 115 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('f') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\x0c'), // form feed |
| 116 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('r') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\x0d'), // carriage return |
| 117 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('e') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\x1b'), // ASCII escape |
| 118 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('N') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\u{85}'), // unicode next line |
| 119 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('_') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\u{a0}'), // unicode non-breaking space |
| 120 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('L') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\u{2028}'), // unicode line separator |
| 121 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('P') => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().('\u{2029}'), // unicode paragraph separator |
| 122 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('x') => { |
| 123 | let code:Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = takerust-analyzer cargo yaml 0.3.0 constructor/take().(&mut it, 2); |
| 124 | match parse_escape_sequencerust-analyzer cargo yaml 0.3.0 constructor/parse_escape_sequence().(&code[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()., 2) { |
| 125 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c), |
| 126 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(standard_errorrust-analyzer cargo yaml 0.3.0 constructor/standard_error().( |
| 127 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("invalid escape sequence {}", code), |
| 128 | mark |
| 129 | )) |
| 130 | } |
| 131 | }, |
| 132 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('u') => { |
| 133 | let code:Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = takerust-analyzer cargo yaml 0.3.0 constructor/take().(&mut it, 4); |
| 134 | match parse_escape_sequencerust-analyzer cargo yaml 0.3.0 constructor/parse_escape_sequence().(&code[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()., 4) { |
| 135 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c), |
| 136 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(standard_errorrust-analyzer cargo yaml 0.3.0 constructor/standard_error().( |
| 137 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("invalid escape sequence {}", code), |
| 138 | mark |
| 139 | )) |
| 140 | } |
| 141 | }, |
| 142 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#('U') => { |
| 143 | let code:Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = takerust-analyzer cargo yaml 0.3.0 constructor/take().(&mut it, 8); |
| 144 | match parse_escape_sequencerust-analyzer cargo yaml 0.3.0 constructor/parse_escape_sequence().(&code[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()., 8) { |
| 145 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c), |
| 146 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(standard_errorrust-analyzer cargo yaml 0.3.0 constructor/standard_error().( |
| 147 | formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("invalid escape sequence {}", code), |
| 148 | mark |
| 149 | )) |
| 150 | } |
| 151 | }, |
| 152 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c) |
| 153 | } |
| 154 | }, |
| 155 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(c) => buf.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push().(c) |
| 156 | } |
| 157 | } |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | fn parse_escape_sequencerust-analyzer cargo yaml 0.3.0 constructor/parse_escape_sequence().(rep: &str, expected_len: usize) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<char> { |
| 162 | match u32::from_str_radixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]from_str_radix().(rep, 16) { |
| 163 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(code) if rep.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]eq().expected_len => charrust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/::from_u32rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/from_u32().(code), |
| 164 | _ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | fn parse_intrust-analyzer cargo yaml 0.3.0 constructor/parse_int().(sign: &str, data: &str, radix: u32) -> isize { |
| 169 | let sign_flag = if sign rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."-" { |
| 170 | -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][Neg]neg().1 |
| 171 | } else { |
| 172 | 1 |
| 173 | }; |
| 174 | |
| 175 | let filtered:Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = data.charsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]chars().().filterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#filter().(|&c| c rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[char][`PartialEq<Self>`]ne().'_').collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 176 | let unsigned:isize = isize::from_str_radixrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[isize]from_str_radix().(&filtered[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()., radix).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 177 | return unsigned rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][`Mul<Self>`]mul().sign_flag; |
| 178 | } |
| 179 | |
| 180 | fn parse_floatrust-analyzer cargo yaml 0.3.0 constructor/parse_float().(sign: &str, data: &str) -> f64 { |
| 181 | let unsigned:f64 = data.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 182 | if sign rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."-" { |
| 183 | return -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][Neg]neg().unsigned; |
| 184 | } else { |
| 185 | return unsigned; |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | impl YamlConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#<YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#, YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> for YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor# { |
| 190 | fn construct_scalarrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor][`YamlConstructor<YamlStandardData, YamlError>`]construct_scalar().(&self, scalar: documentrust-analyzer cargo yaml 0.3.0 document/::YamlScalarDatarust-analyzer cargo yaml 0.3.0 document/YamlScalarData#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#, YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 191 | let value = scalar.get_valuerust-analyzer cargo yaml 0.3.0 document/impl#[`YamlScalarData<'r>`]get_value().(); |
| 192 | let mark = scalar.start_markrust-analyzer cargo yaml 0.3.0 document/YamlNodeData#start_mark().(); |
| 193 | |
| 194 | match scalar.stylerust-analyzer cargo yaml 0.3.0 document/impl#[`YamlScalarData<'r>`]style().() { |
| 195 | YamlScalarStylerust-analyzer cargo yaml 0.3.0 ffi/YamlScalarStyle#::YamlPlainScalarStylerust-analyzer cargo yaml 0.3.0 ffi/YamlScalarStyle#YamlPlainScalarStyle# => { |
| 196 | match self.bin_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#bin_int_pat..capturesrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]captures().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) { |
| 197 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(caps) => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(parse_intrust-analyzer cargo yaml 0.3.0 constructor/parse_int().( |
| 198 | &caps[rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index().1]rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index()., &caps[rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index().2]rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index()., 2))), |
| 199 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => () |
| 200 | }; |
| 201 | match self.oct_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#oct_int_pat..capturesrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]captures().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) { |
| 202 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(caps) => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(parse_intrust-analyzer cargo yaml 0.3.0 constructor/parse_int().( |
| 203 | &caps[rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index().1]rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index()., &caps[rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index().2]rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index()., 8))), |
| 204 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => () |
| 205 | }; |
| 206 | match self.hex_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#hex_int_pat..capturesrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]captures().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) { |
| 207 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(caps) => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(parse_intrust-analyzer cargo yaml 0.3.0 constructor/parse_int().( |
| 208 | &caps[rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index().1]rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index()., &caps[rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index().2]rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index()., 16))), |
| 209 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => () |
| 210 | }; |
| 211 | |
| 212 | if self.dec_int_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#dec_int_pat..is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) { |
| 213 | return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(parse_intrust-analyzer cargo yaml 0.3.0 constructor/parse_int().("", &value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()., 10))); |
| 214 | } |
| 215 | |
| 216 | match self.flt_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#flt_pat..capturesrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]captures().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) { |
| 217 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(caps) => return Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlFloatrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlFloat#(parse_floatrust-analyzer cargo yaml 0.3.0 constructor/parse_float().( |
| 218 | &caps[rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index().1]rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index()., &caps[rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index().2]rust-analyzer cargo regex 1.13.1 regex/string/impl#[`Captures<'h>`][`Index<usize>`]index().))), |
| 219 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => () |
| 220 | }; |
| 221 | |
| 222 | if self.pos_inf_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#pos_inf_pat..is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) { |
| 223 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlFloatrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlFloat#(f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/::INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/INFINITY.)) |
| 224 | } else if self.neg_inf_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#neg_inf_pat..is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) { |
| 225 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlFloatrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlFloat#(f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/::NEG_INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/NEG_INFINITY.)) |
| 226 | } else if self.nan_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#nan_pat..is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) { |
| 227 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlFloatrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlFloat#(f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/::NANrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/NAN.)) |
| 228 | } else if self.null_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#null_pat..is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) { |
| 229 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlNullrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlNull#) |
| 230 | } else if self.true_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#true_pat..is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) { |
| 231 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlBoolrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlBool#(true)) |
| 232 | } else if self.false_patrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#false_pat..is_matchrust-analyzer cargo regex 1.13.1 regex/string/impl#[Regex]is_match().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index().) { |
| 233 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlBoolrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlBool#(false)) |
| 234 | } else { |
| 235 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlStringrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlString#(value)) |
| 236 | } |
| 237 | }, |
| 238 | YamlScalarStylerust-analyzer cargo yaml 0.3.0 ffi/YamlScalarStyle#::YamlDoubleQuotedScalarStylerust-analyzer cargo yaml 0.3.0 ffi/YamlScalarStyle#YamlDoubleQuotedScalarStyle# => { |
| 239 | YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#::parse_double_quotedrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]parse_double_quoted().(&value[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`Index<I>`]index()., &mark).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlStringrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlString#) |
| 240 | }, |
| 241 | _ => { |
| 242 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlStringrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlString#(value)) |
| 243 | } |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | fn construct_sequencerust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor][`YamlConstructor<YamlStandardData, YamlError>`]construct_sequence().(&self, sequence: documentrust-analyzer cargo yaml 0.3.0 document/::YamlSequenceDatarust-analyzer cargo yaml 0.3.0 document/YamlSequenceData#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#, YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 248 | let res:Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#>, YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> = sequence.valuesrust-analyzer cargo yaml 0.3.0 document/impl#[`YamlSequenceData<'r>`]values().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|node| { self.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(node) }).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 249 | res.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|list| YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlSequencerust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlSequence#(list)) |
| 250 | } |
| 251 | |
| 252 | fn construct_mappingrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor][`YamlConstructor<YamlStandardData, YamlError>`]construct_mapping().(&self, mapping: documentrust-analyzer cargo yaml 0.3.0 document/::YamlMappingDatarust-analyzer cargo yaml 0.3.0 document/YamlMappingData#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#, YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 253 | let pairs = mapping.pairsrust-analyzer cargo yaml 0.3.0 document/impl#[`YamlMappingData<'r>`]pairs().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|(key_node, value_node)| { |
| 254 | match self.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(key_node) { |
| 255 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(key) => match self.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(value_node) { |
| 256 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(value) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#((key, value)), |
| 257 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) |
| 258 | }, |
| 259 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) |
| 260 | } |
| 261 | }); |
| 262 | let res:Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#, YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#)>, YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> = pairs.collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 263 | res.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::YamlMappingrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlMapping#) |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | #[cfg(test)] |
| 268 | mod testrust-analyzer cargo yaml 0.3.0 constructor/test/ { |
| 269 | use superrust-analyzer cargo yaml 0.3.0 constructor/::YamlStandardDatarust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#::*; |
| 270 | use parser::{YamlParser, YamlByteParser}; |
| 271 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/; |
| 272 | use ffi::YamlEncoding::YamlUtf8Encoding; |
| 273 | use constructor::{YamlConstructor, YamlStandardConstructor}; |
| 274 | |
| 275 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 276 | fn test_standard_constructorrust-analyzer cargo yaml 0.3.0 constructor/test/test_standard_constructor().() { |
| 277 | let data = "[1, 2, 3]"; |
| 278 | let parser = YamlByteParserrust-analyzer cargo yaml 0.3.0 parser/YamlByteParser#::initrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlByteParser<'r>`]init().(data.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), YamlUtf8Encodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#YamlUtf8Encoding#); |
| 279 | |
| 280 | match parser.loadrust-analyzer cargo yaml 0.3.0 parser/YamlParser#load().().nextrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlDocumentStream<P>`][Iterator]next().() { |
| 281 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(doc)) => { |
| 282 | let ctor = YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#::newrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]new().(); |
| 283 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlSequencerust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlSequence#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(1), YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(2), YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(3)])), ctor.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(doc.rootrust-analyzer cargo yaml 0.3.0 document/impl#[YamlDocument]root().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())) |
| 284 | }, |
| 285 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("unexpected result") |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 290 | fn test_integer_parserrust-analyzer cargo yaml 0.3.0 constructor/test/test_integer_parser().() { |
| 291 | let data = "[0o10, 0x21, -30]"; |
| 292 | let parser = YamlByteParserrust-analyzer cargo yaml 0.3.0 parser/YamlByteParser#::initrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlByteParser<'r>`]init().(data.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), YamlUtf8Encodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#YamlUtf8Encoding#); |
| 293 | |
| 294 | match parser.loadrust-analyzer cargo yaml 0.3.0 parser/YamlParser#load().().nextrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlDocumentStream<P>`][Iterator]next().() { |
| 295 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(doc)) => { |
| 296 | let ctor = YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#::newrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]new().(); |
| 297 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlSequencerust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlSequence#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(0o10), YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(0x21), YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][Neg]neg().30)])), ctor.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(doc.rootrust-analyzer cargo yaml 0.3.0 document/impl#[YamlDocument]root().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())) |
| 298 | }, |
| 299 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("unexpected result") |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 304 | fn test_float_parserrust-analyzer cargo yaml 0.3.0 constructor/test/test_float_parser().() { |
| 305 | let data = "[0.3, -.4, 1e+2, -1.2e-3]"; |
| 306 | let parser = YamlByteParserrust-analyzer cargo yaml 0.3.0 parser/YamlByteParser#::initrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlByteParser<'r>`]init().(data.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), YamlUtf8Encodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#YamlUtf8Encoding#); |
| 307 | |
| 308 | match parser.loadrust-analyzer cargo yaml 0.3.0 parser/YamlParser#load().().nextrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlDocumentStream<P>`][Iterator]next().() { |
| 309 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(doc)) => { |
| 310 | let ctor = YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#::newrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]new().(); |
| 311 | let value = ctor.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(doc.rootrust-analyzer cargo yaml 0.3.0 document/impl#[YamlDocument]root().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().()); |
| 312 | match value { |
| 313 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlSequencerust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlSequence#(seq)) => { |
| 314 | match &seq[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFull#]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). { |
| 315 | &[YamlFloatrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlFloat#(f1), YamlFloatrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlFloat#(f2), YamlFloatrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlFloat#(f3), YamlFloatrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlFloat#(f4)] => { |
| 316 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!((f1 -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). 0.3).absrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/impl#[f64]abs().() <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]lt(). 1.0e-6); |
| 317 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!((f2 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Add<Self>`]add(). 0.4) <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]lt(). 1.0e-6); |
| 318 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!((f3 -rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Sub<Self>`]sub(). 1e+2) <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]lt(). 1.0e-6); |
| 319 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!((f4 +rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[f64][`Add<Self>`]add(). 1.2e-3) <rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[f64][`PartialOrd<Self>`]lt(). 1.0e-6); |
| 320 | }, |
| 321 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("unexpected sequence") |
| 322 | } |
| 323 | }, |
| 324 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("unexpected result") |
| 325 | } |
| 326 | }, |
| 327 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("document parse failure") |
| 328 | } |
| 329 | } |
| 330 | |
| 331 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 332 | fn test_inf_parserrust-analyzer cargo yaml 0.3.0 constructor/test/test_inf_parser().() { |
| 333 | let data = "[.inf, -.INF]"; |
| 334 | let parser = YamlByteParserrust-analyzer cargo yaml 0.3.0 parser/YamlByteParser#::initrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlByteParser<'r>`]init().(data.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), YamlUtf8Encodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#YamlUtf8Encoding#); |
| 335 | |
| 336 | match parser.loadrust-analyzer cargo yaml 0.3.0 parser/YamlParser#load().().nextrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlDocumentStream<P>`][Iterator]next().() { |
| 337 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(doc)) => { |
| 338 | let ctor = YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#::newrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]new().(); |
| 339 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlSequencerust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlSequence#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![YamlFloatrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlFloat#(f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/::INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/INFINITY.), YamlFloatrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlFloat#(f64rust-analyzer cargo std https://github.com/rust-lang/rust/library/std f64/::NEG_INFINITYrust-analyzer cargo core https://github.com/rust-lang/rust/library/core f64/NEG_INFINITY.)])), ctor.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(doc.rootrust-analyzer cargo yaml 0.3.0 document/impl#[YamlDocument]root().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())) |
| 340 | }, |
| 341 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("document parse failure") |
| 342 | } |
| 343 | } |
| 344 | |
| 345 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 346 | fn test_misc_parserrust-analyzer cargo yaml 0.3.0 constructor/test/test_misc_parser().() { |
| 347 | let data = "[yes, False, ~]"; |
| 348 | let parser = YamlByteParserrust-analyzer cargo yaml 0.3.0 parser/YamlByteParser#::initrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlByteParser<'r>`]init().(data.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), YamlUtf8Encodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#YamlUtf8Encoding#); |
| 349 | |
| 350 | match parser.loadrust-analyzer cargo yaml 0.3.0 parser/YamlParser#load().().nextrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlDocumentStream<P>`][Iterator]next().() { |
| 351 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(doc)) => { |
| 352 | let ctor = YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#::newrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]new().(); |
| 353 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlSequencerust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlSequence#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![YamlBoolrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlBool#(true), YamlBoolrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlBool#(false), YamlNullrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlNull#])), ctor.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(doc.rootrust-analyzer cargo yaml 0.3.0 document/impl#[YamlDocument]root().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())) |
| 354 | }, |
| 355 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("document parse failure") |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 360 | fn test_double_quoted_parserrust-analyzer cargo yaml 0.3.0 constructor/test/test_double_quoted_parser().() { |
| 361 | let data = r#""hello, \"world\"""#; |
| 362 | let parser = YamlByteParserrust-analyzer cargo yaml 0.3.0 parser/YamlByteParser#::initrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlByteParser<'r>`]init().(data.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), YamlUtf8Encodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#YamlUtf8Encoding#); |
| 363 | |
| 364 | match parser.loadrust-analyzer cargo yaml 0.3.0 parser/YamlParser#load().().nextrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlDocumentStream<P>`][Iterator]next().() { |
| 365 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(doc)) => { |
| 366 | let ctor = YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#::newrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]new().(); |
| 367 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStringrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlString#("hello, \"world\"".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), ctor.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(doc.rootrust-analyzer cargo yaml 0.3.0 document/impl#[YamlDocument]root().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())) |
| 368 | }, |
| 369 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("document parse failure") |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 374 | fn test_single_quoted_parserrust-analyzer cargo yaml 0.3.0 constructor/test/test_single_quoted_parser().() { |
| 375 | let data = r#"'here''s to "quotes"'"#; |
| 376 | let parser = YamlByteParserrust-analyzer cargo yaml 0.3.0 parser/YamlByteParser#::initrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlByteParser<'r>`]init().(data.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), YamlUtf8Encodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#YamlUtf8Encoding#); |
| 377 | |
| 378 | match parser.loadrust-analyzer cargo yaml 0.3.0 parser/YamlParser#load().().nextrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlDocumentStream<P>`][Iterator]next().() { |
| 379 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(doc)) => { |
| 380 | let ctor = YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#::newrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]new().(); |
| 381 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlStringrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlString#(r#"here's to "quotes""#.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().())), ctor.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(doc.rootrust-analyzer cargo yaml 0.3.0 document/impl#[YamlDocument]root().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())) |
| 382 | }, |
| 383 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("document parse failure") |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 388 | fn test_underlined_integerrust-analyzer cargo yaml 0.3.0 constructor/test/test_underlined_integer().() { |
| 389 | let data = "[1_000, -2_000_000]"; |
| 390 | let parser = YamlByteParserrust-analyzer cargo yaml 0.3.0 parser/YamlByteParser#::initrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlByteParser<'r>`]init().(data.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), YamlUtf8Encodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#YamlUtf8Encoding#); |
| 391 | |
| 392 | match parser.loadrust-analyzer cargo yaml 0.3.0 parser/YamlParser#load().().nextrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlDocumentStream<P>`][Iterator]next().() { |
| 393 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(doc)) => { |
| 394 | let ctor = YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#::newrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]new().(); |
| 395 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlSequencerust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlSequence#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(1000), YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][Neg]neg().2000000)])), ctor.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(doc.rootrust-analyzer cargo yaml 0.3.0 document/impl#[YamlDocument]root().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())) |
| 396 | }, |
| 397 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("document parse failure") |
| 398 | } |
| 399 | } |
| 400 | |
| 401 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 402 | fn test_negative_radixrust-analyzer cargo yaml 0.3.0 constructor/test/test_negative_radix().() { |
| 403 | let data = "[-0x30, -0700, -0b110]"; |
| 404 | let parser = YamlByteParserrust-analyzer cargo yaml 0.3.0 parser/YamlByteParser#::initrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlByteParser<'r>`]init().(data.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().(), YamlUtf8Encodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#YamlUtf8Encoding#); |
| 405 | |
| 406 | match parser.loadrust-analyzer cargo yaml 0.3.0 parser/YamlParser#load().().nextrust-analyzer cargo yaml 0.3.0 parser/impl#[`YamlDocumentStream<P>`][Iterator]next().() { |
| 407 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(doc)) => { |
| 408 | let ctor = YamlStandardConstructorrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardConstructor#::newrust-analyzer cargo yaml 0.3.0 constructor/impl#[YamlStandardConstructor]new().(); |
| 409 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(YamlSequencerust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlSequence#(vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][Neg]neg().48), YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][Neg]neg().448), YamlIntegerrust-analyzer cargo yaml 0.3.0 constructor/YamlStandardData#YamlInteger#(-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[isize][Neg]neg().6)])), ctor.constructrust-analyzer cargo yaml 0.3.0 constructor/YamlConstructor#construct().(doc.rootrust-analyzer cargo yaml 0.3.0 document/impl#[YamlDocument]root().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().())) |
| 410 | }, |
| 411 | _ => panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("document parse failure") |
| 412 | } |
| 413 | } |
| 414 | } |