Liking cljdoc? Tell your friends :D

tegere.grammar

This namespace contains Instaparse CFG (or PEG) grammars (and parsers derived therefrom) that are used by TeGere. The primary grammar is feature-prsr, which describes Gherkin feature files. However, PSGs are also used to parse the tag expressions that may be passed at the command line, hence: tag-expression-cli-prsr and old-style-tag-expr-prsr.

Note that the outputs of these grammars typically require post-processing in order to arrive at specification-compliant Clojure data structures. For that post-processing work, see the tegere.parser ns.

Final note: the grammars here could all be defined in one go as single def statements. The present convention of breaking the grammars up into smaller sub-grammars is in part a vestige of how they were developed, viz., iteratively and via the REPL.

This namespace contains Instaparse CFG (or PEG) grammars (and parsers derived
therefrom) that are used by TeGere. The primary grammar is ``feature-prsr``,
which describes Gherkin feature files. However, PSGs are also used to parse the
tag expressions that may be passed at the command line, hence:
``tag-expression-cli-prsr`` and ``old-style-tag-expr-prsr``.

Note that the outputs of these grammars typically require post-processing in
order to arrive at specification-compliant Clojure data structures. For that
post-processing work, see the ``tegere.parser`` ns.

Final note: the grammars here could all be defined in one go as single ``def``
statements. The present convention of breaking the grammars up into smaller
sub-grammars is in part a vestige of how they were developed, viz., iteratively
and via the REPL.
raw docstring

-feature-prsrclj

source

comment-line-grmrclj

source

comment-line-prsrclj

source

disjunction-oste-tags-cli-grmrclj

source

disjunction-oste-tags-cli-prsrclj

source

empty-line-grmrclj

source

examples-grmrclj

source

examples-line-grmrclj

source

examples-line-prsrclj

source

examples-prsrclj

source

feature-block-grmrclj

source

feature-block-prsrclj

source

feature-description-block-grmrclj

source

feature-description-block-prsrclj

source

feature-grmrclj

source

feature-line-grmrclj

source

feature-line-prsrclj

source

feature-prsrclj

(feature-prsr input)

Parses a Gherkin feature file string into a Hiccup data format. Cheats a little by suffixing a newline if one is not present.

Parses a Gherkin feature file string into a Hiccup data format. Cheats a
little by suffixing a newline if one is not present.
sourceraw docstring

ignored-line-grmrclj

source

indent-grmrclj

source

negated-oste-tag-grmrclj

source

negated-oste-tag-prsrclj

source

new-line-grmrclj

source

old-style-tag-expr-grmrclj

source

old-style-tag-expr-prsrclj

This should parse old-style tag expression strings, like '@dog,~@cat', into raw tags, negated tag vectors, or vectors of disjoined tag expressions. The @ sign before tags is optional and whitespace between tags is removed. Examples:

cat                      => (cat)
@cat                     => (cat)
~@cat                    => ([:NEG cat])
cat,~@dog,cow,~bunny     => ([:DISJ cat [:NEG dog] cow [:NEG bunny]])
cat , ~@dog,cow , ~bunny => ([:DISJ cat [:NEG dog] cow [:NEG bunny]])
This should parse old-style tag expression strings, like '@dog,~@cat', into
raw tags, negated tag vectors, or vectors of disjoined tag expressions. The @
sign before tags is optional and whitespace between tags is removed. Examples:

    cat                      => (cat)
    @cat                     => (cat)
    ~@cat                    => ([:NEG cat])
    cat,~@dog,cow,~bunny     => ([:DISJ cat [:NEG dog] cow [:NEG bunny]])
    cat , ~@dog,cow , ~bunny => ([:DISJ cat [:NEG dog] cow [:NEG bunny]])
sourceraw docstring

oste-tag-grmrclj

source

oste-tag-phrase-cli-grmrclj

source

oste-tag-phrase-cli-prsrclj

source

oste-tag-prsrclj

source

scenario-grmrclj

source

scenario-line-grmrclj

source

scenario-line-prsrclj

source

scenario-outline-grmrclj

source

scenario-outline-line-grmrclj

source

scenario-outline-line-prsrclj

source

scenario-outline-prsrclj

source

scenario-prsrclj

source

so-step-block-grmrclj

source

so-step-block-prsrclj

source

so-step-grmrclj

source

so-step-prsrclj

source

step-block-grmrclj

source

step-block-prsrclj

source

step-data-grmrclj

source

step-grmrclj

source

step-label-grmrclj

source

step-label-prsrclj

source

step-prsrclj

source

table-grmrclj

source

table-prsrclj

source

table-row-grmrclj

source

table-row-prsrclj

source

tag-expression-cli-grmrclj

This grammar uses the PEG extensions of Instaparse in order to simulate the Shunting-yard algorithm. It will parse ambiguous boolean grammars such that (minimally) the example at https://github.com/cucumber/cucumber/tree/master/tag-expressions is correct::

(= (parser/parse-tag-expression-with-fallback
     not @a or @b and not @c or not @d or @e and @f)
'(or (or (or (not a) (and b (not c))) (not d)) (and e f)))

This is accomplished via strategic use of the 'ordered choice' operator '/'.

This grammar uses the PEG extensions of Instaparse in order to simulate the
Shunting-yard algorithm. It will parse ambiguous boolean grammars such that
(minimally) the example at
https://github.com/cucumber/cucumber/tree/master/tag-expressions is correct::

    (= (parser/parse-tag-expression-with-fallback
         not @a or @b and not @c or not @d or @e and @f)
    '(or (or (or (not a) (and b (not c))) (not d)) (and e f)))

This is accomplished via strategic use of the 'ordered choice' operator '/'.
sourceraw docstring

tag-expression-cli-prsrclj

source

tag-grmrclj

source

tag-line-grmrclj

source

tag-line-prsrclj

source

tag-prsrclj

source

tag-set-grmrclj

source

tag-set-prsrclj

source

variable-grmrclj

source

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

× close