Liking cljdoc? Tell your friends :D

the.parsatron


>>clj/smacro

(>> m)
(>> m n)
(>> m n & ms)

Expands into nested nxt forms

Expands into nested nxt forms
source (clj)source (cljs)raw docstring

alwaysclj/s

(always x)

A parser that always succeeds with the value given and consumes no input

A parser that always succeeds with the value given and consumes no
input
sourceraw docstring

any-charclj/s

(any-char)

Consume any character

Consume any character
sourceraw docstring

attemptclj/s

(attempt p)

A parser that will attempt to parse p, and upon failure never consume any input

A parser that will attempt to parse p, and upon failure never
consume any input
sourceraw docstring

betweenclj/s

(between open close p)

Parse p after parsing open and before parsing close, returning the value of p and discarding the values of open and close

Parse p after parsing open and before parsing close, returning the
value of p and discarding the values of open and close
sourceraw docstring

bindclj/s

(bind p f)

Parse p, and then q. The function f must be of one argument, it will be given the value of p and must return the q to follow p

Parse p, and then q. The function f must be of one argument, it
will be given the value of p and must return the q to follow p
sourceraw docstring

chclj/s

(ch c)

Consume the given character

Consume the given character
sourceraw docstring

ch?clj/s≠

clj
cljs
(ch? x)

Test for a single-character string. ClojureScript doesn't support a character type, so we pretend it does

Test for a single-character string.
ClojureScript doesn't support a character type, so we pretend it does
source (clj)source (cljs)raw docstring

choiceclj/s

(choice & parsers)

A varargs version of either that tries each given parser in turn, returning the value of the first one that succeeds

A varargs version of either that tries each given parser in turn,
returning the value of the first one that succeeds
sourceraw docstring

Continuecljs

source

defparserclj/smacro

(defparser name args & body)

Defines a new parser. Parsers are simply functions that accept the 5 arguments state, cok, cerr, eok, eerr but this macro takes care of writing that ceremony for you and wraps the body in a >>

Defines a new parser. Parsers are simply functions that accept the
5 arguments state, cok, cerr, eok, eerr but this macro takes care
of writing that ceremony for you and wraps the body in a >>
source (clj)source (cljs)raw docstring

digitclj/s

(digit)

Consume a digit [0-9] character

Consume a digit [0-9] character
sourceraw docstring

digit?clj/s

(digit? c)

Tests if a character is a digit: [0-9]

Tests if a character is a digit: [0-9]
source (clj)source (cljs)raw docstring

eitherclj/s

(either p q)

A parser that tries p, upon success, returning its value, and upon failure (if no input was consumed) tries to parse q

A parser that tries p, upon success, returning its value, and upon
failure (if no input was consumed) tries to parse q
sourceraw docstring

eofclj/s

(eof)

A parser to detect the end of input. If there is nothing more to consume from the underlying input, this parser suceeds with a nil value, otherwise it fails

A parser to detect the end of input. If there is nothing more to
consume from the underlying input, this parser suceeds with a nil
value, otherwise it fails
sourceraw docstring

Errcljs

source

examineclj/s

(examine)

Return the Parser's current state

Return the Parser's current state
sourceraw docstring

expect-errorclj/s

(expect-error msg pos)
source

extractclj/s

(extract f)

Extract information from the Parser's current state. f should be a fn of one argument, the parser's current state, and any value that it deems worthy of returning will be returned by the entire parser. No input is consumed by this parser, and the state itself is not altered.

Extract information from the Parser's current state. f should be a
fn of one argument, the parser's current state, and any value that
it deems worthy of returning will be returned by the entire parser.
No input is consumed by this parser, and the state itself is not
altered.
sourceraw docstring

inc-sourceposclj/s

(inc-sourcepos {:keys [line column]} c)

Increment the source position by a single character, c. On newline, increments the SourcePos's line number and resets the column, on all other characters, increments the column

