Skip to content

Printing error spans #104

@jmikedupont2

Description

@jmikedupont2

Here is a patch to get better error message on the bane of lisp
https://github.com/shsms/tulisp/compare/main...meta-introspector:tulisp:enhanced-error-reporting?expand=1

4 changes: 3 additions & 1 deletion4  
[src/parse.rs](https://github.com/shsms/tulisp/compare/main...meta-introspector:tulisp:enhanced-error-reporting?expand=1#diff-5583e398a8deec11b274d9965eff8b5ade5226c7a020ca214a27d7d07dcc8a29)
Original file line number	Diff line number	Diff line change
@@ -315,7 +315,9 @@ impl Parser<'_, '_> {
        let mut got_dot = false;
        loop {
            let Some(token) = self.tokenizer.peek() else {
                return Err(Error::parsing_error("Unclosed list".to_string())
                return Err(Error::parsing_error(format!(
                    "Unclosed list - missing ')' for opening '(' at line {}, col {}"
                , start_span.start.0, start_span.start.1))
                    .with_trace(TulispObject::nil().with_span(Some(start_span))));
            };
            match token {

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions