[CM] extending the reader?

bil at ccrma.Stanford.EDU bil at ccrma.Stanford.EDU
Fri Oct 8 07:27:15 PDT 2021


I can't think of a way to do this in scheme code.
*read-error-hook* is not currently called at the
point of the error (probably line 69449 in s7.c).
I suppose it could be called, but I'd need to back
out with the new input (if any), which would take
a ton of testing.  You could change the C code,
perhaps --

   {
     s7_pointer pt;
     pt = current_input_port(sc);
     fprintf(stderr, "%c\n", port_data(pt)[port_position(pt) - 2]);
   }

at that pointer prints ".", so you know it's reading
".)".  You'd need to add the symbol ./ to the current
list in the reader, then pop back to whatever was
being read before that -- kinda tricky!
I'll look into extending *read-error-hook*, but with
input like that, there are probably more such gotchas.



More information about the Cmdist mailing list