Liking cljdoc? Tell your friends :D

instacheck.core


apply-grammar-updatesclj

(apply-grammar-updates grammar grammar-updates)

Replace the generators in the grammar as defined by the list of {:path PATH :value VALUE} maps in grammar-updates. Find each :path in a grammar and replace it with :value (using specter's setval). This allows us to replace generators in the grammar with references to other generators (such as real generators from a Clojure namespace).

Replace the generators in the grammar as defined by the list of
{:path PATH :value VALUE} maps in grammar-updates. Find each :path
in a grammar and replace it with :value (using specter's setval).
This allows us to replace generators in the grammar with references
to other generators (such as real generators from a Clojure
namespace).
sourceraw docstring

clj-prefixclj

(clj-prefix nsname)
source

ebnf-genclj

(ebnf-gen ebnf)
(ebnf-gen ctx ebnf)

Takes an path to an EBNF grammar file and return a test.check generator. If the start is specified then this the name of the rule to use as the starting rule of the grmmar. If start is not specified then the first rule in the grammar file is used as the starting rule.

Takes an path to an EBNF grammar file and return a test.check
generator. If the start is specified then this the name of the rule
to use as the starting rule of the grmmar. If start is not specified
then the first rule in the grammar file is used as the starting
rule.
sourceraw docstring

grammar->generator-defs-sourceclj

(grammar->generator-defs-source {:keys [start] :as ctx} grammar)

Takes an grammar (loaded using load-grammar) and returns the text of a namespace with top-level defines (defs) for all the rules. If the :start is specified in the ctx then this the name of the rule to use as the starting rule of the grammar. If :start is not specified then the first rule in the grammar file is used as the starting rule. Only the start rule flattens the generated values into a final string.

Takes an grammar (loaded using load-grammar) and returns the text
of a namespace with top-level defines (defs) for all the rules. If
the :start is specified in the ctx then this the name of the rule to
use as the starting rule of the grammar. If :start is not specified
then the first rule in the grammar file is used as the starting
rule. Only the start rule flattens the generated values into a final
string.
sourceraw docstring

grammar->generator-func-sourceclj

(grammar->generator-func-source {:keys [function] :as ctx} grammar)

Takes an grammar (loaded using load-grammar) and returns the text of a namespace with a single Clojure function. The function takes an optional weights map and returns a map of all the rules as generators (indexed by rule-name keyword).

Takes an grammar (loaded using load-grammar) and returns the text
of a namespace with a single Clojure function. The function takes
an optional weights map and returns a map of all the rules as
generators (indexed by rule-name keyword).
sourceraw docstring

grammar->generator-objclj

(grammar->generator-obj {:keys [start] :as ctx} grammar)
source

grammar->nsclj

(grammar->ns ctx grammar)
source

load-grammarclj

(load-grammar ebnf)
source

parseclj

(parse parser text & [location])

Use parser to parse text. On success returns the parsed AST. On error, throws an ex-info map containing the :failure (instaparse Failure object), :text (the original text), and :location (optional location parameter).

Use parser to parse text. On success returns the parsed AST. On
error, throws an ex-info map containing the :failure (instaparse Failure
object), :text (the original text), and :location (optional location
parameter).
sourceraw docstring

parse-weightsclj

(parse-weights parser text-objs)

Use parser to parse a sequence of text description objects {:text text :location location}. Returns a weights map with the weights set to the number of times that path in the grammar was followed/used across all the texts from text-objs.

Use parser to parse a sequence of text description objects {:text
text :location location}. Returns a weights map with the weights set
to the number of times that path in the grammar was followed/used
across all the texts from text-objs.
sourceraw docstring

parse-weights-from-filesclj

(parse-weights-from-files parser files)

Wrapper around parse-weights that marshals the text objects from a list of file paths.

Wrapper around parse-weights that marshals the text objects from
a list of file paths.
sourceraw docstring

parser->grammarclj

(parser->grammar parser)

Takes a instaparse parser and returns an instacheck grammar: the :grammar value from the parser with a metadata map containing the start rule (:start).

Takes a instaparse parser and returns an instacheck grammar: the
:grammar value from the parser with a metadata map containing the
start rule (:start).
sourceraw docstring

RULES-PER-FUNCclj

source

run-checkclj

(run-check opts gen-to-check check-fn report-fn)
source

tag-to-genclj

source

update-generator-objclj

(update-generator-obj obj & {:keys [weights start]})

Return a new generator object with runtime properties adjusted (those that don't require eval of the function source again). Only weights and start rule are supported currently.

Return a new generator object with runtime properties adjusted
(those that don't require eval of the function source again). Only
weights and start rule are supported currently.
sourceraw docstring

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

× close