Skip to content

Commit

Permalink
don't warn on mid_process() with [eos] or [] when stopped
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Aug 2, 2024
1 parent b76e9d3 commit a29b28f
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions parser/src/tokenparser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,22 @@ impl TokenParser {
pub fn mid_process(&mut self, mut arg: StepArg) -> StepResult {
self.mid_process_start_time = std::time::Instant::now();
if self.stop_reason != StopReason::NotStopped {
let trie = self.token_env.tok_trie();
infoln!(
self,
"stopped; post tokens: bt={} {}",
arg.backtrack,
trie.tokens_dbg(&arg.tokens)
);

if arg.backtrack == 0
&& (arg.tokens.len() == 0
|| (arg.tokens.len() == 1 && arg.tokens[0] == trie.eos_token()))
{
// Don't warn in this case
return StepResult::stop();
}

warn!(self, "stopped ({})", self.stop_reason.to_string());
return StepResult::stop();
}
Expand Down

0 comments on commit a29b28f

Please sign in to comment.