piccolo
piccolo copied to clipboard
`Feature`: implemented Lua like errors
Features
- Added support for Lua-like stack trace generation via [
error::ErrorWithStackTrace] - Updated error messages in
stdlib,meta_ops.rs,parser.rs,lexer.rs, etc. - Updated [
Parser] logic for improved error handling. - Updated some [
Lexer] logic for improved error handling. - Added error builders in
stdlib. - Updated
goldenscriptsand some tests.
Why is this needed?
Current errors in piccolo provide neither extensive information nor anything at all - the current parser provides no information about why an error occurred, where it occurred, and how it occurred, and the number of errors is very, very limited. Errors in stdlib are not standardized: some look like those in PUC-Rio Lua, others seem to be written "off the cuff"
A few examples
How it was before:
runtime error: parse error: parse error at line 1: expression is not a statement
runtime error: parse error: parse error at line 1: unexpected end of token stream
runtime error: parse error: parse error at line 2: expression is not a statement
How it is now:
<anonymous>:1: unexpected symbol near ')'
<anonymous>:1: ')' expected near <eof>
<anonymous>:1: 'end' expected near 'do'
all examples were taken from /examples/interpreter.rs