Increment the source position by a single character, c. On newline,
increments the SourcePos's line number and resets the column, on
all other characters, increments the column
sourceraw docstring

InputStatecljs

source

let->>clj/smacro

(let->> [& bindings] & body)

Expands into nested bind forms

Expands into nested bind forms
source (clj)source (cljs)raw docstring

letterclj/s

(letter)

Consume a letter [a-zA-Z] character

Consume a letter [a-zA-Z] character
sourceraw docstring

letter?clj/s

(letter? c)

Tests if a character is a letter: [a-zA-Z]

Tests if a character is a letter: [a-zA-Z]
source (clj)source (cljs)raw docstring

linenoclj/s

(lineno)

A parser that returns the current line number. It consumes no input

A parser that returns the current line number. It consumes no input
sourceraw docstring

lookaheadclj/s

(lookahead p)

A parser that upon success consumes no input, but returns what was parsed

A parser that upon success consumes no input, but returns what was
parsed
sourceraw docstring

manyclj/s

(many p)

Consume zero or more p. A RuntimeException will be thrown if this combinator is applied to a parser that accepts the empty string, as that would cause the parser to loop forever

Consume zero or more p. A RuntimeException will be thrown if this
combinator is applied to a parser that accepts the empty string, as
that would cause the parser to loop forever
sourceraw docstring

many1clj/s

(many1 p)

Consume 1 or more p

Consume 1 or more p
sourceraw docstring

merge-errorsclj/s

(merge-errors {:keys [pos] :as err} other-err)
source

neverclj/s

(never)

A parser that always fails, consuming no input

A parser that always fails, consuming no input
sourceraw docstring

nxtclj/s

(nxt p q)

Parse p and then q, returning q's value and discarding p's

Parse p and then q, returning q's value and discarding p's
sourceraw docstring

Okcljs

source

parsatron-polineclj/s

(parsatron-poline f & args)

A trampoline for executing potentially stack-blowing recursive functions without running out of stack space. This particular trampoline differs from clojure.core/trampoline by requiring continuations to be wrapped in a Continue record. Will loop until the value is no longer a Continue record, returning that.

A trampoline for executing potentially stack-blowing recursive
functions without running out of stack space. This particular
trampoline differs from clojure.core/trampoline by requiring
continuations to be wrapped in a Continue record. Will loop until
the value is no longer a Continue record, returning that.
sourceraw docstring

ParseErrorcljs

source

runclj/s

(run p input)

Run a parser p over some input. The input can be a string or a seq of tokens, if the parser produces an error, its message is wrapped in a RuntimeException and thrown, and if the parser succeeds, its value is returned

Run a parser p over some input. The input can be a string or a seq
of tokens, if the parser produces an error, its message is wrapped
in a RuntimeException and thrown, and if the parser succeeds, its
value is returned
sourceraw docstring

run-parserclj/s

(run-parser p state)

Execute a parser p, given some state, Returns Ok or Err

Execute a parser p, given some state, Returns Ok or Err
sourceraw docstring

sequentiallyclj/s

(sequentially f value)
source

ShowableErrorclj/s≠protocol

show-errorclj/s

(show-error this)
source

SourcePoscljs

source

stringclj/s

(string s)

Consume the given string

Consume the given string
sourceraw docstring

timesclj/s

(times n p)

Consume exactly n number of p

Consume exactly n number of p
sourceraw docstring

tokenclj/s

(token consume?)

Consume a single item from the head of the input if (consume? item) is not nil. This parser will fail to consume if either the consume? test returns nil or if the input is empty

Consume a single item from the head of the input if (consume? item)
is not nil. This parser will fail to consume if either the consume?
test returns nil or if the input is empty
sourceraw docstring

unexpect-errorclj/s

(unexpect-error msg pos)
source

unknown-errorclj/s

(unknown-error {:keys [pos] :as state})
source

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

× close