diff --git a/cfgrammar/src/lib/yacc/parser.rs b/cfgrammar/src/lib/yacc/parser.rs index 22a1a1835..3bac4398e 100644 --- a/cfgrammar/src/lib/yacc/parser.rs +++ b/cfgrammar/src/lib/yacc/parser.rs @@ -823,7 +823,7 @@ impl YaccParser { ':' => { let k = j + ':'.len_utf8(); if k == self.src.len() || !self.src[k..].starts_with(':') { - return Ok((j, self.src[i..j].to_string())); + return Ok((j, self.src[i..j].trim().to_string())); } j += 2 * ':'.len_utf8(); } diff --git a/lrpar/cttests/src/parseparam_copy.test b/lrpar/cttests/src/parseparam_copy.test index ecf3b9648..330ae1b4b 100644 --- a/lrpar/cttests/src/parseparam_copy.test +++ b/lrpar/cttests/src/parseparam_copy.test @@ -9,7 +9,12 @@ grammar: | // Since then we relaxed the bounds to require `Clone`. // This tests backwards compatibility of actions that // rely on the older copy bounds. - 'INT' { (move |_| {})(p); check_copy(p); p + $lexer.span_str($1.unwrap().span()).parse::().unwrap() } + 'INT' { + #[allow(clippy::redundant_closure_call)] + (move |_| {})(p); + check_copy(p); + p + $lexer.span_str($1.unwrap().span()).parse::().unwrap() + } ; %% fn check_copy(_: T){}