Merge branch 'target_properties'
This commit is contained in:
		
						commit
						c49455e9ce
					
				| @ -3739,20 +3739,41 @@ fn compare_line_break<'b, 's>( | ||||
| } | ||||
| 
 | ||||
| fn compare_target<'b, 's>( | ||||
|     _source: &'s str, | ||||
|     source: &'s str, | ||||
|     emacs: &'b Token<'s>, | ||||
|     rust: &'b Target<'s>, | ||||
| ) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> { | ||||
|     let this_status = DiffStatus::Good; | ||||
|     let message = None; | ||||
|     let mut this_status = DiffStatus::Good; | ||||
|     let mut child_status = Vec::new(); | ||||
|     let mut message = None; | ||||
| 
 | ||||
|     // TODO: Compare :value
 | ||||
|     assert_no_children(emacs, &mut this_status, &mut message)?; | ||||
| 
 | ||||
|     for diff in compare_properties!( | ||||
|         source, | ||||
|         emacs, | ||||
|         rust, | ||||
|         ( | ||||
|             EmacsField::Required(":value"), | ||||
|             |r| Some(r.value), | ||||
|             compare_property_quoted_string | ||||
|         ) | ||||
|     ) { | ||||
|         match diff { | ||||
|             ComparePropertiesResult::NoChange => {} | ||||
|             ComparePropertiesResult::SelfChange(new_status, new_message) => { | ||||
|                 this_status = new_status; | ||||
|                 message = new_message | ||||
|             } | ||||
|             ComparePropertiesResult::DiffEntry(diff_entry) => child_status.push(diff_entry), | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     Ok(DiffResult { | ||||
|         status: this_status, | ||||
|         name: rust.get_elisp_name(), | ||||
|         message, | ||||
|         children: Vec::new(), | ||||
|         children: child_status, | ||||
|         rust_source: rust.get_source(), | ||||
|         emacs_token: emacs, | ||||
|     } | ||||
|  | ||||
| @ -4,12 +4,10 @@ use nom::character::complete::one_of; | ||||
| use nom::combinator::peek; | ||||
| use nom::combinator::recognize; | ||||
| use nom::combinator::verify; | ||||
| use nom::multi::many_till; | ||||
| 
 | ||||
| use super::org_source::OrgSource; | ||||
| use super::util::exit_matcher_parser; | ||||
| use super::util::maybe_consume_object_trailing_whitespace_if_not_exiting; | ||||
| use crate::context::parser_with_context; | ||||
| use super::util::text_until_exit; | ||||
| use crate::context::ContextElement; | ||||
| use crate::context::ExitClass; | ||||
| use crate::context::ExitMatcherNode; | ||||
| @ -38,10 +36,7 @@ pub(crate) fn target<'b, 'g, 'r, 's>( | ||||
|         exit_matcher: &target_end, | ||||
|     }); | ||||
|     let parser_context = context.with_additional_node(&parser_context); | ||||
|     let (remaining, _body) = recognize(many_till( | ||||
|         anychar, | ||||
|         parser_with_context!(exit_matcher_parser)(&parser_context), | ||||
|     ))(remaining)?; | ||||
|     let (remaining, body) = text_until_exit(&parser_context, remaining)?; | ||||
| 
 | ||||
|     let preceding_character = remaining | ||||
|         .get_preceding_character() | ||||
| @ -60,6 +55,7 @@ pub(crate) fn target<'b, 'g, 'r, 's>( | ||||
|         remaining, | ||||
|         Target { | ||||
|             source: source.into(), | ||||
|             value: body.into(), | ||||
|         }, | ||||
|     )) | ||||
| } | ||||
|  | ||||
| @ -240,6 +240,7 @@ pub struct LineBreak<'s> { | ||||
| #[derive(Debug, PartialEq)] | ||||
| pub struct Target<'s> { | ||||
|     pub source: &'s str, | ||||
|     pub value: &'s str, | ||||
| } | ||||
| 
 | ||||
| #[derive(Debug, PartialEq)] | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Tom Alexander
						Tom Alexander