This namespaces provides a reader that combines our grammar and clojure's reader to turn a string of prose text into data clojure can then evaluate.
The reader starts by parsing the text using our grammar. This gives a first data representation from which is computed data that clojure can evaluate.
The different syntactic elements are processed as follows:
This namespaces provides a reader that combines our grammar and clojure's reader to turn a string of prose text into data clojure can then evaluate. The reader starts by parsing the text using our grammar. This gives a first data representation from which is computed data that clojure can evaluate. The different syntactic elements are processed as follows: - text -> string - clojure call -> itself - symbol -> itself - tag -> clojure fn call - verbatim block -> string containing the verbatim block's content.
Stores the parse regions given by instaparse when clojurizing the parse tree.
Stores the parse regions given by instaparse when clojurizing the parse tree.
(add-type x t)
(clojurize form)
Function that turns a prose parse tree to data that clojure can eval. clojure form that are clojurized have parse info in their metadata.
Function that turns a prose parse tree to data that clojure can eval. clojure form that are clojurized have parse info in their metadata.
(clojurize-mixed content)
The basic content of an embedded code block is a sequence of strings and tags. These tags can't be read by the clojure reader.
To turn that block into clojure data, the trick is to replace the tags by place-holder strings that will be read as symbols. We can then use the clojure(script) reader on the result. Next we walk the code that's now data and replace those symbols with the clojurized tags.
The basic content of an embedded code block is a sequence of strings and tags. These tags can't be read by the clojure reader. To turn that block into clojure data, the trick is to replace the tags by place-holder strings that will be read as symbols. We can then use the clojure(script) reader on the result. Next we walk the code that's now data and replace those symbols with the clojurized tags.
(extract-tags content)
Replaces the tags by generated unique symbols and creates a mapping from those symbols to the replaced tag data.
Replaces the tags by generated unique symbols and creates a mapping from those symbols to the replaced tag data.
(form->text form original)
Given a form and the original text, finds the part of the text that read as this form.
Given a form and the original text, finds the part of the text that read as this form.
(inject-clojurized-tags form env)
Walks the clojurized block and replaces placeholder symbols by the clojurized content.
Walks the clojurized block and replaces placeholder symbols by the clojurized content.
(parse text)
Wrapper around the parser from [[textp.reader.grammar]] adding error handling.
Wrapper around the parser from [[textp.reader.grammar]] adding error handling.
(read-from-string text)
(read-from-string text opts)
The entry point of the reader.
Args:
text
: string to readopts
: a map specifying optionsOptions:
:reader-options
: The options to pass the clojure reader, it's the map that will be passed to
[[edamame.core/parse-string]]. By default every basic option is allowed except :read-eval
.The entry point of the reader. Args: - `text`: string to read - `opts`: a map specifying options Options: - `:reader-options`: The options to pass the clojure reader, it's the map that will be passed to [[edamame.core/parse-string]]. By default every basic option is allowed except `:read-eval`.
(read-from-string* text)
(read-string* s)
Wrapping of edamame's read-string function for use in our reader.
Wrapping of edamame's read-string function for use in our reader.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close