On Sun, Mar 07, 2021 at 03:07:00PM +0100, Waldek Hebisch wrote:
> On Sun, Mar 07, 2021 at 01:04:42PM +0100, Waldek Hebisch wrote:
> > On Sun, Mar 07, 2021 at 02:32:47PM +0800, Qian Yun wrote:
> > > Spent some time on this, the fix in BOOT compiler is not that
> > > obvious, because of the complexity of escape char at the end
> > > of line.
> > > 
> > > Shall we simply go with ".gitattributes"?
> > 
> > First we need to decide what carriage return in variuos FriCAS
> > input files should do and check what it is doing now.
> 
> A little experiments shows that FriCAS ignores carriage return at
> and of line in .input files and signals error when carriage return
> is in middle of line.  Boot scanner currently signals error everywhere.
> I will try to modify Boot scanner to match .input scanner.

.input scanner simply strips final carriage return in 'expand-tabs'
(in 'macros.lisp').  Boot scanner have no equivalent function,
but I added equivalent code (patch attached) to 'shoeread-line'
and with this code Boot accepts carriage return at end of line.

BTW: I have now enough reasons to rewrite our scanners, but
must wait after release.

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/20210307155241.GB38228%40math.uni.wroc.pl.
diff --git a/src/boot/initial-env.lisp b/src/boot/initial-env.lisp
index 1d002e1..692cf03 100644
--- a/src/boot/initial-env.lisp
+++ b/src/boot/initial-env.lisp
@@ -85,8 +85,15 @@
 (defun make-full-cvec (sint &optional (char #\space))
   (make-string sint :initial-element (character char)))
 
-(defun |shoeread-line| (st &optional (eofval nil))
-  (read-line st nil eofval))
+(defun |shoeread-line| (st)
+  (let ((str (read-line st nil nil)))
+      (if (not str) str
+          ;; remove dos CR
+          (let ((l_str (length str)))
+              (if (and (> l_str 0)
+                       (eq (char str (1- l_str)) #\Return))
+                  (subseq str 0 (1- l_str))
+                  str)))))
 
 (defun |shoePLACEP| (item)
   (eq item nil))

Reply via email to