code.query.compile
compile-section
added in 3.0
(compile-section direction prev {:keys [type step], optional? :?, :as section})compile section (compile-section :up nil ’{:element if, :type :nth, :step 3}) => ’{:nth-ancestor 3 {:form if}}
(compile-section :down nil ’{:element if, :type :multi}) => ’{:contains {:form if}}
compile-section-base
added in 3.0
(compile-section-base section)compiles an element section (compile-section-base ’{:element defn}) => ’{:form defn}
(compile-section-base ’{:element (if & _)}) => ’{:pattern (if & _)}
(compile-section-base ’{:element _}) => {:is code.query.common/any}
compile-submap
added in 3.0
(compile-submap direction sections)cursor-info
added in 3.0
(cursor-info selectors)finds the information related to the cursor
(cursor-info ’(defn ^:?& _ | & _)) => ’0 :form (defn _ | & _)
(cursor-info (expand-all-metas ’(defn ^:?& _ | & _))) => ’0 :form (defn _ | & _)
(cursor-info ’defn if) => nil :cursor
expand-all-metas
added in 3.0
(expand-all-metas selectors)converts the shorthand meta into a map-based meta (meta (expand-all-metas ’^:%? sym?)) => {:? true, :% true}
(-> (expand-all-metas ’(^:%+ + 1 2)) first meta) => {:+ true, :% true}
prepare
added in 3.0
(prepare selectors)prepare (prepare ’defn if) => ’[{:child {:form if}, :form defn} nil :cursor]
(prepare ’defn | if) => ’[{:parent {:form defn}, :form if} 1 :cursor]
process-path
added in 3.0
(process-path path)(process-path [x y & xs :as more] out)converts a path into more information (process-path ’defn if try) => ’{:type :step, :element defn} {:type :step, :element if} {:type :step, :element try}
(process-path ’defn :* try :3 if) => ’{:type :step, :element defn} {:element try, :type :multi} {:element if, :type :nth, :step 3}
process-special
added in 3.0
(process-special ele)converts a keyword into a map (process-special :*) => {:type :multi}
(process-special :1) => {:type :nth, :step 1}
(process-special :5) => {:type :nth, :step 5}
split-path
added in 3.0
(split-path selectors [idx ctype])splits the path into up and down (split-path ’defn | if try 1 :cursor) => ’{:up (defn), :down if try}
(split-path ’defn if try nil :cursor) => ’{:up [], :down defn if try}