This is the parsnip Reference Manual, version 0.0.7, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 06:18:57 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
parsnip
Parser combinator library
Samuel Hunter
(GIT https://git.sr.ht/~shunter/parsnip)
BSD 3-Clause
0.0.7
alexandria
(system).
parsnip.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
parsnip/parsnip.lisp
parsnip
(system).
char-if
(function).
char-in
(function).
char-of
(function).
collect
(function).
collect-into-string
(function).
collect1
(function).
defparser
(macro).
digit
(function).
eof
(function).
fail
(function).
flatmap
(function).
handle
(function).
handle-rewind
(function).
let!
(macro).
natural
(function).
ok
(function).
or!
(function).
parse
(function).
parser-error
(condition).
parser-error-column
(reader method).
parser-error-expected
(reader method).
parser-error-line
(reader method).
parser-error-return-trace
(reader method).
prog1!
(function).
prog2!
(function).
progn!
(function).
reduce!
(function).
sep
(function).
skip
(function).
skip-many
(function).
string-of
(function).
try!
(function).
advance-pstream
(function).
consume
(function).
function-designator
(type).
let@
(macro).
parse-stream
(function).
parse-stream
(structure).
peek
(function).
pstream-column
(reader).
(setf pstream-column)
(writer).
pstream-line
(reader).
(setf pstream-line)
(writer).
pstream-stream
(reader).
rewind
(function).
save
(function).
signal-failure
(function).
Packages are listed by definition order.
xyz.shunter.parsnip
Monadic parser combinator library
parsnip
common-lisp
.
char-if
(function).
char-in
(function).
char-of
(function).
collect
(function).
collect-into-string
(function).
collect1
(function).
defparser
(macro).
digit
(function).
eof
(function).
fail
(function).
flatmap
(function).
handle
(function).
handle-rewind
(function).
let!
(macro).
natural
(function).
ok
(function).
or!
(function).
parse
(function).
parser-error
(condition).
parser-error-column
(generic reader).
parser-error-expected
(generic reader).
parser-error-line
(generic reader).
parser-error-return-trace
(generic reader).
prog1!
(function).
prog2!
(function).
progn!
(function).
reduce!
(function).
sep
(function).
skip
(function).
skip-many
(function).
string-of
(function).
try!
(function).
advance-pstream
(function).
consume
(function).
function-designator
(type).
let@
(macro).
parse-stream
(function).
parse-stream
(structure).
peek
(function).
pstream-column
(reader).
(setf pstream-column)
(writer).
pstream-line
(reader).
(setf pstream-line)
(writer).
pstream-stream
(reader).
rewind
(function).
save
(function).
signal-failure
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Define a parser as a function. It can then be referenced as a function designator.
Return ap arser that runs all given parsers, binds them all to their variables, evaluates the body, and then runs the parser the body returns.
Return a parser that consumes a character that satisfies the given predicate.
Return a parser that consumes a character that’s only in the given charbag.
Return a parser that consumes the given character.
Return a parser that runs the given parser until failure, and collects all results into a list.
Return a parser that runs the given character parser until failure, and collects all characters into a string.
Return a parser that runs the given parser once, keeps parsing until failure, and then collects all results into a list.
Consume and return the number value of a digit.
Return a parser that consumes nothing and returns the given value (or nil) if the input stream is exhausted.
Return a parser that consumes nothing and fails, reporting the expected value.
Return a new parser that applies the given function to the parser’s result, and then runs the parser the function returns. This function forms the basis of stringing multiple parsers together.
Return a new parser that, on failure, applies the handler function to the parser’s expected value and parse trace (as a list), and then runs the parser the handler returns. HANDLE does not handle partial-parse failures, which can be recovered from via HANDLE-REWIND.
Return a new parser that saves the stream’s current position and, on failure, rewinds the stream, applies the handler function to the parser’s expected value and parse trace (as a list), and then runs the parser the handler returns. HANDLE-REWIND only works when the parser is given a seekable stream.
Consume and return a natural number.
Return a parser that consumes nothing and returns the given value.
Return a parser that tries each given parser in order (until a partial-parse failure) and returns the result of the first successful parse.
Run a parser through a given stream and raise any failures as a PARSER-ERROR.
Return a parser that strings together all given parsers and returns the first parser’s result.
Return a parser that strings together all given parsers and returns the second parser’s result.
Return a parser that strings together all given parsers and returns the last parser’s result.
Return a parser that keeps running until failure, and reduces its results into one value.
If INITIAL-PARSER is supplied, the parser may succeed without calling FUNCTION by returning INITIAL-PARSER’s response.
Return a parser that accepts a sequence of VALUE-PARSER input separated by SEP-PARSER input; such as values separated by commas.
Parse and pretend no input was consumed.
Keep parsing until failure and pretend no input was consumed.
Return a parser that consumes the given simple string. This parser may have consumed input on a failure.
Return a new parser that saves the stream’s current position and, on failure, rewinds the stream before passing the failure down. TRY! only works when the parser is given a seekable stream.
parser-error
)) ¶parser-error
)) ¶parser-error
)) ¶line
.
parser-error
)) ¶If a parser fails to read text, it signals a parser-error, containing a stream, its expected value, and a return trace of parsers.
stream-error
.
The (1-based) line number at which the parser failed
:line
This slot is read-only.
The (0-based) column number at which the parser failed
:column
This slot is read-only.
An object describing what the parser expected to read
:expected
This slot is read-only.
A list of (name line column) objects detailing the state of the parser when it failed
:return-trace
This slot is read-only.
Anaphoric self-callable LET.
Update the line and column of PSTREAM given the accepted char C and return PSTREAM.
line
.
Set the (stream) position, line, and column of PSTREAM with the SNAPSHOT received from SAVE.
Return the position, line, and column of PSTREAM.
Signal an error depending on the given fail.
Jump to: | (
A C D E F G H L M N O P R S T |
---|
Jump to: | (
A C D E F G H L M N O P R S T |
---|
Jump to: | C E L R S |
---|
Jump to: | C E L R S |
---|
Jump to: | C F P S T X |
---|
Jump to: | C F P S T X |
---|