Skip to content

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

@rscarson

Description

@rscarson

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

  • Create a grammar with a prefix operator, for example "-", and a literal
  • Do not map this operator with pratt
  • Attempt to use the operator; "-1" for example

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions