(code-form zloc symbol)converts a form zipper into a code string
(-> (z/of-string "(fact (+ 1 1) \n => 2)") (code-form 'fact)) => "(+ 1 1) \n => 2"
converts a form zipper into a code string
(-> (z/of-string "(fact (+ 1 1) \n => 2)")
(code-form 'fact))
=> "(+ 1 1) \n => 2"(is-code-form zloc)converts the is form into a string
(is-code-form (z/of-string "(is (= (+ 1 1) 2))")) => "(+ 1 1)\n => 2"
(is-code-form (z/of-string "(is true)")) => "true"
converts the `is` form into a string (is-code-form (z/of-string "(is (= (+ 1 1) 2))")) => "(+ 1 1)\n => 2" (is-code-form (z/of-string "(is true)")) => "true"
(merge-current output current)if not whitespace, then merge output
if not whitespace, then merge output
(parse-attribute zloc)coverts an attribute zipper into an element
(-> (z/of-string "[[{:title "hello world"}]]") (parse-attribute)) => {:type :attribute, :title "hello world"}
coverts an attribute zipper into an element
(-> (z/of-string "[[{:title \"hello world\"}]]")
(parse-attribute))
=> {:type :attribute, :title "hello world"}(parse-code zloc)coverts a code zipper into an element
(-> (z/of-string "(+ 1 1) (+ 2 2)") (parse-code)) => {:type :code, :indentation 0, :code ["(+ 1 1)"]}
coverts a code zipper into an element
(-> (z/of-string "(+ 1 1) (+ 2 2)")
(parse-code))
=> {:type :code, :indentation 0, :code ["(+ 1 1)"]}(parse-code-directive zloc)coverts an code directive zipper into an element
(-> (z/of-string "[[:code {:language :ruby} "1 + 1 == 2"]]") (parse-code-directive)) => {:type :block, :indentation 0 :code "1 + 1 == 2" :language :ruby}
coverts an code directive zipper into an element
(-> (z/of-string "[[:code {:language :ruby} \"1 + 1 == 2\"]]")
(parse-code-directive))
=> {:type :block, :indentation 0 :code "1 + 1 == 2" :language :ruby}(parse-comment-form zloc)convert a comment zipper into an element
(-> (z/of-string "(comment (+ 1 1) \n => 2)") (parse-comment-form)) => {:type :block :indentation 2 :code "(+ 1 1) \n => 2"}
convert a comment zipper into an element
(-> (z/of-string "(comment (+ 1 1) \n => 2)")
(parse-comment-form))
=> {:type :block :indentation 2 :code "(+ 1 1) \n => 2"}(parse-deftest-form zloc)converts the deftest form into an element
(-> (z/of-string "(deftest hello)") (parse-deftest-form)) => {:type :test, :source {:row 1, :col 1, :end-row 1, :end-col 16}}
converts the `deftest` form into an element
(-> (z/of-string "(deftest hello)")
(parse-deftest-form))
=> {:type :test, :source {:row 1, :col 1, :end-row 1, :end-col 16}}(parse-directive zloc)converts a directive zipper into an element
(-> (z/of-string "[[:chapter {:title "hello world"}]]") (parse-directive)) => {:type :chapter :title "hello world"}
(binding [namespace 'example.core] (-> (z/of-string "[[:ns {:title "hello world"}]]") (parse-directive))) => {:type :ns, :title "hello world", :ns 'example.core}
converts a directive zipper into an element
(-> (z/of-string "[[:chapter {:title \"hello world\"}]]")
(parse-directive))
=> {:type :chapter :title "hello world"}
(binding [*namespace* 'example.core]
(-> (z/of-string "[[:ns {:title \"hello world\"}]]")
(parse-directive)))
=> {:type :ns, :title "hello world", :ns 'example.core}(parse-fact-form zloc)convert a fact zipper into an element
(-> (z/of-string "(fact (+ 1 1) \n => 2)") (parse-fact-form)) => {:type :test :indentation 2 :code "(+ 1 1) \n => 2"}
convert a fact zipper into an element
(-> (z/of-string "(fact (+ 1 1) \n => 2)")
(parse-fact-form))
=> {:type :test :indentation 2 :code "(+ 1 1) \n => 2"}(parse-facts-form zloc)converts a facts zipper into an element
(-> (z/of-string "(facts (+ 1 1) \n => 2)") (parse-facts-form)) => {:type :test :indentation 2 :code "(+ 1 1) \n => 2"}
converts a facts zipper into an element
(-> (z/of-string "(facts (+ 1 1) \n => 2)")
(parse-facts-form))
=> {:type :test :indentation 2 :code "(+ 1 1) \n => 2"}(parse-inner zloc f output current opts)parses the inner form of the fact and comment function
parses the inner form of the fact and comment function
(parse-is-form zloc)converts an is form into an element
(-> (z/of-string "(is (= (+ 1 1) 2))")
(parse-is-form))
=> {:type :block, :indentation 2, :code "(+ 1 1)\n=> 2"}
converts an `is` form into an element
(-> (z/of-string "(is (= (+ 1 1) 2))")
(parse-is-form))
=> {:type :block, :indentation 2, :code "(+ 1 1)\n=> 2"}(parse-loop zloc opts)(parse-loop zloc opts current output)the main loop for the parser
(-> (z/of-string "(ns example.core) [[:chapter {:title "hello"}]] (+ 1 1) (+ 2 2)") (parse-loop {}))
=> (contains-in [{:type :ns-form, :indentation 0, :ns 'example.core, :code "(ns example.core)"} {:type :chapter, :title "hello"} {:type :code, :indentation 0, :code ["(+ 1 1)" " " "\n" " " "(+ 2 2)"]}])
the main loop for the parser
(-> (z/of-string "(ns example.core)
[[:chapter {:title \"hello\"}]]
(+ 1 1)
(+ 2 2)")
(parse-loop {}))
=> (contains-in
[{:type :ns-form,
:indentation 0,
:ns 'example.core,
:code "(ns example.core)"}
{:type :chapter, :title "hello"}
{:type :code, :indentation 0, :code ["(+ 1 1)"
" "
"\n"
" "
"(+ 2 2)"]}])(parse-ns-form zloc)converts a ns zipper into an element
(-> (z/of-string "(ns example.core)") (parse-ns-form)) => {:type :ns-form :indentation 0 :meta {} :ns 'example.core :code "(ns example.core)"}
converts a ns zipper into an element
(-> (z/of-string "(ns example.core)")
(parse-ns-form))
=> {:type :ns-form
:indentation 0
:meta {}
:ns 'example.core
:code "(ns example.core)"}(parse-paragraph zloc)converts a string zipper into an element
(-> (z/of-string ""this is a paragraph"") (parse-paragraph)) => {:type :paragraph :text "this is a paragraph"}
converts a string zipper into an element
(-> (z/of-string "\"this is a paragraph\"")
(parse-paragraph))
=> {:type :paragraph :text "this is a paragraph"}(parse-whitespace zloc)coverts a whitespace zipper into an element
(-> (z/of-string "1 2 3") (z/right*) (parse-whitespace)) => {:type :whitespace, :code [" "]}
coverts a whitespace zipper into an element
(-> (z/of-string "1 2 3")
(z/right*)
(parse-whitespace))
=> {:type :whitespace, :code [" "]}(wrap-line-info f)helper to add the line information to the parser (used by parse-loop)
helper to add the line information to the parser (used by `parse-loop`)
(wrap-meta f)if form is meta, then go down a level
if form is meta, then go down a level
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |