|
120 | 120 |
|
121 | 121 | ParserInfo |
122 | 122 | (-parser-info [this] |
123 | | - (when (schema? this) |
124 | | - (if (-ref-schema? this) |
125 | | - (-parser-info (-deref this)) |
126 | | - (when (-> this -parent -type-properties ::simple-parser) |
127 | | - {:simple-parser true})))) |
| 123 | + (when (-ref-schema? this) |
| 124 | + (-parser-info (-deref this)))) |
128 | 125 |
|
129 | 126 | RegexSchema |
130 | 127 | (-regex-op? [_] false) |
|
752 | 749 | (-from-ast [parent ast options] (from-ast parent ast options)) |
753 | 750 | IntoSchema |
754 | 751 | (-type [_] type) |
755 | | - (-type-properties [_] (assoc type-properties ::simple-parser true)) |
| 752 | + (-type-properties [_] type-properties) |
756 | 753 | (-properties-schema [_ _]) |
757 | 754 | (-children-schema [_ _]) |
758 | 755 | (-into-schema [parent properties children options] |
|
789 | 786 | (-keep [_]) |
790 | 787 | (-get [_ _ default] default) |
791 | 788 | (-set [this key _] (-fail! ::non-associative-schema {:schema this, :key key})) |
| 789 | + ParserInfo |
| 790 | + (-parser-info [_] {:simple-parser true}) |
792 | 791 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-schema this writer opts))]))))) |
793 | 792 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-into-schema this writer opts))]))))) |
794 | 793 |
|
|
820 | 819 | cache (-create-cache options) |
821 | 820 | transforming-parser (delay |
822 | 821 | (let [transforming-parsers (or (when-some [[_ i] (find properties :parse/transforming-child)] |
823 | | - (or (when (= :none i) |
824 | | - []) |
825 | | - (when-not (and (nat-int? i) (< i (count children))) |
826 | | - (-fail! ::and-schema-invalid-parse-property {:schema @form})) |
827 | | - [i])) |
| 822 | + (cond |
| 823 | + (= :none i) [] |
| 824 | + (and (nat-int? i) (< i (count children))) [i] |
| 825 | + :else (-fail! ::and-schema-invalid-parse-property {:schema @form}))) |
828 | 826 | (into [] |
829 | 827 | (keep-indexed |
830 | 828 | (fn [i c] |
|
1088 | 1086 | (-from-ast [parent ast options] (-from-child-ast parent ast options)) |
1089 | 1087 | IntoSchema |
1090 | 1088 | (-type [_] :not) |
1091 | | - (-type-properties [_] {::simple-parser true}) |
| 1089 | + (-type-properties [_]) |
1092 | 1090 | (-properties-schema [_ _]) |
1093 | 1091 | (-children-schema [_ _]) |
1094 | 1092 | (-into-schema [parent properties children options] |
|
1122 | 1120 | (-keep [_]) |
1123 | 1121 | (-get [_ key default] (get children key default)) |
1124 | 1122 | (-set [this key value] (-set-assoc-children this key value)) |
| 1123 | + ParserInfo |
| 1124 | + (-parser-info [_] {:simple-parser true}) |
1125 | 1125 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-schema this writer opts))])))) |
1126 | 1126 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-into-schema this writer opts))]))) |
1127 | 1127 |
|
|
1632 | 1632 | (-from-ast [parent ast options] (-into-schema parent (:properties ast) (:values ast) options)) |
1633 | 1633 | IntoSchema |
1634 | 1634 | (-type [_] :enum) |
1635 | | - (-type-properties [_] {::simple-parser true}) |
| 1635 | + (-type-properties [_]) |
1636 | 1636 | (-into-schema [parent properties children options] |
1637 | 1637 | (-check-children! :enum properties children 1 nil) |
1638 | 1638 | (let [children (vec children) |
|
1667 | 1667 | (-keep [_]) |
1668 | 1668 | (-get [_ key default] (get children key default)) |
1669 | 1669 | (-set [this key value] (-set-assoc-children this key value)) |
| 1670 | + ParserInfo |
| 1671 | + (-parser-info [_] {:simple-parser true}) |
1670 | 1672 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-schema this writer opts))])))) |
1671 | 1673 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-into-schema this writer opts))]))) |
1672 | 1674 |
|
|
1677 | 1679 | (-from-ast [parent ast options] (-from-value-ast parent ast options)) |
1678 | 1680 | IntoSchema |
1679 | 1681 | (-type [_] :re) |
1680 | | - (-type-properties [_] {::simple-parser true}) |
| 1682 | + (-type-properties [_]) |
1681 | 1683 | (-properties-schema [_ _]) |
1682 | 1684 | (-children-schema [_ _]) |
1683 | 1685 | (-into-schema [parent properties [child :as children] options] |
|
1719 | 1721 | (-keep [_]) |
1720 | 1722 | (-get [_ key default] (get children key default)) |
1721 | 1723 | (-set [this key value] (-set-assoc-children this key value)) |
| 1724 | + ParserInfo |
| 1725 | + (-parser-info [_] {:simple-parser true}) |
1722 | 1726 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-schema this writer opts))])))) |
1723 | 1727 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-into-schema this writer opts))]))) |
1724 | 1728 |
|
|
1729 | 1733 | (-from-ast [parent ast options] (-from-value-ast parent ast options)) |
1730 | 1734 | IntoSchema |
1731 | 1735 | (-type [_] :fn) |
1732 | | - (-type-properties [_] {::simple-parser true}) |
| 1736 | + (-type-properties [_]) |
1733 | 1737 | (-into-schema [parent properties children options] |
1734 | 1738 | (-check-children! :fn properties children 1 1) |
1735 | 1739 | (let [children (vec children) |
|
1766 | 1770 | (-keep [_]) |
1767 | 1771 | (-get [_ key default] (get children key default)) |
1768 | 1772 | (-set [this key value] (-set-assoc-children this key value)) |
| 1773 | + ParserInfo |
| 1774 | + (-parser-info [_] {:simple-parser true}) |
1769 | 1775 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-schema this writer opts))])))) |
1770 | 1776 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-into-schema this writer opts))]))) |
1771 | 1777 |
|
|
2071 | 2077 | guard (conj (from-ast guard))) options)) |
2072 | 2078 | IntoSchema |
2073 | 2079 | (-type [_] :=>) |
2074 | | - (-type-properties [_] {::simple-parser true}) |
| 2080 | + (-type-properties [_]) |
2075 | 2081 | (-into-schema [parent properties children {::keys [function-checker] :as options}] |
2076 | 2082 | (-check-children! :=> properties children 2 3) |
2077 | 2083 | (let [[input output guard :as children] (-vmap #(schema % options) children) |
|
2152 | 2158 | (-keep [_]) |
2153 | 2159 | (-get [_ key default] (get children key default)) |
2154 | 2160 | (-set [this key value] (-set-assoc-children this key value)) |
| 2161 | + ParserInfo |
| 2162 | + (-parser-info [_] {:simple-parser true}) |
2155 | 2163 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-schema this writer opts))])))) |
2156 | 2164 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-into-schema this writer opts))]))) |
2157 | 2165 |
|
2158 | 2166 | (defn -function-schema [_] |
2159 | 2167 | ^{:type ::into-schema} |
2160 | 2168 | (reify IntoSchema |
2161 | 2169 | (-type [_] :function) |
2162 | | - (-type-properties [_] {::simple-parser true}) |
| 2170 | + (-type-properties [_]) |
2163 | 2171 | (-properties-schema [_ _]) |
2164 | 2172 | (-children-schema [_ _]) |
2165 | 2173 | (-into-schema [parent properties children {::keys [function-checker] :as options}] |
|
2224 | 2232 | (-keep [_]) |
2225 | 2233 | (-get [_ key default] (get children key default)) |
2226 | 2234 | (-set [this key value] (-set-assoc-children this key value)) |
| 2235 | + ParserInfo |
| 2236 | + (-parser-info [_] {:simple-parser true}) |
2227 | 2237 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-schema this writer opts))])))) |
2228 | 2238 | #?@(:cljs [IPrintWithWriter (-pr-writer [this writer opts] (pr-writer-into-schema this writer opts))]))) |
2229 | 2239 |
|
|
0 commit comments