yhirose / cpp-peglib

A single file C++ header-only PEG (Parsing Expression Grammars) library
MIT License
879 stars 112 forks source link

[Question] Is there a way to receive typed errors (not just strings with error messages)? #272

Open curldivergence opened 1 year ago

curldivergence commented 1 year ago

Hi! Thanks a lot for the amazing library, it's working really well for me :) But I have a question though - if I wanted to return an enum class with different types of syntax errors from the parser, what is the best way to achieve that? Right now I can only think of parsing the strings I receive in the logger callback to infer the type from them, but it feels very hacky to me :) So is there any chance you could suggest a better approach?

Thank you!