Skip to content

Commit

Permalink
Add limited evaluation of feature expressions
Browse files Browse the repository at this point in the history
  • Loading branch information
scymtym committed Jul 26, 2024
1 parent 8448a32 commit bf75bfe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion code/client.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@

(defmethod reader:evaluate-feature-expression ((client client)
(feature-expression t))
nil)
(let ((features (eclector.reader:state-value client '*features*)))
(and (typep feature-expression 'symbol-token)
(find (name feature-expression) features :test #'string=
:key 'symbol-name))))

;;; Read-time evaluation

Expand Down
9 changes: 9 additions & 0 deletions test/test.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@
(inc:block-comment-wad ((0 3) (0 8)) ()
(inc:word-wad ((0 5) (0 6))))
(inc:atom-wad ((0 8) (0 9)) (:raw 1)))))
("#+common-lisp 1"
`((inc:read-positive-conditional-wad ((0 0) (0 15))
(:feature-expression (inc:existing-symbol-token
:symbol ("KEYWORD" "COMMON-LISP")))
,(expected-symbol-wad '((0 2) (0 13)) "COMMON-LISP"
:token-class 'inc:existing-symbol-token
:package-name "KEYWORD"
:words '(:ignore-children))
(inc:atom-wad ((0 14) (0 15)) (:raw 1)))))
("#+a b"
`((inc:skipped-positive-conditional-wad ((0 0) (0 5))
(:feature-expression (inc:existing-symbol-token :symbol ("KEYWORD" "A")))
Expand Down

0 comments on commit bf75bfe

Please sign in to comment.