Skip to content

Commit 508cb9b

Browse files
committed
Fix spans on %empty
1 parent c64dd7f commit 508cb9b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cfgrammar/src/lib/yacc/parser.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -848,9 +848,8 @@ impl YaccParser {
848848
if !(self.lookahead_is("|", i).is_some() || self.lookahead_is(";", i).is_some()) {
849849
return Err(self.mk_error(YaccGrammarErrorKind::ProductionNotTerminated, i));
850850
}
851-
} else if let Some(mut j) = self.lookahead_is("%empty", i) {
851+
} else if let Some(j) = self.lookahead_is("%empty", i) {
852852
let k = self.parse_ws(j, true)?;
853-
j = self.parse_ws(j, true)?;
854853
// %empty could be followed by all sorts of weird syntax errors: all we try and do
855854
// is say "does this production look like it's finished" and trust that the other
856855
// errors will be caught by other parts of the parser.
@@ -2839,7 +2838,7 @@ B";
28392838
Expr: %empty | Factor;
28402839
Factor: ')' Expr ')';
28412840
",
2842-
(0, Some(Span::new(21, 28))),
2841+
(0, Some(Span::new(21, 27))),
28432842
),
28442843
(
28452844
"%start Expr

0 commit comments

Comments
 (0)