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 a59d54c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 23 deletions.
21 changes: 2 additions & 19 deletions syntax.lisp
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
(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))
(handler-bind ((named-readtables:reader-macro-conflict 'continue))
(named-readtables:merge-readtables-into :current :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
19 changes: 16 additions & 3 deletions vendor/cl-classified/vendor/ml/mlsyntax.lisp
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
(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 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))

)

0 comments on commit a59d54c

Please sign in to comment.