|
13 | 13 | _ (when-not (api/keyword-node? html-tag) |
14 | 14 | (api/reg-finding! {:row (:row (meta html-tag)) |
15 | 15 | :col (:col (meta html-tag)) |
16 | | - :message "Html-tag must be a keyword" |
| 16 | + :message "Tag must be a keyword or an ornament-styled-component" |
17 | 17 | :type :lambdaisland.ornament/invalid-syntax})) |
18 | 18 | ; _ (prn :html-tag html-tag) |
19 | 19 | ; _ (prn :more more) |
20 | 20 | fn-tag (first (drop-while (fn [x] |
21 | | - (or (api/keyword-node? x) |
| 21 | + (or (api/string-node? x) |
| 22 | + (api/keyword-node? x) |
22 | 23 | (api/map-node? x) |
23 | 24 | (api/vector-node? x))) |
24 | 25 | more)) |
25 | | - _ (prn :fn-tag fn-tag) |
26 | | - _ (when (or (api/list-node? fn-tag) |
27 | | - (nil? fn-tag)) |
| 26 | + ; _ (prn :fn-tag fn-tag) |
| 27 | + _ (when (and fn-tag |
| 28 | + (not (api/list-node? fn-tag))) |
28 | 29 | (api/reg-finding! {:row (:row (meta fn-tag)) |
29 | 30 | :col (:col (meta fn-tag)) |
30 | | - :message "fn-tag must be at least a list or nil" |
31 | | - :type :lambdaisland.ornament/invalid-syntax})) |
32 | | - def-class-form (api/list-node |
33 | | - (list (api/token-node 'def) |
34 | | - class-name |
35 | | - (api/token-node 'nil)))] |
| 31 | + :message "Function part (if present) must be a list" |
| 32 | + :type :lambdaisland.ornament/invalid-syntax}))] |
36 | 33 | (if (api/list-node? fn-tag) |
37 | 34 | (let [[binding-vec & body] (:children fn-tag) |
38 | | - new-node (api/list-node |
39 | | - (list* |
40 | | - (api/token-node 'fn) |
41 | | - binding-vec |
42 | | - body))] |
43 | | - (prn :new-node (api/sexpr new-node)) |
44 | | - {:node new-node}) |
| 35 | + fn-node (api/list-node |
| 36 | + (list* |
| 37 | + (api/token-node 'fn) |
| 38 | + binding-vec |
| 39 | + body)) |
| 40 | + new-def-node (api/list-node |
| 41 | + (list (api/token-node 'def) |
| 42 | + class-name |
| 43 | + fn-node))] |
| 44 | + (prn :new-def-node (api/sexpr new-def-node)) |
| 45 | + {:node new-def-node}) |
45 | 46 | ;; nil node |
46 | | - {:node def-class-form}))) |
| 47 | + (let [def-class-form (api/list-node |
| 48 | + (list (api/token-node 'def) |
| 49 | + class-name |
| 50 | + (api/token-node 'nil)))] |
| 51 | + (prn :def-class-form (api/sexpr def-class-form)) |
| 52 | + {:node def-class-form})))) |
0 commit comments