From 281bbd9a86ad6fbb872ebac34bcb9f00a5038f51 Mon Sep 17 00:00:00 2001 From: Sebastian Walter Date: Tue, 15 Oct 2024 11:44:31 +0200 Subject: [PATCH] update exception format for lr1 --- text-utils-grammar/src/lr1.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/text-utils-grammar/src/lr1.rs b/text-utils-grammar/src/lr1.rs index 3d2765f..e7bb12e 100644 --- a/text-utils-grammar/src/lr1.rs +++ b/text-utils-grammar/src/lr1.rs @@ -505,7 +505,8 @@ impl LR1GrammarParser { Action::Error => { let (t_start, t_end) = span; return Err(format!( - "parse error from position {t_start} for token {t_name} ({la_tidx:?}) with content '{}'", + "parse error at position {t_start} for token {t_name} with content '{}' \ + (the input most likely does not follow the grammar)", String::from_utf8_lossy(&input[t_start..t_end]) ) .into());