From b3797d166a4e143714efc3572c4a3698c20b8c1b Mon Sep 17 00:00:00 2001 From: anweiss <2326106+anweiss@users.noreply.github.com> Date: Thu, 30 Sep 2021 13:10:52 -0400 Subject: [PATCH] faker updates and span refactor --- src/ast.rs | 63 ++++-- src/faker.rs | 201 ++++++++++++++----- src/parser.rs | 112 +++++------ src/parser_tests.rs | 480 ++++++++++++++++++++++---------------------- tests/parser.rs | 184 ++++++++--------- 5 files changed, 577 insertions(+), 463 deletions(-) diff --git a/src/ast.rs b/src/ast.rs index 6fd6b864..114a76b2 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -20,7 +20,8 @@ use alloc::{ /// Starting index, ending index and line number #[cfg(feature = "ast-span")] -pub type Span = (usize, usize, usize); +#[derive(Copy, Clone, Debug, PartialEq, Eq, Default)] +pub struct Span(pub usize, pub usize, pub usize); #[cfg(feature = "ast-comments")] #[derive(Default, Debug, PartialEq, Clone)] @@ -179,7 +180,7 @@ impl<'a> From<&'static str> for Identifier<'a> { ident, socket: Some(SocketPlug::GROUP), #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }; } } @@ -188,7 +189,7 @@ impl<'a> From<&'static str> for Identifier<'a> { ident, socket: Some(SocketPlug::TYPE), #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }; } } @@ -197,7 +198,7 @@ impl<'a> From<&'static str> for Identifier<'a> { ident, socket: None, #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), } } } @@ -513,7 +514,7 @@ impl<'a> Default for GenericParams<'a> { GenericParams { params: Vec::new(), #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), } } } @@ -583,7 +584,7 @@ impl<'a> GenericArgs<'a> { GenericArgs { args: Vec::new(), #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), } } } @@ -670,6 +671,28 @@ impl<'a> Type<'a> { } } +impl<'a> From<&Identifier<'a>> for Type<'a> { + fn from(ident: &Identifier<'a>) -> Self { + Type { + type_choices: vec![TypeChoice { + type1: Type1 { + type2: Type2::Typename { + ident: ident.clone(), + generic_args: None, + span: ident.span, + }, + operator: None, + span: ident.span, + comments_after_type: None, + }, + comments_before_type: None, + comments_after_type: None, + }], + span: ident.span, + } + } +} + /// Type choice #[cfg_attr(target_arch = "wasm32", derive(Serialize))] #[derive(Debug, Clone, PartialEq)] @@ -1521,7 +1544,7 @@ impl<'a> fmt::Display for Type2<'a> { impl<'a> From> for Type2<'a> { fn from(rv: RangeValue<'a>) -> Self { #[cfg(feature = "ast-span")] - let span = (0, 0, 0); + let span = Span::default(); match rv { RangeValue::IDENT(ident) => Type2::Typename { @@ -2877,7 +2900,7 @@ mod tests { leading_comments: None, trailing_comments: None, #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), } .to_string(), "entry1".to_string() @@ -2899,7 +2922,7 @@ mod tests { comments: None, comments_after_colon: None, #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }), entry_type: Type { type_choices: vec![TypeChoice { @@ -2907,24 +2930,24 @@ mod tests { type2: Type2::TextValue { value: "value1".into(), #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }, operator: None, comments_after_type: None, #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }, comments_before_type: None, comments_after_type: None, }], #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }, }), leading_comments: None, trailing_comments: None, #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }, OptionalComma { optional_comma: true, @@ -2941,7 +2964,7 @@ mod tests { comments: None, comments_after_colon: None, #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }), entry_type: Type { type_choices: vec![TypeChoice { @@ -2949,24 +2972,24 @@ mod tests { type2: Type2::TextValue { value: "value2".into(), #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }, operator: None, comments_after_type: None, #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }, comments_before_type: None, comments_after_type: None, }], #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }, }), leading_comments: None, trailing_comments: None, #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }, OptionalComma { optional_comma: true, @@ -2977,10 +3000,10 @@ mod tests { ], comments_before_grpchoice: None, #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), }], #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span::default(), } .to_string(), " key1: \"value1\", key2: \"value2\", ".to_string() diff --git a/src/faker.rs b/src/faker.rs index 8fbaee10..066b0707 100644 --- a/src/faker.rs +++ b/src/faker.rs @@ -37,6 +37,7 @@ pub struct Faker<'a> { pub cddl: &'a CDDL<'a>, pub faked_json: Option, pub map_entries: Option, Type<'a>)>>, + pub array_entries: Option, Type<'a>)>>, } impl<'a> Faker<'a> { @@ -45,41 +46,43 @@ impl<'a> Faker<'a> { cddl, faked_json: None, map_entries: None, + array_entries: None, } } } impl<'a> Visitor<'a, Error> for Faker<'a> { + fn visit_type_groupname_entry( + &mut self, + entry: &TypeGroupnameEntry<'a>, + ) -> visitor::Result { + if let Some(entries) = self.array_entries.as_mut() { + entries.push(( + entry.occur.clone().map(|o| o.occur), + Type::from(&entry.name), + )); + } + + Ok(()) + } + fn visit_value_member_key_entry( &mut self, entry: &ValueMemberKeyEntry<'a>, ) -> visitor::Result { - let occur = entry.occur.clone().map(|o| o.occur); - - if let Some(mk) = &entry.member_key { - match mk { - MemberKey::Bareword { ident, .. } => { - let mut map_entries = HashMap::new(); - map_entries.insert( - ident.ident.to_string(), - (occur.clone(), entry.entry_type.clone()), - ); - - self - .map_entries - .get_or_insert(map_entries) - .insert(ident.ident.to_string(), (occur, entry.entry_type.clone())); - } - MemberKey::Value { value, .. } => { - let mut map_entries = HashMap::new(); - map_entries.insert(value.to_string(), (occur.clone(), entry.entry_type.clone())); - - self - .map_entries - .get_or_insert(map_entries) - .insert(value.to_string(), (occur, entry.entry_type.clone())); + if let Some(entries) = self.map_entries.as_mut() { + let occur = entry.occur.clone().map(|o| o.occur); + + if let Some(mk) = &entry.member_key { + match mk { + MemberKey::Bareword { ident, .. } => { + entries.insert(ident.ident.to_string(), (occur, entry.entry_type.clone())); + } + MemberKey::Value { value, .. } => { + entries.insert(value.to_string(), (occur.clone(), entry.entry_type.clone())); + } + _ => return Ok(()), } - _ => return Ok(()), } } @@ -105,36 +108,122 @@ impl<'a> Visitor<'a, Error> for Faker<'a> { } } Type2::Array { group, .. } => { - let mut f = Faker::new(self.cddl); - f.faked_json = Some(Value::Array(Vec::new())); - f.visit_group(group)?; + self.faked_json = Some(Value::Array(Vec::new())); + self.array_entries = Some(Vec::new()); + self.visit_group(group)?; + + if let Some(array_entries) = &self.array_entries { + if let Some(Value::Array(array)) = self.faked_json.as_mut() { + for (occur, entry) in array_entries.iter() { + if let Some(occur) = occur { + match occur { + Occur::Optional(_) => { + if FFaker.fake::() { + let mut entry_f = Faker::new(self.cddl); + entry_f.visit_type(entry)?; + + if let Some(value) = entry_f.faked_json { + array.push(value); + } + + continue; + } + } + Occur::ZeroOrMore(_) => { + let lower = (0..2).fake::(); + let upper = (0..5).fake::(); + + // If the random lower >= random upper, the random array + // will be empty. + for _ in lower..upper { + let mut entry_f = Faker::new(self.cddl); + entry_f.visit_type(entry)?; + + if let Some(value) = entry_f.faked_json { + array.push(value); + } + } + + // Break due to ambiguity + break; + } + Occur::OneOrMore(_) => { + for _ in 0..(1..5).fake::() { + let mut entry_f = Faker::new(self.cddl); + entry_f.visit_type(entry)?; + + if let Some(value) = entry_f.faked_json { + array.push(value); + } + } + + // Break due to ambiguity + break; + } + Occur::Exact { lower, upper, .. } => { + if let Some(lower) = lower { + if let Some(upper) = upper { + for _ in *lower..*upper { + let mut entry_f = Faker::new(self.cddl); + entry_f.visit_type(entry)?; + + if let Some(value) = entry_f.faked_json { + array.push(value); + } + } + } else { + for _ in *lower..(lower + (0..5).fake::()) { + let mut entry_f = Faker::new(self.cddl); + entry_f.visit_type(entry)?; + + if let Some(value) = entry_f.faked_json { + array.push(value); + } + } + } + } else if let Some(upper) = upper { + for _ in 0..(upper - (0..=*upper).fake::()) { + let mut entry_f = Faker::new(self.cddl); + entry_f.visit_type(entry)?; + + if let Some(value) = entry_f.faked_json { + array.push(value); + } + } + } + } + } + } + } + } + } - self.faked_json = f.faked_json; + self.array_entries = None; } Type2::Map { group, .. } => { - let mut f = Faker::new(self.cddl); - f.faked_json = Some(Value::Object(Map::new())); - f.visit_group(group)?; - - if let Some(map_entries) = f.map_entries { - let mut entries = Map::new(); - for (k, (occur, v)) in map_entries.iter() { - let generate = if let Some(Occur::Optional(_)) = occur { - FFaker.fake::() - } else { - true - }; - - if generate { - let mut entry_f = Faker::new(self.cddl); - entry_f.visit_type(v)?; - - if let Some(value) = entry_f.faked_json { - entries.insert(k.to_string(), value); + self.faked_json = Some(Value::Object(Map::default())); + self.map_entries = Some(HashMap::new()); + self.visit_group(group)?; + + if let Some(map_entries) = &self.map_entries { + if let Some(Value::Object(map)) = self.faked_json.as_mut() { + for (k, (occur, v)) in map_entries.iter() { + let generate = if let Some(Occur::Optional(_)) = occur { + FFaker.fake::() + } else { + true + }; + + if generate { + let mut entry_f = Faker::new(self.cddl); + entry_f.visit_type(v)?; + + if let Some(value) = entry_f.faked_json { + map.insert(k.to_string(), value); + } } } } - self.faked_json = Some(Value::Object(entries)); } self.map_entries = None; @@ -150,11 +239,13 @@ impl<'a> Visitor<'a, Error> for Faker<'a> { Token::TSTR => { let value = FFaker.fake::(); - if let Some(Value::Array(array)) = self.faked_json.as_mut() { - array.push(value.into()); - } else { - self.faked_json = Some(value.into()); - } + // if let Some(Value::Array(array)) = self.faked_json.as_mut() { + // array.push(value.into()); + // } else { + // self.faked_json = Some(value.into()); + // } + + self.faked_json = Some(value.into()); } _ => { self.faked_json = Some(ident.ident.into()); @@ -194,7 +285,7 @@ mod tests { fn test_faker() -> Result<()> { let cddl = indoc!( r#" - a = { 1: { a: { a: [ + tstr ] } } } + a = { a: { a: [ *2 tstr ] } } "# ); diff --git a/src/parser.rs b/src/parser.rs index 90c2135c..2285c12b 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -573,7 +573,7 @@ where self.advance_newline()?; #[cfg(feature = "ast-span")] - let span = ( + let span = Span( begin_rule_range, self.parser_position.range.1, begin_rule_line, @@ -604,7 +604,7 @@ where let t = self.parse_type(None)?; #[cfg(feature = "ast-span")] - let span = ( + let span = Span( begin_rule_range, self.parser_position.range.1, begin_rule_line, @@ -686,7 +686,7 @@ where #[cfg(feature = "ast-comments")] comments_after_type: comments_after_group.clone(), #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_pt_range, self.parser_position.range.1, begin_rule_line, @@ -714,7 +714,7 @@ where #[cfg(feature = "ast-comments")] comments_after_rule, #[cfg(feature = "ast-span")] - span: (begin_rule_range, end_rule_range, begin_rule_line), + span: Span(begin_rule_range, end_rule_range, begin_rule_line), }); } } @@ -741,7 +741,7 @@ where #[cfg(feature = "ast-comments")] comments_after_rule, #[cfg(feature = "ast-span")] - span: (begin_rule_range, end_rule_range, begin_rule_line), + span: Span(begin_rule_range, end_rule_range, begin_rule_line), }) } _ => { @@ -782,7 +782,7 @@ where } #[cfg(feature = "ast-span")] - let span = ( + let span = Span( begin_rule_range, self.parser_position.range.1, begin_rule_line, @@ -903,7 +903,7 @@ where #[cfg(feature = "ast-span")] { let end_range = self.lexer_position.range.1; - generic_params.span = (begin_range, end_range, self.lexer_position.line); + generic_params.span = Span(begin_range, end_range, self.lexer_position.line); } Ok(generic_params) @@ -973,7 +973,7 @@ where #[cfg(feature = "ast-span")] { - generic_args.span = ( + generic_args.span = Span( begin_generic_arg_range, self.parser_position.range.1, begin_generic_arg_line, @@ -1003,7 +1003,7 @@ where let mut t = Type { type_choices: Vec::new(), #[cfg(feature = "ast-span")] - span: (begin_type_range, 0, self.parser_position.line), + span: Span(begin_type_range, 0, self.parser_position.line), }; #[cfg(feature = "ast-comments")] @@ -1102,7 +1102,7 @@ where }; #[cfg(feature = "ast-span")] - let mut span = ( + let mut span = Span( begin_type1_range, self.lexer_position.range.1, begin_type1_line, @@ -1142,7 +1142,7 @@ where #[cfg(feature = "ast-span")] { - span = ( + span = Span( begin_type1_range, self.parser_position.range.1, begin_type1_line, @@ -1204,7 +1204,7 @@ where } #[cfg(feature = "ast-span")] - let span = ( + let span = Span( self.parser_position.range.0, self.parser_position.range.1, self.parser_position.line, @@ -1291,7 +1291,7 @@ where ident, generic_args: Some(ga), #[cfg(feature = "ast-span")] - span: (begin_type2_range, end_type2_range, begin_type2_line), + span: Span(begin_type2_range, end_type2_range, begin_type2_line), }); } @@ -1305,7 +1305,7 @@ where ident: self.identifier_from_ident_token(*ident), generic_args: None, #[cfg(feature = "ast-span")] - span: ( + span: Span( self.parser_position.range.0, self.parser_position.range.1, self.parser_position.line, @@ -1348,7 +1348,7 @@ where comments_after_type, pt, #[cfg(feature = "ast-span")] - span: ( + span: Span( self.parser_position.range.0, self.parser_position.range.1, self.parser_position.line, @@ -1380,7 +1380,7 @@ where }; #[cfg(feature = "ast-span")] - let span = ( + let span = Span( begin_type2_range, self.lexer_position.range.1, begin_type2_line, @@ -1430,7 +1430,7 @@ where }; #[cfg(feature = "ast-span")] - let span = ( + let span = Span( begin_type2_range, self.lexer_position.range.1, begin_type2_line, @@ -1479,7 +1479,7 @@ where ident, generic_args: Some(self.parse_genericargs()?), #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span(0, 0, 0), }); } @@ -1489,7 +1489,7 @@ where ident, generic_args: None, #[cfg(feature = "ast-span")] - span: (0, 0, 0), + span: Span(0, 0, 0), }); } @@ -1542,7 +1542,7 @@ where #[cfg(feature = "ast-comments")] comments_after_group, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_type2_range, self.parser_position.range.1, begin_type2_line, @@ -1562,7 +1562,7 @@ where ident, generic_args, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_type2_range, self.parser_position.range.1, begin_type2_line, @@ -1581,7 +1581,7 @@ where ident, generic_args: None, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_type2_range, self.parser_position.range.1, begin_type2_line, @@ -1659,7 +1659,7 @@ where #[cfg(feature = "ast-comments")] comments_after_type, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_type2_range, self.parser_position.range.1, begin_type2_line, @@ -1671,14 +1671,14 @@ where mt, constraint, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_type2_range, self.lexer_position.range.1, begin_type2_line, ), }), #[cfg(feature = "ast-span")] - _ => Ok(Type2::Any(( + _ => Ok(Type2::Any(Span( begin_type2_range, self.lexer_position.range.1, begin_type2_line, @@ -1706,7 +1706,7 @@ where ident, generic_args: None, #[cfg(feature = "ast-span")] - span: ( + span: Span( self.parser_position.range.0, self.parser_position.range.1, self.parser_position.line, @@ -1777,7 +1777,7 @@ where let mut group = Group { group_choices: Vec::new(), #[cfg(feature = "ast-span")] - span: (begin_group_range, 0, self.lexer_position.line), + span: Span(begin_group_range, 0, self.lexer_position.line), }; group.group_choices.push(self.parse_grpchoice()?); @@ -1813,7 +1813,7 @@ where #[cfg(feature = "ast-comments")] comments_before_grpchoice: None, #[cfg(feature = "ast-span")] - span: (self.lexer_position.range.0, 0, self.lexer_position.line), + span: Span(self.lexer_position.range.0, 0, self.lexer_position.line), }; if let Token::GCHOICE = &self.cur_token { @@ -1962,7 +1962,7 @@ where let group = self.parse_group()?; #[cfg(feature = "ast-span")] - let mut span = ( + let mut span = Span( begin_grpent_range, self.parser_position.range.1, begin_grpent_line, @@ -2007,7 +2007,7 @@ where } #[cfg(feature = "ast-span")] - let mut span = ( + let mut span = Span( begin_grpent_range, self.parser_position.range.1, begin_grpent_line, @@ -2426,7 +2426,7 @@ where let ident = self.identifier_from_ident_token((ident.0, ident.1)); #[cfg(feature = "ast-span")] { - ident.span = (begin_memberkey_range, end_t1_range, begin_memberkey_line); + ident.span = Span(begin_memberkey_range, end_t1_range, begin_memberkey_line); } self.next_token()?; @@ -2474,13 +2474,13 @@ where ident, generic_args: None, #[cfg(feature = "ast-span")] - span: (begin_memberkey_range, end_t1_range, begin_memberkey_line), + span: Span(begin_memberkey_range, end_t1_range, begin_memberkey_line), }, operator: None, #[cfg(feature = "ast-comments")] comments_after_type: None, #[cfg(feature = "ast-span")] - span: (begin_memberkey_range, end_t1_range, begin_memberkey_line), + span: Span(begin_memberkey_range, end_t1_range, begin_memberkey_line), }), #[cfg(feature = "ast-comments")] comments_before_cut, @@ -2490,7 +2490,7 @@ where #[cfg(feature = "ast-comments")] comments_after_arrowmap, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, end_memberkey_range, begin_memberkey_line, @@ -2522,13 +2522,13 @@ where ident, generic_args: None, #[cfg(feature = "ast-span")] - span: (begin_memberkey_range, end_t1_range, begin_memberkey_line), + span: Span(begin_memberkey_range, end_t1_range, begin_memberkey_line), }, operator: None, #[cfg(feature = "ast-comments")] comments_after_type: None, #[cfg(feature = "ast-span")] - span: (begin_memberkey_range, end_t1_range, begin_memberkey_line), + span: Span(begin_memberkey_range, end_t1_range, begin_memberkey_line), }), #[cfg(feature = "ast-comments")] comments_before_cut, @@ -2538,7 +2538,7 @@ where #[cfg(feature = "ast-comments")] comments_after_arrowmap, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, end_memberkey_range, begin_memberkey_line, @@ -2565,7 +2565,7 @@ where #[cfg(feature = "ast-comments")] comments_after_colon, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, self.parser_position.range.1, begin_memberkey_line, @@ -2667,7 +2667,7 @@ where #[cfg(feature = "ast-comments")] comments_after_arrowmap: memberkey_comments, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, end_memberkey_range, begin_memberkey_line, @@ -2707,7 +2707,7 @@ where #[cfg(feature = "ast-comments")] comments_after_colon: memberkey_comments, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, self.parser_position.range.1, begin_memberkey_line, @@ -2874,7 +2874,7 @@ where #[cfg(feature = "ast-comments")] comments_after_type: comments_after_type_or_group, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, closing_parend_index, begin_memberkey_line, @@ -2884,7 +2884,7 @@ where comments_after_type: comments_before_cut.clone(), operator: None, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, closing_parend_index, begin_memberkey_line, @@ -2898,7 +2898,7 @@ where #[cfg(feature = "ast-comments")] comments_after_arrowmap: None, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, end_memberkey_range, begin_memberkey_line, @@ -2930,7 +2930,7 @@ where #[cfg(feature = "ast-comments")] comments_after_type: comments_after_type_or_group, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, closing_parend_index, begin_memberkey_line, @@ -2940,7 +2940,7 @@ where comments_after_type: comments_before_cut.clone(), operator: None, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, closing_parend_index, begin_memberkey_line, @@ -2954,7 +2954,7 @@ where #[cfg(feature = "ast-comments")] comments_after_arrowmap: memberkey_comments, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, self.lexer_position.range.0, begin_memberkey_line, @@ -2965,7 +2965,7 @@ where non_member_key: NonMemberKey::Type(Type { type_choices: t.type_choices, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, self.parser_position.range.1, begin_memberkey_line, @@ -3025,7 +3025,7 @@ where #[cfg(feature = "ast-comments")] comments_after_arrowmap: memberkey_comments, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, end_memberkey_range, begin_memberkey_line, @@ -3056,7 +3056,7 @@ where #[cfg(feature = "ast-comments")] comments_after_arrowmap: memberkey_comments, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, self.parser_position.range.1, begin_memberkey_line, @@ -3073,7 +3073,7 @@ where type1: t1, }], #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_memberkey_range, self.parser_position.range.1, begin_memberkey_line, @@ -3118,7 +3118,7 @@ where Ok(Some(Occurrence { #[cfg(feature = "ast-span")] - occur: Occur::Optional(( + occur: Occur::Optional(Span( self.parser_position.range.0, self.parser_position.range.1, self.parser_position.line, @@ -3145,7 +3145,7 @@ where Ok(Some(Occurrence { #[cfg(feature = "ast-span")] - occur: Occur::OneOrMore(( + occur: Occur::OneOrMore(Span( self.parser_position.range.0, self.parser_position.range.1, self.parser_position.line, @@ -3169,7 +3169,7 @@ where lower: None, upper: Some(*u), #[cfg(feature = "ast-span")] - span: ( + span: Span( self.parser_position.range.0, self.parser_position.range.1, self.parser_position.line, @@ -3179,7 +3179,7 @@ where #[cfg(feature = "ast-span")] { self.parser_position.range = self.lexer_position.range; - Occur::ZeroOrMore(( + Occur::ZeroOrMore(Span( self.parser_position.range.0, self.parser_position.range.1, self.parser_position.line, @@ -3263,7 +3263,7 @@ where lower, upper, #[cfg(feature = "ast-span")] - span: ( + span: Span( begin_occur_range, self.parser_position.range.1, begin_occur_line, @@ -3303,7 +3303,7 @@ where ident: ident.0, socket: ident.1, #[cfg(feature = "ast-span")] - span: ( + span: Span( self.lexer_position.range.0, self.lexer_position.range.1, self.lexer_position.line, diff --git a/src/parser_tests.rs b/src/parser_tests.rs index 505956c0..ef242d0d 100644 --- a/src/parser_tests.rs +++ b/src/parser_tests.rs @@ -86,7 +86,7 @@ mod tests { param: Identifier { ident: "t".into(), socket: None, - span: (1, 2, 1), + span: Span(1, 2, 1), }, comments_before_ident: None, comments_after_ident: None, @@ -95,13 +95,13 @@ mod tests { param: Identifier { ident: "v".into(), socket: None, - span: (4, 5, 1), + span: Span(4, 5, 1), }, comments_before_ident: None, comments_after_ident: None, }, ], - span: (0, 6, 1), + span: Span(0, 6, 1), }; assert_eq!(gps, expected_output); @@ -249,11 +249,11 @@ mod tests { arg: Box::from(Type1 { type2: Type2::TextValue { value: "reboot".into(), - span: (1, 9, 1), + span: Span(1, 9, 1), }, operator: None, comments_after_type: None, - span: (1, 9, 1), + span: Span(1, 9, 1), }), comments_before_type: None, comments_after_type: None, @@ -262,17 +262,17 @@ mod tests { arg: Box::from(Type1 { type2: Type2::TextValue { value: "now".into(), - span: (11, 16, 1), + span: Span(11, 16, 1), }, operator: None, comments_after_type: None, - span: (11, 16, 1), + span: Span(11, 16, 1), }), comments_before_type: None, comments_after_type: None, }, ], - span: (0, 17, 1), + span: Span(0, 17, 1), }; assert_eq!(generic_args, expected_output); @@ -301,14 +301,14 @@ mod tests { ident: Identifier { ident: "tchoice1".into(), socket: None, - span: (2, 10, 1), + span: Span(2, 10, 1), }, generic_args: None, - span: (2, 10, 1), + span: Span(2, 10, 1), }, operator: None, comments_after_type: None, - span: (2, 10, 1), + span: Span(2, 10, 1), }, comments_before_type: None, comments_after_type: None, @@ -319,33 +319,33 @@ mod tests { ident: Identifier { ident: "tchoice2".into(), socket: None, - span: (13, 21, 1), + span: Span(13, 21, 1), }, generic_args: None, - span: (13, 21, 1), + span: Span(13, 21, 1), }, operator: None, comments_after_type: None, - span: (13, 21, 1), + span: Span(13, 21, 1), }, comments_before_type: None, comments_after_type: None, }, ], - span: (2, 21, 1), + span: Span(2, 21, 1), }, comments_before_type: None, comments_after_type: None, - span: (0, 23, 1), + span: Span(0, 23, 1), }, operator: None, comments_after_type: None, - span: (0, 23, 1), + span: Span(0, 23, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (0, 23, 1), + span: Span(0, 23, 1), }; assert_eq!(t, expected_output); @@ -369,122 +369,122 @@ mod tests { Type1 { type2: Type2::UintValue { value: 5, - span: (0, 1, 1), + span: Span(0, 1, 1), }, operator: Some(Operator { operator: RangeCtlOp::RangeOp { is_inclusive: true, - span: (1, 3, 1), + span: Span(1, 3, 1), }, type2: Type2::UintValue { value: 10, - span: (3, 5, 1), + span: Span(3, 5, 1), }, comments_before_operator: None, comments_after_operator: None, }), comments_after_type: None, - span: (0, 5, 1), + span: Span(0, 5, 1), }, Type1 { type2: Type2::FloatValue { value: -10.5, - span: (0, 5, 1), + span: Span(0, 5, 1), }, operator: Some(Operator { operator: RangeCtlOp::RangeOp { is_inclusive: false, - span: (5, 8, 1), + span: Span(5, 8, 1), }, type2: Type2::FloatValue { value: 10.1, - span: (8, 12, 1), + span: Span(8, 12, 1), }, comments_before_operator: None, comments_after_operator: None, }), comments_after_type: None, - span: (0, 12, 1), + span: Span(0, 12, 1), }, Type1 { type2: Type2::FloatValue { value: 1.5, - span: (0, 3, 1), + span: Span(0, 3, 1), }, operator: Some(Operator { operator: RangeCtlOp::RangeOp { is_inclusive: true, - span: (3, 5, 1), + span: Span(3, 5, 1), }, type2: Type2::FloatValue { value: 4.5, - span: (5, 8, 1), + span: Span(5, 8, 1), }, comments_before_operator: None, comments_after_operator: None, }), comments_after_type: None, - span: (0, 8, 1), + span: Span(0, 8, 1), }, Type1 { type2: Type2::Typename { ident: Identifier { ident: "my..lower".into(), socket: None, - span: (0, 9, 1), + span: Span(0, 9, 1), }, generic_args: None, - span: (0, 9, 1), + span: Span(0, 9, 1), }, operator: Some(Operator { operator: RangeCtlOp::RangeOp { is_inclusive: false, - span: (10, 13, 1), + span: Span(10, 13, 1), }, type2: Type2::Typename { ident: Identifier { ident: "upper".into(), socket: None, - span: (14, 19, 1), + span: Span(14, 19, 1), }, generic_args: None, - span: (14, 19, 1), + span: Span(14, 19, 1), }, comments_before_operator: None, comments_after_operator: None, }), comments_after_type: None, - span: (0, 19, 1), + span: Span(0, 19, 1), }, Type1 { type2: Type2::Typename { ident: Identifier { ident: "target".into(), socket: None, - span: (0, 6, 1), + span: Span(0, 6, 1), }, generic_args: None, - span: (0, 6, 1), + span: Span(0, 6, 1), }, operator: Some(Operator { operator: RangeCtlOp::CtlOp { ctrl: ".lt", - span: (7, 10, 1), + span: Span(7, 10, 1), }, type2: Type2::Typename { ident: Identifier { ident: "controller".into(), socket: None, - span: (11, 21, 1), + span: Span(11, 21, 1), }, generic_args: None, - span: (11, 21, 1), + span: Span(11, 21, 1), }, comments_before_operator: None, comments_after_operator: None, }), comments_after_type: None, - span: (0, 21, 1), + span: Span(0, 21, 1), }, Type1 { type2: Type2::ParenthesizedType { @@ -496,14 +496,14 @@ mod tests { ident: Identifier { ident: "text".into(), socket: None, - span: (2, 6, 1), + span: Span(2, 6, 1), }, generic_args: None, - span: (2, 6, 1), + span: Span(2, 6, 1), }, operator: None, comments_after_type: None, - span: (2, 6, 1), + span: Span(2, 6, 1), }, comments_before_type: None, comments_after_type: None, @@ -514,40 +514,40 @@ mod tests { ident: Identifier { ident: "tstr".into(), socket: None, - span: (9, 13, 1), + span: Span(9, 13, 1), }, generic_args: None, - span: (9, 13, 1), + span: Span(9, 13, 1), }, operator: None, comments_after_type: None, - span: (9, 13, 1), + span: Span(9, 13, 1), }, comments_before_type: None, comments_after_type: None, }, ], - span: (2, 13, 1), + span: Span(2, 13, 1), }, comments_before_type: None, comments_after_type: None, - span: (0, 15, 1), + span: Span(0, 15, 1), }, operator: Some(Operator { operator: RangeCtlOp::CtlOp { ctrl: ".eq", - span: (16, 19, 1), + span: Span(16, 19, 1), }, type2: Type2::TextValue { value: "hello".into(), - span: (20, 27, 1), + span: Span(20, 27, 1), }, comments_before_operator: None, comments_after_operator: None, }), comments_after_type: None, - span: (0, 27, 1), + span: Span(0, 27, 1), }, ]; @@ -583,13 +583,13 @@ mod tests { let expected_outputs = [ Type2::TextValue { value: "myvalue".into(), - span: (0, 9, 1), + span: Span(0, 9, 1), }, Type2::Typename { ident: Identifier { ident: "message".into(), socket: None, - span: (0, 7, 1), + span: Span(0, 7, 1), }, generic_args: Some(GenericArgs { args: vec![ @@ -597,11 +597,11 @@ mod tests { arg: Box::from(Type1 { type2: Type2::TextValue { value: "reboot".into(), - span: (8, 16, 1), + span: Span(8, 16, 1), }, operator: None, comments_after_type: None, - span: (8, 16, 1), + span: Span(8, 16, 1), }), comments_before_type: None, comments_after_type: None, @@ -610,38 +610,38 @@ mod tests { arg: Box::from(Type1 { type2: Type2::TextValue { value: "now".into(), - span: (18, 23, 1), + span: Span(18, 23, 1), }, operator: None, comments_after_type: None, - span: (18, 23, 1), + span: Span(18, 23, 1), }), comments_before_type: None, comments_after_type: None, }, ], - span: (7, 24, 1), + span: Span(7, 24, 1), }), - span: (0, 24, 1), + span: Span(0, 24, 1), }, Type2::Typename { ident: Identifier { ident: "tcp-option".into(), socket: Some(SocketPlug::GROUP), - span: (0, 12, 1), + span: Span(0, 12, 1), }, generic_args: None, - span: (0, 12, 1), + span: Span(0, 12, 1), }, Type2::Unwrap { ident: Identifier { ident: "group1".into(), socket: None, - span: (1, 7, 1), + span: Span(1, 7, 1), }, generic_args: None, comments: None, - span: (0, 0, 0), + span: Span(0, 0, 0), }, Type2::TaggedData { tag: Some(997), @@ -652,29 +652,29 @@ mod tests { ident: Identifier { ident: "tstr".into(), socket: None, - span: (7, 11, 1), + span: Span(7, 11, 1), }, generic_args: None, - span: (7, 11, 1), + span: Span(7, 11, 1), }, operator: None, comments_after_type: None, - span: (7, 11, 1), + span: Span(7, 11, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (7, 11, 1), + span: Span(7, 11, 1), }, comments_before_type: None, comments_after_type: None, - span: (0, 11, 1), + span: Span(0, 11, 1), }, Type2::FloatValue { value: 9.9, - span: (0, 3, 1), + span: Span(0, 3, 1), }, - Type2::Any((0, 1, 1)), + Type2::Any(Span(0, 1, 1)), Type2::Array { group: Group { group_choices: vec![GroupChoice { @@ -685,7 +685,7 @@ mod tests { occur: Occur::Exact { lower: None, upper: Some(3), - span: (1, 3, 1), + span: Span(1, 3, 1), }, comments: None, _a: PhantomData::default(), @@ -693,13 +693,13 @@ mod tests { name: Identifier { ident: "reputon".into(), socket: None, - span: (4, 11, 1), + span: Span(4, 11, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (1, 11, 1), + span: Span(1, 11, 1), }, OptionalComma { optional_comma: false, @@ -708,13 +708,13 @@ mod tests { }, )], comments_before_grpchoice: None, - span: (1, 11, 1), + span: Span(1, 11, 1), }], - span: (1, 11, 1), + span: Span(1, 11, 1), }, comments_before_group: None, comments_after_group: None, - span: (0, 12, 1), + span: Span(0, 12, 1), }, Type2::Array { group: Group { @@ -723,20 +723,20 @@ mod tests { GroupEntry::TypeGroupname { ge: TypeGroupnameEntry { occur: Some(Occurrence { - occur: Occur::OneOrMore((1, 2, 1)), + occur: Occur::OneOrMore(Span(1, 2, 1)), comments: None, _a: PhantomData::default(), }), name: Identifier { ident: "reputon".into(), socket: None, - span: (3, 10, 1), + span: Span(3, 10, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (1, 10, 1), + span: Span(1, 10, 1), }, OptionalComma { optional_comma: false, @@ -745,23 +745,23 @@ mod tests { }, )], comments_before_grpchoice: None, - span: (1, 10, 1), + span: Span(1, 10, 1), }], - span: (1, 10, 1), + span: Span(1, 10, 1), }, comments_before_group: None, comments_after_group: None, - span: (0, 11, 1), + span: Span(0, 11, 1), }, Type2::ChoiceFromGroup { ident: Identifier { ident: "groupname".into(), socket: None, - span: (1, 10, 1), + span: Span(1, 10, 1), }, generic_args: None, comments: None, - span: (0, 10, 1), + span: Span(0, 10, 1), }, Type2::ChoiceFromInlineGroup { group: Group { @@ -773,13 +773,13 @@ mod tests { name: Identifier { ident: "inlinegroup".into(), socket: None, - span: (3, 14, 1), + span: Span(3, 14, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (3, 14, 1), + span: Span(3, 14, 1), }, OptionalComma { optional_comma: false, @@ -788,14 +788,14 @@ mod tests { }, )], comments_before_grpchoice: None, - span: (3, 14, 1), + span: Span(3, 14, 1), }], - span: (3, 14, 1), + span: Span(3, 14, 1), }, comments: None, comments_before_group: None, comments_after_group: None, - span: (0, 14, 1), + span: Span(0, 14, 1), }, Type2::Map { group: Group { @@ -804,7 +804,7 @@ mod tests { GroupEntry::ValueMemberKey { ge: Box::from(ValueMemberKeyEntry { occur: Some(Occurrence { - occur: Occur::Optional((2, 3, 1)), + occur: Occur::Optional(Span(2, 3, 1)), comments: None, _a: PhantomData::default(), }), @@ -812,17 +812,17 @@ mod tests { t1: Box::from(Type1 { type2: Type2::TextValue { value: "optional-key".into(), - span: (4, 18, 1), + span: Span(4, 18, 1), }, operator: None, comments_after_type: None, - span: (4, 18, 1), + span: Span(4, 18, 1), }), is_cut: true, comments_before_cut: None, comments_after_cut: None, comments_after_arrowmap: None, - span: (4, 23, 1), + span: Span(4, 23, 1), }), entry_type: Type { type_choices: vec![TypeChoice { @@ -831,24 +831,24 @@ mod tests { ident: Identifier { ident: "int".into(), socket: None, - span: (24, 27, 1), + span: Span(24, 27, 1), }, generic_args: None, - span: (24, 27, 1), + span: Span(24, 27, 1), }, operator: None, comments_after_type: None, - span: (24, 27, 1), + span: Span(24, 27, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (24, 27, 1), + span: Span(24, 27, 1), }, }), leading_comments: None, trailing_comments: None, - span: (2, 28, 1), + span: Span(2, 28, 1), }, OptionalComma { optional_comma: true, @@ -857,13 +857,13 @@ mod tests { }, )], comments_before_grpchoice: None, - span: (2, 28, 1), + span: Span(2, 28, 1), }], - span: (2, 28, 1), + span: Span(2, 28, 1), }, comments_before_group: None, comments_after_group: None, - span: (0, 30, 1), + span: Span(0, 30, 1), }, Type2::Array { group: Group { @@ -881,11 +881,11 @@ mod tests { ident: Identifier { ident: "a".into(), socket: None, - span: (4, 5, 1), + span: Span(4, 5, 1), }, comments: None, comments_after_colon: None, - span: (4, 6, 1), + span: Span(4, 6, 1), }), entry_type: Type { type_choices: vec![TypeChoice { @@ -894,24 +894,24 @@ mod tests { ident: Identifier { ident: "int".into(), socket: None, - span: (7, 10, 1), + span: Span(7, 10, 1), }, generic_args: None, - span: (7, 10, 1), + span: Span(7, 10, 1), }, operator: None, comments_after_type: None, - span: (7, 10, 1), + span: Span(7, 10, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (7, 10, 1), + span: Span(7, 10, 1), }, }), leading_comments: None, trailing_comments: None, - span: (4, 11, 1), + span: Span(4, 11, 1), }, OptionalComma { optional_comma: true, @@ -927,11 +927,11 @@ mod tests { ident: Identifier { ident: "b".into(), socket: None, - span: (12, 13, 1), + span: Span(12, 13, 1), }, comments: None, comments_after_colon: None, - span: (12, 14, 1), + span: Span(12, 14, 1), }), entry_type: Type { type_choices: vec![TypeChoice { @@ -940,24 +940,24 @@ mod tests { ident: Identifier { ident: "tstr".into(), socket: None, - span: (15, 19, 1), + span: Span(15, 19, 1), }, generic_args: None, - span: (15, 19, 1), + span: Span(15, 19, 1), }, operator: None, comments_after_type: None, - span: (15, 19, 1), + span: Span(15, 19, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (15, 19, 1), + span: Span(15, 19, 1), }, }), leading_comments: None, trailing_comments: None, - span: (12, 19, 1), + span: Span(12, 19, 1), }, OptionalComma { optional_comma: false, @@ -967,14 +967,14 @@ mod tests { ), ], comments_before_grpchoice: None, - span: (4, 19, 1), + span: Span(4, 19, 1), }], - span: (4, 19, 1), + span: Span(4, 19, 1), }, occur: None, comments_before_group: None, comments_after_group: None, - span: (2, 21, 1), + span: Span(2, 21, 1), }, OptionalComma { optional_comma: false, @@ -983,13 +983,13 @@ mod tests { }, )], comments_before_grpchoice: None, - span: (2, 21, 1), + span: Span(2, 21, 1), }], - span: (2, 21, 1), + span: Span(2, 21, 1), }, comments_before_group: None, comments_after_group: None, - span: (0, 23, 1), + span: Span(0, 23, 1), }, ]; @@ -1032,20 +1032,20 @@ mod tests { GroupEntry::TypeGroupname { ge: TypeGroupnameEntry { occur: Some(Occurrence { - occur: Occur::ZeroOrMore((3, 4, 1)), + occur: Occur::ZeroOrMore(Span(3, 4, 1)), comments: None, _a: PhantomData::default(), }), name: Identifier { ident: "file-entry".into(), socket: None, - span: (5, 15, 1), + span: Span(5, 15, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (3, 15, 1), + span: Span(3, 15, 1), }, OptionalComma { optional_comma: false, @@ -1054,27 +1054,27 @@ mod tests { }, )], comments_before_grpchoice: None, - span: (3, 15, 1), + span: Span(3, 15, 1), }], - span: (3, 15, 1), + span: Span(3, 15, 1), }, comments_before_group: None, comments_after_group: None, - span: (2, 16, 1), + span: Span(2, 16, 1), }, operator: None, comments_after_type: None, - span: (2, 16, 1), + span: Span(2, 16, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (2, 16, 1), + span: Span(2, 16, 1), }, }), leading_comments: None, trailing_comments: None, - span: (2, 17, 1), + span: Span(2, 17, 1), }, OptionalComma { optional_comma: true, @@ -1097,20 +1097,20 @@ mod tests { GroupEntry::TypeGroupname { ge: TypeGroupnameEntry { occur: Some(Occurrence { - occur: Occur::ZeroOrMore((19, 20, 1)), + occur: Occur::ZeroOrMore(Span(19, 20, 1)), comments: None, _a: PhantomData::default(), }), name: Identifier { ident: "directory-entry".into(), socket: None, - span: (21, 36, 1), + span: Span(21, 36, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (19, 36, 1), + span: Span(19, 36, 1), }, OptionalComma { optional_comma: false, @@ -1119,27 +1119,27 @@ mod tests { }, )], comments_before_grpchoice: None, - span: (19, 36, 1), + span: Span(19, 36, 1), }], - span: (19, 36, 1), + span: Span(19, 36, 1), }, comments_before_group: None, comments_after_group: None, - span: (18, 37, 1), + span: Span(18, 37, 1), }, operator: None, comments_after_type: None, - span: (18, 37, 1), + span: Span(18, 37, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (18, 37, 1), + span: Span(18, 37, 1), }, }), leading_comments: None, trailing_comments: None, - span: (18, 37, 1), + span: Span(18, 37, 1), }, OptionalComma { optional_comma: false, @@ -1149,13 +1149,13 @@ mod tests { ), ], comments_before_grpchoice: None, - span: (2, 37, 1), + span: Span(2, 37, 1), }], - span: (2, 37, 1), + span: Span(2, 37, 1), }, comments_before_group: None, comments_after_group: None, - span: (0, 39, 1), + span: Span(0, 39, 1), }, Type2::Map { group: Group { @@ -1169,13 +1169,13 @@ mod tests { name: Identifier { ident: "int".into(), socket: None, - span: (2, 5, 1), + span: Span(2, 5, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (2, 6, 1), + span: Span(2, 6, 1), }, OptionalComma { optional_comma: true, @@ -1190,13 +1190,13 @@ mod tests { name: Identifier { ident: "int".into(), socket: None, - span: (7, 10, 1), + span: Span(7, 10, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (7, 10, 1), + span: Span(7, 10, 1), }, OptionalComma { optional_comma: false, @@ -1206,7 +1206,7 @@ mod tests { ), ], comments_before_grpchoice: None, - span: (2, 10, 1), + span: Span(2, 10, 1), }, GroupChoice { group_entries: vec![ @@ -1217,13 +1217,13 @@ mod tests { name: Identifier { ident: "int".into(), socket: None, - span: (14, 17, 1), + span: Span(14, 17, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (14, 18, 1), + span: Span(14, 18, 1), }, OptionalComma { optional_comma: true, @@ -1238,13 +1238,13 @@ mod tests { name: Identifier { ident: "tstr".into(), socket: None, - span: (19, 23, 1), + span: Span(19, 23, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (19, 23, 1), + span: Span(19, 23, 1), }, OptionalComma { optional_comma: false, @@ -1254,14 +1254,14 @@ mod tests { ), ], comments_before_grpchoice: None, - span: (14, 23, 1), + span: Span(14, 23, 1), }, ], - span: (2, 23, 1), + span: Span(2, 23, 1), }, comments_before_group: None, comments_after_group: None, - span: (0, 25, 1), + span: Span(0, 25, 1), }, Type2::Map { group: Group { @@ -1274,13 +1274,13 @@ mod tests { name: Identifier { ident: "int".into(), socket: None, - span: (2, 5, 1), + span: Span(2, 5, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (2, 6, 1), + span: Span(2, 6, 1), }, OptionalComma { optional_comma: true, @@ -1295,13 +1295,13 @@ mod tests { name: Identifier { ident: "int".into(), socket: None, - span: (7, 10, 1), + span: Span(7, 10, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (7, 11, 1), + span: Span(7, 11, 1), }, OptionalComma { optional_comma: true, @@ -1316,13 +1316,13 @@ mod tests { name: Identifier { ident: "int".into(), socket: None, - span: (12, 15, 1), + span: Span(12, 15, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (12, 16, 1), + span: Span(12, 16, 1), }, OptionalComma { optional_comma: true, @@ -1337,13 +1337,13 @@ mod tests { name: Identifier { ident: "tstr".into(), socket: None, - span: (17, 21, 1), + span: Span(17, 21, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (17, 21, 1), + span: Span(17, 21, 1), }, OptionalComma { optional_comma: false, @@ -1353,13 +1353,13 @@ mod tests { ), ], comments_before_grpchoice: None, - span: (2, 21, 1), + span: Span(2, 21, 1), }], - span: (2, 21, 1), + span: Span(2, 21, 1), }, comments_before_group: None, comments_after_group: None, - span: (0, 23, 1), + span: Span(0, 23, 1), }, ]; @@ -1389,7 +1389,7 @@ mod tests { GroupEntry::ValueMemberKey { ge: Box::from(ValueMemberKeyEntry { occur: Some(Occurrence { - occur: Occur::ZeroOrMore((0, 1, 1)), + occur: Occur::ZeroOrMore(Span(0, 1, 1)), comments: None, _a: PhantomData::default(), }), @@ -1399,41 +1399,41 @@ mod tests { ident: Identifier { ident: "type1".into(), socket: None, - span: (2, 7, 1), + span: Span(2, 7, 1), }, generic_args: None, - span: (2, 7, 1), + span: Span(2, 7, 1), }, operator: None, comments_after_type: None, - span: (2, 7, 1), + span: Span(2, 7, 1), }), is_cut: true, comments_before_cut: None, comments_after_cut: None, comments_after_arrowmap: None, - span: (2, 12, 1), + span: Span(2, 12, 1), }), entry_type: Type { type_choices: vec![TypeChoice { type1: Type1 { type2: Type2::TextValue { value: "value".into(), - span: (13, 20, 1), + span: Span(13, 20, 1), }, operator: None, comments_after_type: None, - span: (13, 20, 1), + span: Span(13, 20, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (13, 20, 1), + span: Span(13, 20, 1), }, }), leading_comments: None, trailing_comments: None, - span: (0, 20, 1), + span: Span(0, 20, 1), }, GroupEntry::ValueMemberKey { ge: Box::from(ValueMemberKeyEntry { @@ -1442,11 +1442,11 @@ mod tests { ident: Identifier { ident: "type1".into(), socket: None, - span: (0, 5, 1), + span: Span(0, 5, 1), }, comments: None, comments_after_colon: None, - span: (0, 6, 1), + span: Span(0, 6, 1), }), entry_type: Type { type_choices: vec![TypeChoice { @@ -1455,24 +1455,24 @@ mod tests { ident: Identifier { ident: "type2".into(), socket: None, - span: (7, 12, 1), + span: Span(7, 12, 1), }, generic_args: None, - span: (7, 12, 1), + span: Span(7, 12, 1), }, operator: None, comments_after_type: None, - span: (7, 12, 1), + span: Span(7, 12, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (7, 12, 1), + span: Span(7, 12, 1), }, }), leading_comments: None, trailing_comments: None, - span: (0, 12, 1), + span: Span(0, 12, 1), }, GroupEntry::TypeGroupname { ge: TypeGroupnameEntry { @@ -1480,18 +1480,18 @@ mod tests { name: Identifier { ident: "typename".into(), socket: None, - span: (0, 8, 1), + span: Span(0, 8, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (0, 8, 1), + span: Span(0, 8, 1), }, GroupEntry::ValueMemberKey { ge: Box::from(ValueMemberKeyEntry { occur: Some(Occurrence { - occur: Occur::Optional((0, 1, 1)), + occur: Occur::Optional(Span(0, 1, 1)), comments: None, _a: PhantomData::default(), }), @@ -1499,7 +1499,7 @@ mod tests { value: token::Value::UINT(0), comments: None, comments_after_colon: None, - span: (2, 4, 1), + span: Span(2, 4, 1), }), entry_type: Type { type_choices: vec![TypeChoice { @@ -1508,24 +1508,24 @@ mod tests { ident: Identifier { ident: "addrdistr".into(), socket: None, - span: (5, 14, 1), + span: Span(5, 14, 1), }, generic_args: None, - span: (5, 14, 1), + span: Span(5, 14, 1), }, operator: None, comments_after_type: None, - span: (5, 14, 1), + span: Span(5, 14, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (5, 14, 1), + span: Span(5, 14, 1), }, }), leading_comments: None, trailing_comments: None, - span: (0, 14, 1), + span: Span(0, 14, 1), }, GroupEntry::ValueMemberKey { ge: Box::from(ValueMemberKeyEntry { @@ -1534,7 +1534,7 @@ mod tests { value: token::Value::UINT(0), comments: None, comments_after_colon: None, - span: (0, 2, 1), + span: Span(0, 2, 1), }), entry_type: Type { type_choices: vec![TypeChoice { @@ -1543,7 +1543,7 @@ mod tests { ident: Identifier { ident: "finite_set".into(), socket: None, - span: (3, 13, 1), + span: Span(3, 13, 1), }, generic_args: Some(GenericArgs { args: vec![GenericArg { @@ -1552,41 +1552,41 @@ mod tests { ident: Identifier { ident: "transaction_input".into(), socket: None, - span: (14, 31, 1), + span: Span(14, 31, 1), }, generic_args: None, - span: (14, 31, 1), + span: Span(14, 31, 1), }, operator: None, comments_after_type: None, - span: (14, 31, 1), + span: Span(14, 31, 1), }), comments_before_type: None, comments_after_type: None, }], - span: (13, 32, 1), + span: Span(13, 32, 1), }), - span: (3, 32, 1), + span: Span(3, 32, 1), }, operator: None, comments_after_type: None, - span: (3, 32, 1), + span: Span(3, 32, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (3, 32, 1), + span: Span(3, 32, 1), }, }), leading_comments: None, trailing_comments: None, - span: (0, 32, 1), + span: Span(0, 32, 1), }, GroupEntry::ValueMemberKey { ge: Box::from(ValueMemberKeyEntry { occur: Some(Occurrence { - occur: Occur::ZeroOrMore((0, 1, 1)), + occur: Occur::ZeroOrMore(Span(0, 1, 1)), comments: None, _a: PhantomData::default(), }), @@ -1602,13 +1602,13 @@ mod tests { name: Identifier { ident: "credential".into(), socket: None, - span: (3, 13, 1), + span: Span(3, 13, 1), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (3, 13, 1), + span: Span(3, 13, 1), }, OptionalComma { optional_comma: false, @@ -1617,23 +1617,23 @@ mod tests { }, )], comments_before_grpchoice: None, - span: (3, 13, 1), + span: Span(3, 13, 1), }], - span: (3, 13, 1), + span: Span(3, 13, 1), }, comments_before_group: None, comments_after_group: None, - span: (2, 14, 1), + span: Span(2, 14, 1), }, operator: None, comments_after_type: None, - span: (2, 14, 1), + span: Span(2, 14, 1), }), is_cut: false, comments_before_cut: None, comments_after_cut: None, comments_after_arrowmap: None, - span: (2, 22, 1), + span: Span(2, 22, 1), }), entry_type: Type { type_choices: vec![TypeChoice { @@ -1642,24 +1642,24 @@ mod tests { ident: Identifier { ident: "coin".into(), socket: None, - span: (18, 22, 1), + span: Span(18, 22, 1), }, generic_args: None, - span: (18, 22, 1), + span: Span(18, 22, 1), }, operator: None, comments_after_type: None, - span: (18, 22, 1), + span: Span(18, 22, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (18, 22, 1), + span: Span(18, 22, 1), }, }), leading_comments: None, trailing_comments: None, - span: (0, 22, 1), + span: Span(0, 22, 1), }, ]; @@ -1692,20 +1692,20 @@ mod tests { ident: Identifier { ident: "type1".into(), socket: None, - span: (0, 5, 1), + span: Span(0, 5, 1), }, generic_args: None, - span: (0, 5, 1), + span: Span(0, 5, 1), }, operator: None, comments_after_type: None, - span: (0, 5, 1), + span: Span(0, 5, 1), }), is_cut: false, comments_before_cut: None, comments_after_cut: None, comments_after_arrowmap: None, - span: (0, 8, 1), + span: Span(0, 8, 1), }, MemberKey::Type1 { t1: Box::from(Type1 { @@ -1716,10 +1716,10 @@ mod tests { type1: Type1 { type2: Type2::TextValue { value: "mytype1".into(), - span: (2, 11, 1), + span: Span(2, 11, 1), }, operator: None, - span: (2, 11, 1), + span: Span(2, 11, 1), comments_after_type: None, }, comments_after_type: None, @@ -1730,13 +1730,13 @@ mod tests { type2: Type2::Typename { ident: Identifier { ident: "int", - span: (14, 17, 1), + span: Span(14, 17, 1), socket: None, }, - span: (14, 17, 1), + span: Span(14, 17, 1), generic_args: None, }, - span: (14, 17, 1), + span: Span(14, 17, 1), comments_after_type: None, operator: None, }, @@ -1744,53 +1744,53 @@ mod tests { comments_after_type: None, }, ], - span: (2, 17, 1), + span: Span(2, 17, 1), }, - span: (0, 19, 1), + span: Span(0, 19, 1), comments_before_type: None, comments_after_type: None, }, operator: None, comments_after_type: None, - span: (0, 19, 1), + span: Span(0, 19, 1), }), is_cut: true, comments_before_cut: None, comments_after_cut: None, comments_after_arrowmap: None, - span: (0, 24, 1), + span: Span(0, 24, 1), }, MemberKey::Bareword { ident: Identifier { ident: "mybareword".into(), socket: None, - span: (0, 10, 1), + span: Span(0, 10, 1), }, comments: None, comments_after_colon: None, - span: (0, 11, 1), + span: Span(0, 11, 1), }, MemberKey::Bareword { ident: Identifier { ident: "my..bareword".into(), socket: None, - span: (0, 12, 1), + span: Span(0, 12, 1), }, comments: None, comments_after_colon: None, - span: (0, 13, 1), + span: Span(0, 13, 1), }, MemberKey::Value { value: token::Value::TEXT("myvalue".into()), comments: None, comments_after_colon: None, - span: (0, 10, 1), + span: Span(0, 10, 1), }, MemberKey::Value { value: token::Value::UINT(0), comments: None, comments_after_colon: None, - span: (0, 2, 1), + span: Span(0, 2, 1), }, ]; @@ -1816,18 +1816,18 @@ mod tests { occur: Occur::Exact { lower: Some(1), upper: Some(3), - span: (0, 3, 1), + span: Span(0, 3, 1), }, comments: None, _a: PhantomData::default(), }, Occurrence { - occur: Occur::ZeroOrMore((0, 1, 1)), + occur: Occur::ZeroOrMore(Span(0, 1, 1)), comments: None, _a: PhantomData::default(), }, Occurrence { - occur: Occur::OneOrMore((0, 1, 1)), + occur: Occur::OneOrMore(Span(0, 1, 1)), comments: None, _a: PhantomData::default(), }, @@ -1835,7 +1835,7 @@ mod tests { occur: Occur::Exact { lower: Some(5), upper: None, - span: (0, 2, 1), + span: Span(0, 2, 1), }, comments: None, _a: PhantomData::default(), @@ -1844,13 +1844,13 @@ mod tests { occur: Occur::Exact { lower: None, upper: Some(3), - span: (0, 2, 1), + span: Span(0, 2, 1), }, comments: None, _a: PhantomData::default(), }, Occurrence { - occur: Occur::Optional((0, 1, 1)), + occur: Occur::Optional(Span(0, 1, 1)), comments: None, _a: PhantomData::default(), }, diff --git a/tests/parser.rs b/tests/parser.rs index bb447f68..4bb852a6 100644 --- a/tests/parser.rs +++ b/tests/parser.rs @@ -40,7 +40,7 @@ fn verify_cddl() -> Result<()> { name: Identifier { ident: "myrule".into(), socket: None, - span: (0, 6, 1), + span: Span(0, 6, 1), }, generic_params: None, is_type_choice_alternate: false, @@ -51,33 +51,33 @@ fn verify_cddl() -> Result<()> { ident: Identifier { ident: "secondrule".into(), socket: None, - span: (9, 19, 1), + span: Span(9, 19, 1), }, generic_args: None, - span: (9, 19, 1), + span: Span(9, 19, 1), }, operator: None, comments_after_type: None, - span: (9, 19, 1), + span: Span(9, 19, 1), }, comments_before_type: None, comments_after_type: None, }], - span: (9, 19, 1), + span: Span(9, 19, 1), }, comments_before_assignt: None, comments_after_assignt: None, }, comments_after_rule: None, - span: (0, 19, 1), + span: Span(0, 19, 1), }, Rule::Type { rule: TypeRule { name: Identifier { ident: "myrange".into(), socket: None, - span: (20, 27, 2), + span: Span(20, 27, 2), }, generic_params: None, is_type_choice_alternate: false, @@ -86,45 +86,45 @@ fn verify_cddl() -> Result<()> { type1: Type1 { type2: Type2::UintValue { value: 10, - span: (30, 32, 2), + span: Span(30, 32, 2), }, operator: Some(Operator { operator: RangeCtlOp::RangeOp { is_inclusive: true, - span: (32, 34, 2), + span: Span(32, 34, 2), }, type2: Type2::Typename { ident: Identifier { ident: "upper".into(), socket: None, - span: (34, 39, 2), + span: Span(34, 39, 2), }, generic_args: None, - span: (34, 39, 2), + span: Span(34, 39, 2), }, comments_before_operator: None, comments_after_operator: None, }), comments_after_type: None, - span: (30, 39, 2), + span: Span(30, 39, 2), }, comments_before_type: None, comments_after_type: None, }], - span: (30, 39, 2), + span: Span(30, 39, 2), }, comments_before_assignt: None, comments_after_assignt: None, }, comments_after_rule: None, - span: (20, 39, 2), + span: Span(20, 39, 2), }, Rule::Type { rule: TypeRule { name: Identifier { ident: "upper".into(), socket: None, - span: (40, 45, 3), + span: Span(40, 45, 3), }, generic_params: None, is_type_choice_alternate: false, @@ -134,11 +134,11 @@ fn verify_cddl() -> Result<()> { type1: Type1 { type2: Type2::UintValue { value: 500, - span: (48, 51, 3), + span: Span(48, 51, 3), }, operator: None, comments_after_type: None, - span: (48, 51, 3), + span: Span(48, 51, 3), }, comments_before_type: None, comments_after_type: None, @@ -147,30 +147,30 @@ fn verify_cddl() -> Result<()> { type1: Type1 { type2: Type2::UintValue { value: 600, - span: (54, 57, 3), + span: Span(54, 57, 3), }, operator: None, comments_after_type: None, - span: (54, 57, 3), + span: Span(54, 57, 3), }, comments_before_type: None, comments_after_type: None, }, ], - span: (48, 57, 3), + span: Span(48, 57, 3), }, comments_before_assignt: None, comments_after_assignt: None, }, comments_after_rule: None, - span: (40, 57, 3), + span: Span(40, 57, 3), }, Rule::Group { rule: Box::from(GroupRule { name: Identifier { ident: "gr".into(), socket: None, - span: (58, 60, 4), + span: Span(58, 60, 4), }, generic_params: None, is_group_choice_alternate: false, @@ -179,7 +179,7 @@ fn verify_cddl() -> Result<()> { occur: Occur::Exact { lower: Some(2), upper: None, - span: (63, 65, 4), + span: Span(63, 65, 4), }, comments: None, _a: PhantomData::default(), @@ -193,13 +193,13 @@ fn verify_cddl() -> Result<()> { name: Identifier { ident: "test".into(), socket: None, - span: (68, 72, 4), + span: Span(68, 72, 4), }, generic_args: None, }, leading_comments: None, trailing_comments: None, - span: (68, 72, 4), + span: Span(68, 72, 4), }, OptionalComma { optional_comma: false, @@ -208,26 +208,26 @@ fn verify_cddl() -> Result<()> { }, )], comments_before_grpchoice: None, - span: (68, 72, 4), + span: Span(68, 72, 4), }], - span: (68, 72, 4), + span: Span(68, 72, 4), }, comments_before_group: None, comments_after_group: None, - span: (63, 74, 4), + span: Span(63, 74, 4), }, comments_before_assigng: None, comments_after_assigng: None, }), comments_after_rule: None, - span: (58, 74, 4), + span: Span(58, 74, 4), }, Rule::Type { rule: TypeRule { name: Identifier { ident: "messages".into(), socket: None, - span: (75, 83, 5), + span: Span(75, 83, 5), }, generic_params: None, is_type_choice_alternate: false, @@ -238,7 +238,7 @@ fn verify_cddl() -> Result<()> { ident: Identifier { ident: "message".into(), socket: None, - span: (86, 93, 5), + span: Span(86, 93, 5), }, generic_args: Some(GenericArgs { args: vec![ @@ -246,11 +246,11 @@ fn verify_cddl() -> Result<()> { arg: Box::from(Type1 { type2: Type2::TextValue { value: "reboot".into(), - span: (94, 102, 5), + span: Span(94, 102, 5), }, operator: None, comments_after_type: None, - span: (94, 102, 5), + span: Span(94, 102, 5), }), comments_before_type: None, comments_after_type: None, @@ -259,42 +259,42 @@ fn verify_cddl() -> Result<()> { arg: Box::from(Type1 { type2: Type2::TextValue { value: "now".into(), - span: (104, 109, 5), + span: Span(104, 109, 5), }, operator: None, comments_after_type: None, - span: (104, 109, 5), + span: Span(104, 109, 5), }), comments_before_type: None, comments_after_type: None, }, ], - span: (93, 110, 5), + span: Span(93, 110, 5), }), - span: (86, 110, 5), + span: Span(86, 110, 5), }, operator: None, comments_after_type: None, - span: (86, 110, 5), + span: Span(86, 110, 5), }, comments_before_type: None, comments_after_type: None, }], - span: (86, 110, 5), + span: Span(86, 110, 5), }, comments_before_assignt: None, comments_after_assignt: None, }, comments_after_rule: None, - span: (75, 110, 5), + span: Span(75, 110, 5), }, Rule::Type { rule: TypeRule { name: Identifier { ident: "message".into(), socket: None, - span: (111, 118, 6), + span: Span(111, 118, 6), }, generic_params: Some(GenericParams { params: vec![ @@ -302,7 +302,7 @@ fn verify_cddl() -> Result<()> { param: Identifier { ident: "t".into(), socket: None, - span: (119, 120, 6), + span: Span(119, 120, 6), }, comments_before_ident: None, comments_after_ident: None, @@ -311,13 +311,13 @@ fn verify_cddl() -> Result<()> { param: Identifier { ident: "v".into(), socket: None, - span: (122, 123, 6), + span: Span(122, 123, 6), }, comments_before_ident: None, comments_after_ident: None, }, ], - span: (118, 124, 6), + span: Span(118, 124, 6), }), is_type_choice_alternate: false, value: Type { @@ -335,32 +335,32 @@ fn verify_cddl() -> Result<()> { ident: Identifier { ident: "type".into(), socket: None, - span: (128, 132, 6), + span: Span(128, 132, 6), }, comments: None, comments_after_colon: None, - span: (128, 133, 6), + span: Span(128, 133, 6), }), entry_type: Type { type_choices: vec![TypeChoice { type1: Type1 { type2: Type2::UintValue { value: 2, - span: (134, 135, 6), + span: Span(134, 135, 6), }, operator: None, comments_after_type: None, - span: (134, 135, 6), + span: Span(134, 135, 6), }, comments_before_type: None, comments_after_type: None, }], - span: (134, 135, 6), + span: Span(134, 135, 6), }, }), leading_comments: None, trailing_comments: None, - span: (128, 136, 6), + span: Span(128, 136, 6), }, OptionalComma { optional_comma: true, @@ -376,11 +376,11 @@ fn verify_cddl() -> Result<()> { ident: Identifier { ident: "value".into(), socket: None, - span: (137, 142, 6), + span: Span(137, 142, 6), }, comments: None, comments_after_colon: None, - span: (137, 143, 6), + span: Span(137, 143, 6), }), entry_type: Type { type_choices: vec![TypeChoice { @@ -389,24 +389,24 @@ fn verify_cddl() -> Result<()> { ident: Identifier { ident: "v".into(), socket: None, - span: (144, 145, 6), + span: Span(144, 145, 6), }, generic_args: None, - span: (144, 145, 6), + span: Span(144, 145, 6), }, operator: None, comments_after_type: None, - span: (144, 145, 6), + span: Span(144, 145, 6), }, comments_before_type: None, comments_after_type: None, }], - span: (144, 145, 6), + span: Span(144, 145, 6), }, }), leading_comments: None, trailing_comments: None, - span: (137, 145, 6), + span: Span(137, 145, 6), }, OptionalComma { optional_comma: false, @@ -416,35 +416,35 @@ fn verify_cddl() -> Result<()> { ), ], comments_before_grpchoice: None, - span: (128, 145, 6), + span: Span(128, 145, 6), }], - span: (128, 145, 6), + span: Span(128, 145, 6), }, comments_before_group: None, comments_after_group: None, - span: (127, 146, 6), + span: Span(127, 146, 6), }, operator: None, comments_after_type: None, - span: (127, 146, 6), + span: Span(127, 146, 6), }, comments_before_type: None, comments_after_type: None, }], - span: (127, 146, 6), + span: Span(127, 146, 6), }, comments_before_assignt: None, comments_after_assignt: None, }, comments_after_rule: None, - span: (111, 146, 6), + span: Span(111, 146, 6), }, Rule::Type { rule: TypeRule { name: Identifier { ident: "color".into(), socket: None, - span: (147, 152, 7), + span: Span(147, 152, 7), }, generic_params: None, is_type_choice_alternate: false, @@ -455,33 +455,33 @@ fn verify_cddl() -> Result<()> { ident: Identifier { ident: "colors".into(), socket: None, - span: (156, 162, 7), + span: Span(156, 162, 7), }, generic_args: None, comments: None, - span: (155, 162, 7), + span: Span(155, 162, 7), }, operator: None, comments_after_type: None, - span: (155, 162, 7), + span: Span(155, 162, 7), }, comments_before_type: None, comments_after_type: None, }], - span: (155, 162, 7), + span: Span(155, 162, 7), }, comments_before_assignt: None, comments_after_assignt: None, }, comments_after_rule: None, - span: (147, 162, 7), + span: Span(147, 162, 7), }, Rule::Group { rule: Box::from(GroupRule { name: Identifier { ident: "colors".into(), socket: None, - span: (163, 169, 8), + span: Span(163, 169, 8), }, generic_params: None, is_group_choice_alternate: false, @@ -497,32 +497,32 @@ fn verify_cddl() -> Result<()> { ident: Identifier { ident: "red".into(), socket: None, - span: (174, 177, 8), + span: Span(174, 177, 8), }, comments: None, comments_after_colon: None, - span: (174, 178, 8), + span: Span(174, 178, 8), }), entry_type: Type { type_choices: vec![TypeChoice { type1: Type1 { type2: Type2::TextValue { value: "red".into(), - span: (179, 184, 8), + span: Span(179, 184, 8), }, operator: None, comments_after_type: None, - span: (179, 184, 8), + span: Span(179, 184, 8), }, comments_before_type: None, comments_after_type: None, }], - span: (179, 184, 8), + span: Span(179, 184, 8), }, }), leading_comments: None, trailing_comments: None, - span: (174, 184, 8), + span: Span(174, 184, 8), }, OptionalComma { optional_comma: false, @@ -531,26 +531,26 @@ fn verify_cddl() -> Result<()> { }, )], comments_before_grpchoice: None, - span: (174, 184, 8), + span: Span(174, 184, 8), }], - span: (174, 184, 8), + span: Span(174, 184, 8), }, comments_before_group: None, comments_after_group: None, - span: (172, 186, 8), + span: Span(172, 186, 8), }, comments_before_assigng: None, comments_after_assigng: None, }), comments_after_rule: None, - span: (163, 186, 8), + span: Span(163, 186, 8), }, Rule::Type { rule: TypeRule { name: Identifier { ident: "test".into(), socket: None, - span: (187, 191, 9), + span: Span(187, 191, 9), }, generic_params: None, is_type_choice_alternate: false, @@ -566,14 +566,14 @@ fn verify_cddl() -> Result<()> { ident: Identifier { ident: "int".into(), socket: None, - span: (196, 199, 9), + span: Span(196, 199, 9), }, generic_args: None, - span: (196, 199, 9), + span: Span(196, 199, 9), }, operator: None, comments_after_type: None, - span: (196, 199, 9), + span: Span(196, 199, 9), }, comments_before_type: None, comments_after_type: None, @@ -584,40 +584,40 @@ fn verify_cddl() -> Result<()> { ident: Identifier { ident: "float".into(), socket: None, - span: (202, 207, 9), + span: Span(202, 207, 9), }, generic_args: None, - span: (202, 207, 9), + span: Span(202, 207, 9), }, operator: None, comments_after_type: None, - span: (202, 207, 9), + span: Span(202, 207, 9), }, comments_before_type: None, comments_after_type: None, }, ], - span: (196, 207, 9), + span: Span(196, 207, 9), }, comments_before_type: None, comments_after_type: None, - span: (194, 209, 9), + span: Span(194, 209, 9), }, operator: None, comments_after_type: None, - span: (194, 210, 9), + span: Span(194, 210, 9), }, comments_before_type: None, comments_after_type: None, }], - span: (194, 210, 9), + span: Span(194, 210, 9), }, comments_before_assignt: None, comments_after_assignt: None, }, comments_after_rule: None, - span: (187, 210, 9), + span: Span(187, 210, 9), }, ], comments: None,