lean4-htt/tests/lean/1971.lean.expected.out
David Thrane Christiansen 74e7886ce7
feat: custom error recovery in parser (#3413)
Adds a simple error-recovery mechanism to Lean's parser, similar to
those used in other combinator parsing libraries.

Lean itself isn't very amenable to error recovery with this mechanism,
as it requires global knowledge of the grammar in question to write
recovery rules that don't break backtracking or `<|>`. I only found a
few opportunities.

But for DSLs, this is really important. In particular, Verso parse
errors interacted very badly with Lean parse errors in a way that
required frequent "restart file" commands, but this mechanism allows me
to both recover from Verso parse errors and to have Lean skip the rest
of the file rather than repeatedly trying to parse it as Lean commands.
2024-02-21 14:29:54 +00:00

7 lines
521 B
Text

1971.lean:14:7-16:7: error: unexpected token 'theorem'; expected term
1971.lean:22:6-24:3: error: unexpected token 'def'; expected ':=', 'where' or '|'
1971.lean:30:9-30:13: error: unexpected token 'def'; expected term
1971.lean:34:9-36:7: error: unexpected token 'example'; expected identifier
1971.lean:36:11-36:12: error: unexpected token; expected command
1971.lean:39:17-41:7: error: unexpected token 'example'; expected 'false', 'true', numeral or string literal
1971.lean:45:11: error: unterminated string literal