(>> m)
(>> m n)
(>> m n & ms)
Expands into nested nxt forms
Expands into nested nxt forms
(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
(any-char)
Consume any character
Consume any character
(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
(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
(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
(char c)
Consume the given character
Consume the given character
(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
(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
(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 >>
(digit)
Consume a digit [0-9] character
Consume a digit [0-9] character
(digit? c)
Tests if a character is a digit: [0-9]
Tests if a character is a digit: [0-9]
(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
(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
(examine)
Return the Parser's current state
Return the Parser's current state
(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.
(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
(let->> [& bindings] & body)
Expands into nested bind forms
Expands into nested bind forms
(letter)
Consume a letter [a-zA-Z] character
Consume a letter [a-zA-Z] character
(letter? c)
Tests if a character is a letter: [a-zA-Z]
Tests if a character is a letter: [a-zA-Z]
(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
(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
(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
(never)
A parser that always fails, consuming no input
A parser that always fails, consuming no input
(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
(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.
(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
(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
(string s)
Consume the given string
Consume the given string
(times n p)
Consume exactly n number of p
Consume exactly n number of p
(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
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close