PistonDevelopers / meta

A DSL parsing library for human readable text documents
MIT License
90 stars 5 forks source link

Make `ParseError` contain formatted error message #272

Closed bvssvni closed 8 years ago

bvssvni commented 8 years ago

Currently, you need to call stderr_unwrap to display the error in the console. This makes the API a bit messy.

Could write the error to a String and store it in ParseError.

This could be done in parse, to avoid extra allocations when a rule backtracks. Return Result<Vec<(Range, MetaData)>, (Range, ParseError, String)>.

Could implement Display for (Range, ParseError, String) such that .unwrap() printed the formatted error to the console.

bvssvni commented 8 years ago

Closed in favor of https://github.com/PistonDevelopers/meta/issues/295.