zom-lang / zom

Zom is a Ahead Of Time compiled system programming language.
Other
4 stars 2 forks source link

Replace anyhow error with custom errors #30

Closed Larsouille25 closed 1 year ago

Larsouille25 commented 1 year ago

In the binary zom, replace all anyhow errors with custom made errors in zom_common.

To facilitate debugging of the code and why there is errors,

In another branch,

Larsouille25 commented 1 year ago

Instead of having custom struct that implement the ZomError trait; Transform ZomError to a struct. Actual struct like IllegalCharError will be replaced by a function that create a new ZomError with the right parameters

Larsouille25 commented 1 year ago

It's said in e769064 that the parser can partialy return multiple errors, it's normal and it can only return multiple errors when an unexpected token is in the while let loop of the function parse() because after the smaller function need to return something and for the moment I don't know how to do it.

But it's planed to when an error occur while parsing a function definition or declaration, to skip tokens related to this AST and push the error into the list and continue parse other function definition / declaration etc ...