Grégory Vanuxem
unread,May 21, 2026, 10:39:23 PM (5 days ago) May 21Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to fricas...@googlegroups.com
Hello,
Actually when an error is encountered during parsing and evaluation in
parseAndEvalString and parseAndEvalStringEqNum the output is just:
"error". I modified the throwed output to be the one of the interpreter.
I may be wrong but nothing is affected (src/hyper/*, jFRiCAS or
TeXmacs extensions). I just see one concern about
the overhead but I believe for their use it
is acceptable.
Below is to show here the mechanism:
parseAndEvalToString str ==
$collectOutput:local := true
$outputLines: local := nil
$IOindex: local := nil
- v := CATCH('SPAD_READER, CATCH('top_level, parseAndEvalStr str))
- v = 'restart => ['"error"]
+ str_stream := MAKE_-STRING_-OUTPUT_-STREAM()
+ old_stream := $algebra_out_rec.$stream_off
+ $algebra_out_rec.$stream_off := cons(false, str_stream)
+ v := UNWIND_-PROTECT(
+ CATCH('SPAD_READER, CATCH('top_level, parseAndEvalStr str)),
+ ($algebra_out_rec.$stream_off := old_stream)
+ )
+ captured_msg := GET_-OUTPUT_-STREAM_-STRING(str_stream)
+ v = 'restart =>
+ captured_msg = '"" => ['"Unknown error during parsing in BOOT
function parseAndEvalToString"]
+ string2Lines(captured_msg)
NREVERSE $outputLines
Personally, I use these two functions for the FriCAS MCP server and
therefore the FriCAS extension I am
working on for the VS Code compatible editors. They have an integrated
pseudo terminal which can be tightly related to the editor (think
about a .input file you are working on).
BTW, I always like informative error messages.
Patch attached.
Greg