Created
April 13, 2021 12:47
-
-
Save souenzzo/a481848bc9591d71e252b31b06fd4284 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def spy-plugin | |
{::pc/wrap-resolve (fn [resolve] | |
(fn [env input] | |
(let [resolver-sym (-> env ::pc/resolver-data ::pc/sym) | |
_ (prn {:sym resolver-sym | |
:input input | |
:entity (p/entity env)}) | |
output (resolve env input)] | |
(prn {:sym resolver-sym | |
:output output | |
:entity (p/entity env)}) | |
output)))}) | |
(let [parser (p/parser {::p/plugins [(pc/connect-plugin) | |
spy-plugin]}) | |
indexes (pc/register {} | |
[(pc/constantly-resolver :a 42) | |
(pc/single-attr-resolver :a :c inc)]) | |
env {::p/reader [p/map-reader | |
pc/reader2 | |
pc/open-ident-reader | |
p/env-placeholder-reader] | |
::pc/indexes indexes | |
::p/placeholder-prefixes #{">"}}] | |
(parser env [:c])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment