Closed Larsouille25 closed 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
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 ...
In the binary
zom
, replace all anyhow errors with custom made errors inzom_common
.with a "reverse lexer"ZomError
struct,Error
trait.location
optional.IllegalCharError
with a function (or macro) that create a new ZomError.EOF
tokenzom
, replace anyhow errors with ZomError.anyhow = { version = "1.0.71", default-features = false }
, inzom/Cargo.toml
To facilitate debugging of the code and why there is errors,
Vec<Result<..,..>>
instead ofResult<vec<..>,..>
Result<(Vec<ASTNode>, Vec<Token>), ZomError>
toResult<Vec<ASTNode>, Vec<ZomError>>
-> https://github.com/zom-lang/zom/issues/30#issuecomment-1669418927And try for the compiler and the codegen too if it's possible-> #44In another branch,
try to replace PartParsingResult with Result.-> https://github.com/zom-lang/zom/issues/30#issuecomment-1669418927