Skip to content

Commit

Permalink
Fix tests on Allegro
Browse files Browse the repository at this point in the history
  • Loading branch information
iamFIREcracker committed Jan 14, 2024
1 parent e02a6f6 commit 09918ea
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 30 deletions.
20 changes: 1 addition & 19 deletions syntax.lisp
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
(in-package :aoc)

(eval-when (:compile-toplevel :load-toplevel :execute)
(defun opening-braket-reader (stream char)
(declare (ignore char))
(let ((arg (intern "_")))
`(lambda (&optional ,arg)
(declare (ignorable ,arg))
(,@(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))))

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

(eval-when (:compile-toplevel :load-toplevel :execute)
(defun sharp-semicolon-reader (stream sub-char numarg)
(declare (ignore sub-char numarg))
(loop :while (read-line stream nil nil))
(values))
(set-dispatch-macro-character #\# #\; #'sharp-semicolon-reader))
(named-readtables:in-readtable :mlutils-syntax)
2 changes: 1 addition & 1 deletion vendor/cl-classified/vendor/ml/ml.asd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
:author "Matteo Landi <[email protected]>"
:license "MIT"
:serial t
:depends-on ()
:depends-on (#:named-readtables)
:components
(
(:file "mlutils-package")
Expand Down
31 changes: 21 additions & 10 deletions vendor/cl-classified/vendor/ml/mlsyntax.lisp
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
(in-package "MLUTILS")

(eval-when (:compile-toplevel :load-toplevel :execute)
(defun opening-braket-reader (stream char)
(declare (ignore char))
(let ((arg (intern "_")))
`(lambda (&optional ,arg)
(declare (ignorable ,arg))
(,@(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))))

(defun opening-braket-reader (stream char)
(declare (ignore char))
(let ((arg (intern "_")))
`(lambda (&optional ,arg)
(declare (ignorable ,arg))
(,@(read-delimited-list #\] stream t)))))


(defun sharp-semicolon-reader (stream sub-char numarg)
(declare (ignore sub-char numarg))
(loop :while (read-line stream nil nil))
(values))


(named-readtables:defreadtable :mlutils-syntax
(:merge :standard)
(:macro-char #\[ #'opening-braket-reader)
(:macro-char #\] (get-macro-character #\)))
(:dispatch-macro-char #\# #\; #'sharp-semicolon-reader)
(:case :preserve))

0 comments on commit 09918ea

Please sign in to comment.