match_for_balanced_group

Function match_for_balanced_group 

Source
pub fn match_for_balanced_group<'a, V1, T1, V2, T2>(
    tokenizer: &mut Scanner<'a, u8>,
    balance: &mut usize,
    start: T1,
    end: T2,
) -> ParseResult<()>
where T1: Recognizable<'a, u8, V1> + Copy, T2: Recognizable<'a, u8, V2> + Copy,
Expand description

Try to recognize either a start group or an end group token.

If the start group token is recognized, increment the balancing counter. If the end group token is recognized, decrement the balancing counter. If neither is recognized, move the tokenizer by one byte.

§Arguments

  • tokenizer - The tokenizer to use
  • balance - A mutable reference to the balancing counter
  • start - The start group token to recognize
  • end - The end group token to recognize

§Errors

Returns Err(ParseError) if the tokenizer encounters an error.

§Examples