diff --git a/src/parser/angle_link.rs b/src/parser/angle_link.rs index 0e04278..ea10fbd 100644 --- a/src/parser/angle_link.rs +++ b/src/parser/angle_link.rs @@ -44,7 +44,7 @@ fn path_angle<'r, 's>( ) -> Res, OrgSource<'s>> { let parser_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &path_angle_end, })); diff --git a/src/parser/citation.rs b/src/parser/citation.rs index e19938b..ffce49a 100644 --- a/src/parser/citation.rs +++ b/src/parser/citation.rs @@ -90,7 +90,7 @@ fn global_prefix<'r, 's>( depth: 0, })) .with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &global_prefix_end, })); let (remaining, (children, _exit_contents)) = verify( @@ -151,7 +151,7 @@ fn global_suffix<'r, 's>( depth: 0, })) .with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &global_suffix_end, })); let (remaining, (children, _exit_contents)) = verify( diff --git a/src/parser/citation_reference.rs b/src/parser/citation_reference.rs index ed18a65..b854f6f 100644 --- a/src/parser/citation_reference.rs +++ b/src/parser/citation_reference.rs @@ -76,7 +76,7 @@ fn key_prefix<'r, 's>( depth: 0, })) .with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &key_prefix_end, })); let (remaining, (children, _exit_contents)) = verify( @@ -101,7 +101,7 @@ fn key_suffix<'r, 's>( depth: 0, })) .with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &key_suffix_end, })); let (remaining, (children, _exit_contents)) = verify( diff --git a/src/parser/exiting.rs b/src/parser/exiting.rs index a7e3fa7..6f8c359 100644 --- a/src/parser/exiting.rs +++ b/src/parser/exiting.rs @@ -8,6 +8,9 @@ pub enum ExitClass { /// Elements who cede priority to alpha elements when matching. Beta = 300, + + /// Elements who cede priority to alpha and beta elements when matching. + Gamma = 4000, } impl std::fmt::Display for ExitClass { diff --git a/src/parser/export_snippet.rs b/src/parser/export_snippet.rs index 0725684..9351929 100644 --- a/src/parser/export_snippet.rs +++ b/src/parser/export_snippet.rs @@ -27,7 +27,7 @@ pub fn export_snippet<'r, 's>( let (remaining, backend_name) = backend(context, remaining)?; let parser_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &export_snippet_end, })); let (remaining, backend_contents) = opt(tuple(( diff --git a/src/parser/inline_babel_call.rs b/src/parser/inline_babel_call.rs index 36f62b6..a1ed4e3 100644 --- a/src/parser/inline_babel_call.rs +++ b/src/parser/inline_babel_call.rs @@ -49,7 +49,7 @@ fn name<'r, 's>( ) -> Res, OrgSource<'s>> { let parser_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &name_end, })); let (remaining, name) = recognize(many_till( @@ -80,7 +80,7 @@ fn header<'r, 's>( depth: 0, })) .with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &header_end, })); @@ -131,7 +131,7 @@ fn argument<'r, 's>( depth: 0, })) .with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &argument_end, })); diff --git a/src/parser/paragraph.rs b/src/parser/paragraph.rs index 9591706..15b449d 100644 --- a/src/parser/paragraph.rs +++ b/src/parser/paragraph.rs @@ -28,7 +28,7 @@ pub fn paragraph<'r, 's>( ) -> Res, Paragraph<'s>> { let parser_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: ¶graph_end, })); let standard_set_object_matcher = parser_with_context!(standard_set_object)(&parser_context); diff --git a/src/parser/parser_context.rs b/src/parser/parser_context.rs index 4ee2a76..83760ae 100644 --- a/src/parser/parser_context.rs +++ b/src/parser/parser_context.rs @@ -62,7 +62,7 @@ impl<'r, 's> ContextTree<'r, 's> { // exit_matcher: ChainBehavior::IgnoreParent(Some(&always_fail)), // })); - let mut current_class_filter = ExitClass::Beta; + let mut current_class_filter = ExitClass::Gamma; for current_node in self.iter() { let context_element = current_node.get_data(); match context_element { diff --git a/src/parser/plain_link.rs b/src/parser/plain_link.rs index 4aa097c..58617ea 100644 --- a/src/parser/plain_link.rs +++ b/src/parser/plain_link.rs @@ -113,7 +113,7 @@ fn path_plain<'r, 's>( // TODO: "optionally containing parenthesis-wrapped non-whitespace non-bracket substrings up to a depth of two. The string must end with either a non-punctation non-whitespace character, a forwards slash, or a parenthesis-wrapped substring" let parser_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &path_plain_end, })); diff --git a/src/parser/radio_link.rs b/src/parser/radio_link.rs index 5a62240..6e121dd 100644 --- a/src/parser/radio_link.rs +++ b/src/parser/radio_link.rs @@ -91,7 +91,7 @@ pub fn radio_target<'r, 's>( let (remaining, _opening) = tag("<<<")(input)?; let parser_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &radio_target_end, })); diff --git a/src/parser/subscript_and_superscript.rs b/src/parser/subscript_and_superscript.rs index cd10167..43978da 100644 --- a/src/parser/subscript_and_superscript.rs +++ b/src/parser/subscript_and_superscript.rs @@ -162,7 +162,7 @@ fn script_with_braces<'r, 's>( }, )) .with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &script_with_braces_end, })); diff --git a/src/parser/text_markup.rs b/src/parser/text_markup.rs index ce8cf96..d198457 100644 --- a/src/parser/text_markup.rs +++ b/src/parser/text_markup.rs @@ -179,7 +179,7 @@ fn _text_markup_object<'r, 's, 'x>( let text_markup_end_specialized = text_markup_end(open.into()); let parser_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &text_markup_end_specialized, })); @@ -229,7 +229,7 @@ fn _text_markup_string<'r, 's, 'x>( let text_markup_end_specialized = text_markup_end(open.into()); let parser_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &text_markup_end_specialized, })); @@ -338,7 +338,7 @@ fn _rematch_text_markup_object<'r, 's, 'x>( let text_markup_end_specialized = text_markup_end(open.into()); let parser_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &text_markup_end_specialized, })); diff --git a/src/parser/timestamp.rs b/src/parser/timestamp.rs index e3dc8df..2814716 100644 --- a/src/parser/timestamp.rs +++ b/src/parser/timestamp.rs @@ -67,7 +67,7 @@ fn sexp<'r, 's>( ) -> Res, OrgSource<'s>> { let parser_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &sexp_end, })); @@ -99,7 +99,7 @@ fn active_timestamp<'r, 's>( let (remaining, _date) = date(context, remaining)?; let time_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &active_time_rest_end, })); let (remaining, _time) = @@ -132,7 +132,7 @@ fn inactive_timestamp<'r, 's>( let (remaining, _date) = date(context, remaining)?; let time_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &inactive_time_rest_end, })); let (remaining, _time) = @@ -186,12 +186,12 @@ fn active_time_range_timestamp<'r, 's>( let (remaining, _date) = date(context, remaining)?; let time_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &active_time_rest_end, })); let first_time_context = time_context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &time_range_rest_end, })); let (remaining, _first_time) = @@ -247,12 +247,12 @@ fn inactive_time_range_timestamp<'r, 's>( let (remaining, _date) = date(context, remaining)?; let time_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &inactive_time_rest_end, })); let first_time_context = time_context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &time_range_rest_end, })); let (remaining, _first_time) = @@ -303,7 +303,7 @@ fn dayname<'r, 's>( ) -> Res, OrgSource<'s>> { let parser_context = context.with_additional_node(ContextElement::ExitMatcherNode(ExitMatcherNode { - class: ExitClass::Beta, + class: ExitClass::Gamma, exit_matcher: &dayname_end, }));