blob: d5fee9eabcd4c2cb6be8f965f08db62d934f6202 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
(ns lux.macro
(:require [clojure.core.match :as M :refer [match matchv]]
clojure.core.match.array
(lux [base :as & :refer [fail* return*]])))
;; [Resources]
(defn expand [loader macro-class tokens]
(fn [state]
;; (prn 'expand macro-class tokens state)
(let [expansion (-> (.loadClass loader macro-class)
(.getField "_datum")
(.get nil)
(.apply tokens)
(.apply state))]
;; (if (or (= "lux$_BQUOTE_" macro-class)
;; (= "lux$if" macro-class))
;; (matchv ::M/objects [expansion]
;; [["lux;Right" [state* nodes]]]
;; (doseq [node (&/->seq nodes)]
;; (prn 'expansion macro-class (&/show-ast node)))
;; [_]
;; nil))
expansion)
))
|