diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-08-10 10:54:43 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-08-10 10:54:43 +0200 |
commit | 3a90a49518bbc53876d3f46d8763b2fe0f03d789 (patch) | |
tree | eecaaf9586cf8632b3b6fe22794dae1f492849f5 /src/construct/code_text.rs | |
parent | 8162222295d71ea7fd9270c7b3b9497b91db3f1f (diff) | |
download | markdown-rs-3a90a49518bbc53876d3f46d8763b2fe0f03d789.tar.gz markdown-rs-3a90a49518bbc53876d3f46d8763b2fe0f03d789.tar.bz2 markdown-rs-3a90a49518bbc53876d3f46d8763b2fe0f03d789.zip |
Add `State::Retry`
Diffstat (limited to 'src/construct/code_text.rs')
-rw-r--r-- | src/construct/code_text.rs | 12 |
1 files changed, 6 insertions, 6 deletions
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) } } } |