Liking cljdoc? Tell your friends :D

fr.jeremyschoffen.prose.alpha.reader.core

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.
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.
raw docstring

*parse-region*clj/s

Stores the parse regions given by instaparse when clojurizing the parse tree.

Stores the parse regions given by instaparse when clojurizing the parse tree.
raw docstring

*reader-options*clj/s


add-typeclj/s

(add-type x t)

clojurizeclj/s

(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.
raw docstring

clojurize*clj/smultimethod


clojurize-mixedclj/s

(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.
raw docstring

extract-tagsclj/s

(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.
raw docstring

form->textclj/s

(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.
raw docstring

inject-clojurized-tagsclj/s

(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.
raw docstring

parseclj/s

(parse text)

Wrapper around the parser from [[textp.reader.grammar]] adding error handling.

Wrapper around the parser from [[textp.reader.grammar]] adding error handling.
raw docstring

read-from-stringclj/s

(read-from-string text)
(read-from-string text opts)

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.
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`.
raw docstring

read-from-string*clj/s

(read-from-string* text)

read-string*clj/s

(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.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close