Parse with errors - #34
Conversation
`(A,B)` -> `(A, B)`
Track the area of objects inside a source file.
`Error` reports a local problem. `RichError` reports a local problem in a broader context (file, line, column, start, end). The file is added to `RichError` last minute, after the parsing, because it is not locally available during parsing.
Display pretty errors from the PEST parser to the user. Adapt the compile / satisfy method in lib.rs and the CLI interface.
Display pretty errors from the parse tree generator to the user. Unwraps added in this commit are inside unit tests only.
Remove duplicate implementation of the compile function.
428e52f to
dbd1196
Compare
|
In 6bebb3862abbb93027cdbc5c4c5b575de7962c3d: I think it'd be better to move |
|
In 5807df7fca538fd6f5e0a0a7f014ba174102c41e: Why can't |
|
Renames in 576a62cceb580e2dc7a5b3c59fab0956d137e204 looks good |
|
In 705d2f6768e9a47b120aa6d68986ed888be9b03e: How does this variable factor relate to the existing one in src/types/variable.rs? It seems like this commit partially reverts #133 which removed the old variable factory, but doesn't make any reference to it. Can you clarify this? |
|
Ignore all the above comments. I was reviewing #34 in rust-simplicity, which looks weird because it's from 2022 and predates all the stuff that I'm mentioning :P. |
|
dbd1196 looks good! One nit is that I see you replaced an |
|
I actually didn't know about |
42e2738 Compile (arrays|lists) with errors (Christian Lewe) 23ec5d7 Compile with errors (Christian Lewe) 499d16d Scope: Don't panic upon undefined variables (Christian Lewe) 82759ee Parse decimals with errors (Christian Lewe) 7eabe5d Error: Add compile errors (Christian Lewe) d5982b2 Parse: Add JetName (Christian Lewe) Pull request description: Extend #34 to include compile errors. ACKs for top commit: apoelstra: ACK 42e2738 Tree-SHA512: f4962e14be0be7af00c3b55c225944207c67e5c4f55b8d6a4c78dd37bd2cbdd5c4e6c2122d9920f08f2e8cf3e1274be768be58226e05199cb1d3e75f5ce968ea
Add infrastructure for relaying pretty errors to the user. Enable errors during parsing (the compiler still panics). Avoid unwraps.
Format the error messages similar to how the rust compiler does it.
Support multi-line errors.
An error (
RichError) consists of an error variant (Error) and a context (spanned area inside a file). During parsing we attach the line/column position of the affected area. The parser works on local chunks and doesn't have access to the entire file. When parsing is done, we attach the entire file to enable pretty printing. The human encoding follows the same approach.Supersedes #27