Liking cljdoc? Tell your friends :D

ari.parse.parse

Ari's parsing module:

The core of ari's input: this module allows for the EBNF/pyBNF grammars to be specified, so that other grammars can be read in by ari. Other grammars are then converted to this set of parser-functions.

Parser structure [tokens log] -> [{tree}, [remaining tokens log]] If the parser is unsuccessful, then {tree} will actually be nil, signifying error. The log argument is a dictionary, usually with the keys :all and :head defined as a subdictionary and key-list respectively.

Notes:

Parse technique: Given multiple parsers: While tokens are available for input.. For each available parser, try its first element If this matches, keep the parser in the group of possible parsers If it does not match, remove the parser from the current possible set If there are no parsers left, throw an error.

TODO: Once there is no input left, create a parse tree with the longest parser. If two syntax elements are ambiguous, throw an error.

Ari's parsing module:

The core of ari's input: this module allows for the EBNF/pyBNF grammars to be specified, so that other grammars can be read in by ari.
Other grammars are then converted to this set of parser-functions.

Parser structure
[tokens log] -> [{tree}, [remaining tokens log]]
If the parser is unsuccessful, then {tree} will actually be nil, signifying error.
The log argument is a dictionary, usually with the keys :all and :head defined as a subdictionary and key-list respectively.

Notes:

Parse technique:
Given multiple parsers:
While tokens are available for input..
For each available parser, try its first element
If this matches, keep the parser in the group of possible parsers
If it does not match, remove the parser from the current possible set
If there are no parsers left, throw an error.

TODO: Once there is no input left, create a parse tree with the longest parser. If two syntax elements are ambiguous, throw an error.
raw docstring

conseqclj

(conseq given-parsers)

Parse a list of given parsers, one after another. If one parser fails, this entire parser fails.

Parse a list of given parsers, one after another.
If one parser fails, this entire parser fails.
sourceraw docstring

conseq-mergeclj

(conseq-merge given-parsers)

Same functionality as conseq (Parse given parsers in order, failing if any of them fail). The output tree generated by conseq-merge will turn the list of values into a tree, instead. This assumes that parser list provides dictionary list-elements with unique keys. (Which is usually the case)

Same functionality as conseq (Parse given parsers in order, failing if any of them fail).
The output tree generated by conseq-merge will turn the list of values into a tree, instead.
This assumes that parser list provides dictionary list-elements with unique keys. (Which is usually the case)
sourceraw docstring

create-parserclj/smacro

(create-parser ident parser)

Create an unnamed parser that tags its resulting tree with the keyword ident

Create an unnamed parser that tags its resulting tree with the keyword ident
sourceraw docstring

defparserclj/smacro

(defparser ident parser)

Create an named parser (named $ident) that tags its resulting tree with the keyword $ident

Create an named parser (named $ident) that tags its resulting tree with the keyword $ident
sourceraw docstring

discardclj

(discard parser)

Require a parser to pass, but intentionally discard its result. This is useful for whitespace parsing and similar

Require a parser to pass, but intentionally discard its result.
This is useful for whitespace parsing and similar
sourceraw docstring

fromclj

(from parsers)

Parse any parser from a list. Currently, if the first parser succeeds, stops parsing.

Parse any parser from a list.
Currently, if the first parser succeeds, stops parsing.
sourceraw docstring

from-exceptclj

(from-except parsers out-parsers)

Apply the from function to a list of parsers, excluding others

Apply the from function to a list of parsers, excluding others
sourceraw docstring

manyclj

(many given-parser)

Parse a single parser as many times as possible, doesn't fail.

Parse a single parser as many times as possible, doesn't fail.
sourceraw docstring

many1clj

(many1 given-parser)

Parse a single parser at least once.

Parse a single parser at least once.
sourceraw docstring

optionalclj

(optional parser)

Optionally parse a parser

Optionally parse a parser
sourceraw docstring

orderedclj

(ordered parsers)
source

parseclj

(parse parser log content)
source

retrieveclj

(retrieve k ptree-atom)

Retrieve another parser by name from an atomic dictionary

Retrieve another parser by name from an atomic dictionary
sourceraw docstring

sep-byclj

source

sep-by1clj

source

spaceclj

source

spacedclj

(spaced parser)
source

spacesclj

source

whiteclj

(white parser)
source

whitespaceclj

source

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

× close