Main namespace for building and using Parka's PEG parsers. The functions in this file create Parka structures to describe, for example, a choice between several expressions. Such an expression can be compiled into a parser engine, and then this engine can be executed repeatedly on input strings.
Parser expressions are constructed from the following:
seq
).A grammar is a map from keyword labels to parsing expressions, plus a start symbol. Grammars are themselves a parsing expression and can be nested.
Once you have constructured your complete expression, call compile
with it.
The returned engine can be run by calling parse
.
Main namespace for building and using Parka's PEG parsers. The functions in this file create Parka structures to describe, for example, a choice between several expressions. Such an expression can be compiled into a parser engine, and then this engine can be executed repeatedly on input strings. Parser expressions are constructed from the following: - Characters parse exactly themselves. - Strings parse as a sequence of characters, exactly as given. - Sets of Characters parse any one character which is a member of the set. - A vector is a nestable sequence (equivalent to calling `seq`). - Keywords reference a nonterminal in the same grammar. - Each of the parser combinators in this namespace produces an expression. A grammar is a map from keyword labels to parsing expressions, plus a start symbol. Grammars are themselves a parsing expression and can be nested. Once you have constructured your complete expression, call `compile` with it. The returned engine can be run by calling `parse`.
Handles the compilation from the PEG grammar syntax to the parsing machine instructions.
Handles the compilation from the PEG grammar syntax to the parsing machine instructions.
Helper stream library for parsing, they're maps, like this:
key | description |
---|---|
:str | Entire input string |
:pos | Current index into that string |
:filename | Source file name |
:line | Current line number (1-based) |
:col | Current column number (0-based) |
:value | Arbitrary parsing result (optional) |
:state | Arbitrary user state (optional) |
Helper stream library for parsing, they're maps, like this: | key | description | | --- | ----------- | | `:str` | Entire input string | | `:pos` | Current index into that string | | `:filename` | Source file name | | `:line` | Current line number (1-based) | | `:col` | Current column number (0-based) | | `:value` | Arbitrary parsing result (optional) | | `:state` | Arbitrary user state (optional) |
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close