Bug ID: 1046653 - input prompt appearing when it should not.



We have the open bug report ID: 1046653 - input prompt appearing when it
should not.

I think the problem of this bug report is in the routine mread-synerr in
nparse.lisp. In this routine the following test is done:

   (output-stream-p *standard-input*)

For GCL this test gives TRUE. For SBCL this test gives NIL. This is the
code in mread-synerr:

      ...
      (cond ((output-stream-p *standard-input*)
             (let ((n (get '*parse-window* 'length))
                   some ch)
               (loop for i from (1- n) downto (- n 20)
                      while (setq ch (nth i *parse-window*))
                      do
                      (cond ((eql ch #\newline)
                             (push #\n some)
                             (push #\\ some))
                            ((eql ch #\tab)
                             (push #\t some)
                             (push #\\ some))
                            (t (push ch some))))
               (format t "~%~{~c~}~%~vt^" some (- (length some) 2))
           (read-line *parse-stream* nil nil))))
      (terpri)
      (throw-macsyma-top)))


The purpose of this code is to repeat the input and mark the place where
the error occurs. This code is never executed for SBCL. I think this is
a bug too. Because of this, the input line is not flushed. To flush the
input line a readline is executed at the end of the condition.
Therefore, the parser continues to read the wrong line and generates
more error messages for SBCL, but not for GCL.

I think the test (output-stream-p *standard-input*) does not make sense.
A more correct test should look if the input stream of the parser which
is bound to *parse-stream* is the *standard-input*. I have tried the
following test:

   (eql *parse-stream* *standard-input*)

With this test I get the following for SBCL. Both bugs have vanished, we
get only one message and the input line is repeated:

(%i1) integrate(,x);
incorrect syntax: , is not a prefix operator
integrate(,
         ^
(%i1) 

I have not much experience with streams in Lisp. Perhaps, I see
something wrong. At this time I have not installed other Lisps to do
more tests with different Lisps.

So, is it a general working correction to insert the test (eql
*parse-stream* *standard-input*)?

Dieter Kaiser