Improve parse error handling
parent
dffd8e296d
commit
2346d6b1ec
|
@ -3,7 +3,7 @@
|
|||
- variable width word wrap
|
||||
- graphical crossref tool
|
||||
- http://paste.lisp.org/display/30426
|
||||
- listener: if partial parse, RETURN should insert newline
|
||||
- parse errors should be shown in a popup
|
||||
- compiled call traces:
|
||||
- should be independent of whenever the runtime was built with
|
||||
-fomit-frame-pointer or not
|
||||
|
|
|
@ -35,10 +35,7 @@ C: source-file ( path -- source-file )
|
|||
"scratchpad" set-in { "syntax" "scratchpad" } set-use ;
|
||||
|
||||
: with-parser ( quot -- )
|
||||
0 line-number set [
|
||||
dup [ parse-error? ] is? [ <parse-error> ] unless
|
||||
rethrow
|
||||
] recover ;
|
||||
0 line-number set [ <parse-error> rethrow ] recover ;
|
||||
|
||||
: parse-lines ( lines -- quot )
|
||||
[ f [ (parse) ] reduce >quotation ] with-parser ;
|
||||
|
|
|
@ -83,10 +83,10 @@ M: string error. print ;
|
|||
first3 continue-with ;
|
||||
|
||||
: :edit ( -- )
|
||||
error get
|
||||
dup parse-error-file ?resource-path
|
||||
swap parse-error-line
|
||||
edit-location ;
|
||||
error get delegates [ parse-error-file ] find nip [
|
||||
dup parse-error-file ?resource-path
|
||||
swap parse-error-line edit-location
|
||||
] when* ;
|
||||
|
||||
: (:help-multi)
|
||||
"This error has multiple delegates:" print
|
||||
|
|
|
@ -73,9 +73,10 @@ M: interactor stream-read
|
|||
interactor-in in set ;
|
||||
|
||||
: handle-parse-error ( interactor error -- )
|
||||
dup [ parse-error? ] is? [
|
||||
dup parse-error? [
|
||||
2dup dup parse-error-line 1- swap parse-error-col 2array
|
||||
over editor-caret set-model mark>caret
|
||||
delegate
|
||||
] when
|
||||
swap interactor-output [ print-error ] with-stream* ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue