Skip to content

Commit

Permalink
Try to fix test on Allegro
Browse files Browse the repository at this point in the history
  • Loading branch information
iamFIREcracker committed Jan 13, 2024
1 parent e02a6f6 commit f7bfb03
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions syntax.lisp
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
(in-package :aoc)

;; If we don't copy the system readtable first, Allregro will fail with
;; the following error:
;;
;; Attempt to set macro in system readtable #<readtable @ #x20115b5a>;
;; copy readtable first.
(defvar *custom-readtable* (copy-readtable))
(setq *readtable* *custom-readtable*)

(eval-when (:compile-toplevel :load-toplevel :execute)
(defun opening-braket-reader (stream char)
(declare (ignore char))
Expand All @@ -9,7 +17,8 @@
(,@(read-delimited-list #\] stream t)))))
(set-macro-character #\[ #'opening-braket-reader)
; Using #\) messes up with the editor -,-
(set-macro-character #\] (get-macro-character #.(char ")" 0))))
(set-macro-character #\] (get-macro-character #.(char ")" 0))
*custom-readtable*))

#+#:excluded (read (make-string-input-stream "[format t \"Hello, ~a!\" _]"))

Expand All @@ -18,4 +27,5 @@
(declare (ignore sub-char numarg))
(loop :while (read-line stream nil nil))
(values))
(set-dispatch-macro-character #\# #\; #'sharp-semicolon-reader))
(set-dispatch-macro-character #\# #\; #'sharp-semicolon-reader
*custom-readtable*))

0 comments on commit f7bfb03

Please sign in to comment.