igordejanovic / parglare

A pure Python LR/GLR parser - http://www.igordejanovic.net/parglare/
MIT License
136 stars 32 forks source link

Better error reporting #21

Closed igordejanovic closed 6 years ago

igordejanovic commented 6 years ago

Error message should be based on a full parser state at the position in the input where parsing failed and not only on the current LR state. In GLR error should be reported based on a set of heads (i.e. their full state) that failed furthest in the input stream.

This boils down to filtering out all invalid LR items in the current state based on the previous states on the parser stack(s).

igordejanovic commented 6 years ago

WIP on error-reporting-rework branch.

igordejanovic commented 6 years ago

Parglare should be able to report accurate expected symbols at the location, what it sees ahead (if possible to deduce) and what it saw before.

igordejanovic commented 6 years ago

Done on master. ParseError now have all the info.