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
sourceraw 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
source (clj)source (cljs)raw docstring

any-charclj/s

(any-char)

Consume any character

Consume any character
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw docstring

charclj/s

(char c)

Consume the given character

Consume the given character
source (clj)source (cljs)raw docstring

char?cljs

(char? 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
sourceraw 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
source (clj)source (cljs)raw 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 >>
sourceraw docstring

digitclj/s

(digit)

Consume a digit [0-9] character

Consume a digit [0-9] character
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw docstring

Errcljs

source

examineclj/s

(examine)

Return the Parser's current state

Return the Parser's current state
source (clj)source (cljs)raw docstring

expect-errorclj/s

(expect-error msg pos)
source (clj)source (cljs)

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.
source (clj)source (cljs)raw docstring

failclj/s

(fail message)
source (clj)source (cljs)

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
source (clj)source (cljs)raw docstring

InputStatecljs

source

let->>clj/smacro

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

Expands into nested bind forms

Expands into nested bind forms
sourceraw docstring

letterclj/s

(letter)

Consume a letter [a-zA-Z] character

Consume a letter [a-zA-Z] character
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw docstring

many1clj/s

(many1 p)

Consume 1 or more p

Consume 1 or more p
source (clj)source (cljs)raw docstring

merge-errorsclj/s

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

neverclj/s

(never)

A parser that always fails, consuming no input

A parser that always fails, consuming no input
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw 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.
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw docstring

sequentiallyclj/s

(sequentially f value)
source (clj)source (cljs)

ShowableErrorclj/s≠protocol

show-errorclj/s

(show-error this)
source (clj)source (cljs)

SourcePoscljs

source

stringclj/s

(string s)

Consume the given string

Consume the given string
source (clj)source (cljs)raw docstring

timesclj/s

(times n p)

Consume exactly n number of p

Consume exactly n number of p
source (clj)source (cljs)raw 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
source (clj)source (cljs)raw docstring

unexpect-errorclj/s

(unexpect-error msg pos)
source (clj)source (cljs)

unknown-errorclj/s

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

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

× close