pest-parser / pest

The Elegant Parser
https://pest.rs
Apache License 2.0
4.67k stars 261 forks source link

Very unhelpful error messages for unmapped prefix operators in pratt parsers #980

Open rscarson opened 9 months ago

rscarson commented 9 months ago

Describe the bug Unmapped prefix operators panic at 'expected operator, found

For example "-1" panics with:

Expected operator, found int_literal

Instead of something like expected operator, found PREFIX_NEG

To Reproduce

Expected behavior The error message should report the correct symbol in the grammar, not the next one