From 3a90a49518bbc53876d3f46d8763b2fe0f03d789 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Wed, 10 Aug 2022 10:54:43 +0200 Subject: Add `State::Retry` --- src/construct/code_text.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/construct/code_text.rs') diff --git a/src/construct/code_text.rs b/src/construct/code_text.rs index 729abe5..2c8faf3 100644 --- a/src/construct/code_text.rs +++ b/src/construct/code_text.rs @@ -105,7 +105,7 @@ pub fn start(tokenizer: &mut Tokenizer) -> State { { tokenizer.enter(Token::CodeText); tokenizer.enter(Token::CodeTextSequence); - sequence_open(tokenizer) + State::Retry(StateName::CodeTextSequenceOpen) } _ => State::Nok, } @@ -124,7 +124,7 @@ pub fn sequence_open(tokenizer: &mut Tokenizer) -> State { State::Next(StateName::CodeTextSequenceOpen) } else { tokenizer.exit(Token::CodeTextSequence); - between(tokenizer) + State::Retry(StateName::CodeTextBetween) } } @@ -148,11 +148,11 @@ pub fn between(tokenizer: &mut Tokenizer) -> State { } Some(b'`') => { tokenizer.enter(Token::CodeTextSequence); - sequence_close(tokenizer) + State::Retry(StateName::CodeTextSequenceClose) } _ => { tokenizer.enter(Token::CodeTextData); - data(tokenizer) + State::Retry(StateName::CodeTextData) } } } @@ -167,7 +167,7 @@ pub fn data(tokenizer: &mut Tokenizer) -> State { match tokenizer.current { None | Some(b'\n' | b'`') => { tokenizer.exit(Token::CodeTextData); - between(tokenizer) + State::Retry(StateName::CodeTextBetween) } _ => { tokenizer.consume(); @@ -203,7 +203,7 @@ pub fn sequence_close(tokenizer: &mut Tokenizer) -> State { tokenizer.events[index - 1].token_type = Token::CodeTextData; tokenizer.events[index].token_type = Token::CodeTextData; tokenizer.tokenize_state.size_other = 0; - between(tokenizer) + State::Retry(StateName::CodeTextBetween) } } } -- cgit