yhirose / go-peg

Yet another PEG (Parsing Expression Grammars) parser generator for Go
MIT License
63 stars 8 forks source link

Updater error reporting architecture, to support more informative err… #8

Closed CWood1 closed 3 years ago

CWood1 commented 5 years ago

…or messages.

Known limitations on this update:

yhirose commented 5 years ago

@CWood1, thanks for the PR. Since it's a series of massive changes, it seems like it will take time for me to digest all the details. Could you explain what you are trying to do with the changes? Thanks!

CWood1 commented 5 years ago

Sure. In a nutshell, for each of the Opes, l=-1 is no longer the error condition. Instead, each ope returns (int, error). If an error occurs, l=0, and err != nil.

The rest of the changes are supporting changes to set this in place - error types, functions to pull out various pieces of information, etc.

The opes that need special attention are Oom and Zom, for the reasons in the commit message, and Cho, because that returns an error if all children return errors, and its error is a special type that combines all of the child errors into one.