fix: formatter: must backtrack on symbols as well
This commit is contained in:
parent
21f1a66ceb
commit
69fe4c7338
1 changed files with 7 additions and 2 deletions
|
|
@ -264,8 +264,13 @@ else do {
|
|||
|
||||
@[combinatorFormatter symbol]
|
||||
def symbol.formatter (sym : String) : Formatter := do
|
||||
pushToken sym;
|
||||
goLeft
|
||||
stx ← getCur;
|
||||
if stx.isToken sym then do
|
||||
pushToken sym;
|
||||
goLeft
|
||||
else do
|
||||
trace! `PrettyPrinter.format.backtrack ("unexpected syntax '" ++ stx ++ "', expected symbol '" ++ sym ++ "'");
|
||||
throwBacktrack
|
||||
|
||||
@[combinatorFormatter symbolNoWs] def symbolNoWs.formatter := symbol.formatter
|
||||
@[combinatorFormatter nonReservedSymbol] def nonReservedSymbol.formatter := symbol.formatter
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue