Here is a list of things, we can change to improve error handling in the zom compiler :
[x] create the crate zom_errors
[x] create a struct LogStream it would contain a vector of BuiltLog with methods ->
add; push a BuiltLog into the vector.
add_built ??; build a BuiltLog from a passed Log and push into the vector
failed; return true if their is at least one error into the vector of logs, else false
render: writer, colored; render the vector of logs to the writer, with colors if colored is true
[x] create an enum / struct Log that would contain all possible parsing error, with a dummy one: Custom to create custom errors where there is not a logkind and creating a logkind would be overkill. Logs will share to common fields : a reference counted to the file content and a RC to the file path. In general a log kind will take a location into the code.
build; converts Log into BuiltLog
[x] create a struct BuiltLog containing a kind : warning / error / error with an error code, a description, an optional help message and a vector of note (a string). In general a BuiltLog is kinda dummy, it contains the line where the log cursor point, the cursor (just a range). A BuiltLog is an intermediate simple representation of a log.
render: writer, colored; render the BuiltLog to the writer, with colors if colored is true
[x] replace the enum Log with a trait and make ExpectedToken and UnclosedDelimiter structs that implements the Log trait and then use it in the builder for the log
[x] create a prelude
[ ] allow errors on multiple lines
[x] replace the old error system with the new one.
Here is a list of things, we can change to improve error handling in the zom compiler :
zom_errors
LogStream
it would contain a vector ofBuiltLog
with methods ->BuiltLog
into the vector.BuiltLog
from a passedLog
and push into the vectorLog
that would contain all possible parsing error, with a dummy one:Custom
to create custom errors where there is not a logkind and creating a logkind would be overkill.Log
s will share to common fields : a reference counted to the file content and a RC to the file path. In general a log kind will take a location into the code.Log
intoBuiltLog
BuiltLog
containing a kind : warning / error / error with an error code, a description, an optional help message and a vector of note (a string). In general a BuiltLog is kinda dummy, it contains the line where the log cursor point, the cursor (just a range). A BuiltLog is an intermediate simple representation of a log.Log
with a trait and make ExpectedToken and UnclosedDelimiter structs that implements theLog
trait and then use it in the builder for the log