From 41fc406af206e21014eaaba94bcf6b1854f892b3 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 22 Jul 2022 15:03:15 +0200 Subject: Refactor to pass ints instead of vecs around --- src/construct/attention.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/construct/attention.rs') diff --git a/src/construct/attention.rs b/src/construct/attention.rs index 38164a8..42c0965 100644 --- a/src/construct/attention.rs +++ b/src/construct/attention.rs @@ -175,7 +175,7 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code) -> StateFnResult { tokenizer.enter(Token::AttentionSequence); inside(tokenizer, code, MarkerKind::from_code(code)) } - _ => (State::Nok, None), + _ => (State::Nok, 0), } } @@ -189,12 +189,12 @@ fn inside(tokenizer: &mut Tokenizer, code: Code, marker: MarkerKind) -> StateFnR match code { Code::Char(char) if char == marker.as_char() => { tokenizer.consume(code); - (State::Fn(Box::new(move |t, c| inside(t, c, marker))), None) + (State::Fn(Box::new(move |t, c| inside(t, c, marker))), 0) } _ => { tokenizer.exit(Token::AttentionSequence); tokenizer.register_resolver("attention".to_string(), Box::new(resolve_attention)); - (State::Ok, Some(vec![code])) + (State::Ok, if matches!(code, Code::None) { 0 } else { 1 }) } } } -- cgit