The parseq Reference Manual

This is the parseq Reference Manual, version 0.5.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 06:18:49 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 parseq

A library for parsing sequences such as strings and lists using parsing expression grammars.

Author

Marco Rossini

License

GPLv2

Version

0.5.0

Source

parseq.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 parseq/parseq.asd

Source

parseq.asd.

Parent Component

parseq (system).

ASDF Systems

parseq.


3.1.2 parseq/package.lisp

Source

parseq.asd.

Parent Component

parseq (system).

Packages

parseq.


3.1.3 parseq/conditions.lisp

Dependency

package.lisp (file).

Source

parseq.asd.

Parent Component

parseq (system).

Public Interface
Internals

3.1.4 parseq/utils.lisp

Dependency

conditions.lisp (file).

Source

parseq.asd.

Parent Component

parseq (system).

Internals

3.1.5 parseq/defrule.lisp

Dependency

utils.lisp (file).

Source

parseq.asd.

Parent Component

parseq (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 parseq

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Macros

Macro: defrule (name lambda-list expr &body options)
Package

parseq.

Source

defrule.lisp.

Macro: with-local-rules (&body body)
Package

parseq.

Source

defrule.lisp.

Macro: with-saved-rules (&body body)
Package

parseq.

Source

defrule.lisp.


5.1.2 Ordinary functions

Function: parseq (rule sequence &key start end junk-allowed parse-error)
Package

parseq.

Source

defrule.lisp.

Function: trace-rule (name &key recursive)
Package

parseq.

Source

defrule.lisp.

Function: untrace-rule (name)
Package

parseq.

Source

defrule.lisp.


5.1.3 Generic functions

Generic Reader: parse-error-position (condition)
Generic Writer: (setf parse-error-position) (condition)
Package

parseq.

Methods
Reader Method: parse-error-position ((condition parse-match-error))
Writer Method: (setf parse-error-position) ((condition parse-match-error))
Source

conditions.lisp.

Target Slot

position.

Generic Reader: parse-error-terminals (condition)
Generic Writer: (setf parse-error-terminals) (condition)
Package

parseq.

Methods
Reader Method: parse-error-terminals ((condition parse-match-error))
Writer Method: (setf parse-error-terminals) ((condition parse-match-error))
Source

conditions.lisp.

Target Slot

terminals.


5.1.4 Conditions

Condition: generic-parse-error

Generic parsing error

Package

parseq.

Source

conditions.lisp.

Direct superclasses

parseq-error.

Direct subclasses
Condition: invalid-operation-error

Error condition for rule definitions where the usage of an operation is invalid.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

rule-definition-error.

Condition: invalid-rule-error

Error condition for malformed calls to rules.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

runtime-error.

Condition: invalid-terminal-error

Error condition for rule definitions where a terminal is unknown.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

rule-definition-error.

Condition: left-recursion-error

Error condition for situations where left recursion is detected at runtime.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

runtime-error.

Condition: parse-junk-error

Error condition for when the sequence is only partially parsed, leaving junk at the end.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

generic-parse-error.

Condition: parse-match-error

Error condition for when the sequence does not match the parsing grammar rules.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

generic-parse-error.

Direct methods
Direct slots
Slot: position
Package

common-lisp.

Initargs

:position

Readers

parse-error-position.

Writers

(setf parse-error-position).

Slot: terminals
Initform

(quote nil)

Initargs

:terminals

Readers

parse-error-terminals.

Writers

(setf parse-error-terminals).

Condition: parseq-error

Generic error for the parseq library

Package

parseq.

Source

conditions.lisp.

Direct superclasses

simple-error.

Direct subclasses
Condition: processing-options-error

Error condition for rule definitions where a processing option is invalid.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

rule-definition-error.

Condition: rule-definition-error

Generic error for rule definitions

Package

parseq.

Source

conditions.lisp.

Direct superclasses

parseq-error.

Direct subclasses
Condition: runtime-error

Generic runtime error

Package

parseq.

Source

conditions.lisp.

Direct superclasses

parseq-error.

Direct subclasses
Condition: unknown-rule-error

Error condition for situations where a rule definition is not found at runtime.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

runtime-error.


5.2 Internals


5.2.1 Special variables

Special Variable: *ascii-standard-chars*
Package

parseq.

Source

defrule.lisp.

Special Variable: *packrat-table*
Package

parseq.

Source

defrule.lisp.

Special Variable: *rule-table*
Package

parseq.

Source

defrule.lisp.

Special Variable: *terminal-failure-list*
Package

parseq.

Source

defrule.lisp.

Special Variable: *trace-depth*
Package

parseq.

Source

defrule.lisp.

Special Variable: *trace-recursive*
Package

parseq.

Source

defrule.lisp.

Special Variable: *trace-rule*
Package

parseq.

Source

defrule.lisp.


5.2.2 Macros

Macro: appendf (list &rest items)

Appends the given item to the list using setf.

Package

parseq.

Source

utils.lisp.

Macro: case-test ((keyform &key test) &body clauses)
Package

parseq.

Source

utils.lisp.

Macro: conditional-dynamic-bind ((&rest bindings) condition &body body)

Establishes the dynamic bindings if condition evaluates to true.

Package

parseq.

Source

utils.lisp.

Macro: f-error (type (&rest initargs) control &rest args)

Like (error ...), but allows the condition type to be specified (which is required to inherit from simple-condition).

Package

parseq.

Source

conditions.lisp.

Macro: if-hash ((key hash-table &key var place) then &optional else)
Package

parseq.

Source

utils.lisp.

Macro: let-special ((&rest vars) &body body)
Package

parseq.

Source

utils.lisp.

Macro: or2 (&rest forms)
Package

parseq.

Source

utils.lisp.

Macro: or2-exclusive ((exclusion-list) &rest forms)
Package

parseq.

Source

utils.lisp.

Macro: rule-options-bind ((specials externals processing packrat) options name &body body)
Package

parseq.

Source

defrule.lisp.

Macro: runtime-match (terminal expr pos test result &optional inc)
Package

parseq.

Source

defrule.lisp.

Macro: test-and-advance (terminal expr pos test result &optional inc)
Package

parseq.

Source

defrule.lisp.

Macro: try-and-advance (func pos)
Package

parseq.

Source

defrule.lisp.

Macro: with-expansion (((result-var success-var) expr rule pos args) &body body)
Package

parseq.

Source

defrule.lisp.

Macro: with-expansion-failure (((result-var success-var) expr rule pos args) then else)
Package

parseq.

Source

defrule.lisp.

Macro: with-expansion-success (((result-var success-var) expr rule pos args) then else)
Package

parseq.

Source

defrule.lisp.

Macro: with-gensyms ((&rest names) &body body)
Package

parseq.

Source

utils.lisp.

Macro: with-left-recursion-protection ((pos stack) &body body)
Package

parseq.

Source

defrule.lisp.

Macro: with-packrat ((enabled name pos lambda-list external-bindings memo) &body body)
Package

parseq.

Source

defrule.lisp.

Macro: with-special-vars-from-options (bindings &body body)
Package

parseq.

Source

defrule.lisp.

Macro: with-tracing ((name pos memo) &body body)
Package

parseq.

Source

defrule.lisp.


5.2.3 Ordinary functions

Function: cat (&rest items)
Package

parseq.

Source

utils.lisp.

Function: check-range (count range)
Package

parseq.

Source

utils.lisp.

Function: choice-item (treepos tree)

Retrieves an item from the tree by using the given treepointer, or NIL if such a position does not exist.

Package

parseq.

Source

utils.lisp.

Function: copy-hash-table (hash-table)
Package

parseq.

Source

utils.lisp.

Function: decode-range (range)
Package

parseq.

Source

utils.lisp.

Function: expand-! (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-& (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-* (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-+ (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-? (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-and (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-and~ (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-and~~ (expr rep rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-atom (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-choice (indices result)
Package

parseq.

Source

defrule.lisp.

Function: expand-destructure (destruct-lambda result body)
Package

parseq.

Source

defrule.lisp.

Function: expand-list-expr (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-not (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-or (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-parse-call (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-parse-call-recursion (rule args)
Package

parseq.

Source

defrule.lisp.

Function: expand-processing-options (result procs)
Package

parseq.

Source

defrule.lisp.

Function: expand-regexp-bracket-expression (expr)
Package

parseq.

Source

defrule.lisp.

Function: expand-rep (range expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-rule (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-sequence (expr rules pos args type-test terminal)
Package

parseq.

Source

defrule.lisp.

Function: flatten (x)

Flattens the given tree, x, into a list.

Package

parseq.

Source

utils.lisp.

Function: have (item sequence &key test key)
Package

parseq.

Source

utils.lisp.

Function: is-traced (trace-option)
Package

parseq.

Source

defrule.lisp.

Function: is-traced-with-recursion (trace-option)
Package

parseq.

Source

defrule.lisp.

Function: l< (list length)

Tests efficiently whether the length of the list is smaller than the given length.

Package

parseq.

Source

utils.lisp.

Function: l<= (list length)

Tests efficiently whether the length of the list is smaller or equal to the given length.

Package

parseq.

Source

utils.lisp.

Function: l= (list length)

Tests efficiently whether the length of the list is equal to the given length.

Package

parseq.

Source

utils.lisp.

Function: l> (list length)

Tests efficiently whether the length of the list is greater than the given length.

Package

parseq.

Source

utils.lisp.

Function: l>= (list length)

Tests efficiently whether the length of the list is greater or equal to the given length.

Package

parseq.

Source

utils.lisp.

Function: lambda-list-vars (lambda-list)
Package

parseq.

Source

utils.lisp.

Function: last-1 (list)

Retrieves the last item from the given list.

Package

parseq.

Source

utils.lisp.

Function: make-checklist (counts ranges)
Package

parseq.

Source

defrule.lisp.

Function: make-packrat-key (treepos lambda-list external-bindings)

Generates a key for the packrat memoization hash table.

Package

parseq.

Source

defrule.lisp.

Function: make-treepos (&rest indices)

Creates a new tree position object.

Package

parseq.

Source

utils.lisp.

Function: mklist (item)
Package

parseq.

Source

utils.lisp.

Function: parseq-internal (rule sequence pos)
Package

parseq.

Source

defrule.lisp.

Function: push-terminal-failure (pos terminal)
Package

parseq.

Source

defrule.lisp.

Function: quoted-symbol-p (x)
Package

parseq.

Source

utils.lisp.

Function: runtime-dispatch (expr arg pos)
Package

parseq.

Source

defrule.lisp.

Function: sequence= (seq-a seq-b &key start1 start2 end1 end2 test key)
Package

parseq.

Source

utils.lisp.

Function: sequencep (object)
Package

parseq.

Source

utils.lisp.

Function: shuffle (list)

Creates a new list in which the items of the given list are shuffled

Package

parseq.

Source

utils.lisp.

Function: subseq-at (subseq seq pos)
Package

parseq.

Source

utils.lisp.

Function: symbol= (a b)
Package

parseq.

Source

utils.lisp.

Function: treeitem (treepos tree)

Retrieves an item from the tree by using the given treepointer.

Package

parseq.

Source

utils.lisp.

Function: treepos-copy (treepos &optional depth)
Package

parseq.

Source

utils.lisp.

Function: treepos-depth (treepos)
Package

parseq.

Source

utils.lisp.

Function: treepos-elt (treepos index)
Package

parseq.

Source

utils.lisp.

Function: treepos-highest (treepos)
Package

parseq.

Source

utils.lisp.

Function: treepos-length (treepos tree)

Determines the length of the item in the tree pointed to by treepos.

Package

parseq.

Source

utils.lisp.

Function: treepos-lowest (treepos)
Package

parseq.

Source

utils.lisp.

Function: treepos-step (treepos &optional delta)

Copies the tree pointer and increments the tree position.

Package

parseq.

Source

utils.lisp.

Function: treepos-step-down (treepos)
Package

parseq.

Source

utils.lisp.

Function: treepos-str (treepos)
Package

parseq.

Source

utils.lisp.

Function: treepos-valid (treepos tree)

Verifies whether the given position exists in the given tree.

Package

parseq.

Source

utils.lisp.

Function: treepos= (a b)
Package

parseq.

Source

utils.lisp.

Function: treepos> (a b)
Package

parseq.

Source

utils.lisp.

Function: two-way-index (index list)
Package

parseq.

Source

utils.lisp.

Function: unsigned-byte-p (object)
Package

parseq.

Source

utils.lisp.


5.2.4 Conditions

Condition: invalid-terminal-runtime-error

Error condition for situations where an invalid terminal in an expression is detected at runtime.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

runtime-error.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   C   D   E   F   G   H   I   L   M   O   P   Q   R   S   T   U   W  
Index Entry  Section

(
(setf parse-error-position): Public generic functions
(setf parse-error-position): Public generic functions
(setf parse-error-terminals): Public generic functions
(setf parse-error-terminals): Public generic functions

A
appendf: Private macros

C
case-test: Private macros
cat: Private ordinary functions
check-range: Private ordinary functions
choice-item: Private ordinary functions
conditional-dynamic-bind: Private macros
copy-hash-table: Private ordinary functions

D
decode-range: Private ordinary functions
defrule: Public macros

E
expand-!: Private ordinary functions
expand-&: Private ordinary functions
expand-*: Private ordinary functions
expand-+: Private ordinary functions
expand-?: Private ordinary functions
expand-and: Private ordinary functions
expand-and~: Private ordinary functions
expand-and~~: Private ordinary functions
expand-atom: Private ordinary functions
expand-choice: Private ordinary functions
expand-destructure: Private ordinary functions
expand-list-expr: Private ordinary functions
expand-not: Private ordinary functions
expand-or: Private ordinary functions
expand-parse-call: Private ordinary functions
expand-parse-call-recursion: Private ordinary functions
expand-processing-options: Private ordinary functions
expand-regexp-bracket-expression: Private ordinary functions
expand-rep: Private ordinary functions
expand-rule: Private ordinary functions
expand-sequence: Private ordinary functions

F
f-error: Private macros
flatten: Private ordinary functions
Function, cat: Private ordinary functions
Function, check-range: Private ordinary functions
Function, choice-item: Private ordinary functions
Function, copy-hash-table: Private ordinary functions
Function, decode-range: Private ordinary functions
Function, expand-!: Private ordinary functions
Function, expand-&: Private ordinary functions
Function, expand-*: Private ordinary functions
Function, expand-+: Private ordinary functions
Function, expand-?: Private ordinary functions
Function, expand-and: Private ordinary functions
Function, expand-and~: Private ordinary functions
Function, expand-and~~: Private ordinary functions
Function, expand-atom: Private ordinary functions
Function, expand-choice: Private ordinary functions
Function, expand-destructure: Private ordinary functions
Function, expand-list-expr: Private ordinary functions
Function, expand-not: Private ordinary functions
Function, expand-or: Private ordinary functions
Function, expand-parse-call: Private ordinary functions
Function, expand-parse-call-recursion: Private ordinary functions
Function, expand-processing-options: Private ordinary functions
Function, expand-regexp-bracket-expression: Private ordinary functions
Function, expand-rep: Private ordinary functions
Function, expand-rule: Private ordinary functions
Function, expand-sequence: Private ordinary functions
Function, flatten: Private ordinary functions
Function, have: Private ordinary functions
Function, is-traced: Private ordinary functions
Function, is-traced-with-recursion: Private ordinary functions
Function, l<: Private ordinary functions
Function, l<=: Private ordinary functions
Function, l=: Private ordinary functions
Function, l>: Private ordinary functions
Function, l>=: Private ordinary functions
Function, lambda-list-vars: Private ordinary functions
Function, last-1: Private ordinary functions
Function, make-checklist: Private ordinary functions
Function, make-packrat-key: Private ordinary functions
Function, make-treepos: Private ordinary functions
Function, mklist: Private ordinary functions
Function, parseq: Public ordinary functions
Function, parseq-internal: Private ordinary functions
Function, push-terminal-failure: Private ordinary functions
Function, quoted-symbol-p: Private ordinary functions
Function, runtime-dispatch: Private ordinary functions
Function, sequence=: Private ordinary functions
Function, sequencep: Private ordinary functions
Function, shuffle: Private ordinary functions
Function, subseq-at: Private ordinary functions
Function, symbol=: Private ordinary functions
Function, trace-rule: Public ordinary functions
Function, treeitem: Private ordinary functions
Function, treepos-copy: Private ordinary functions
Function, treepos-depth: Private ordinary functions
Function, treepos-elt: Private ordinary functions
Function, treepos-highest: Private ordinary functions
Function, treepos-length: Private ordinary functions
Function, treepos-lowest: Private ordinary functions
Function, treepos-step: Private ordinary functions
Function, treepos-step-down: Private ordinary functions
Function, treepos-str: Private ordinary functions
Function, treepos-valid: Private ordinary functions
Function, treepos=: Private ordinary functions
Function, treepos>: Private ordinary functions
Function, two-way-index: Private ordinary functions
Function, unsigned-byte-p: Private ordinary functions
Function, untrace-rule: Public ordinary functions

G
Generic Function, (setf parse-error-position): Public generic functions
Generic Function, (setf parse-error-terminals): Public generic functions
Generic Function, parse-error-position: Public generic functions
Generic Function, parse-error-terminals: Public generic functions

H
have: Private ordinary functions

I
if-hash: Private macros
is-traced: Private ordinary functions
is-traced-with-recursion: Private ordinary functions

L
l<: Private ordinary functions
l<=: Private ordinary functions
l=: Private ordinary functions
l>: Private ordinary functions
l>=: Private ordinary functions
lambda-list-vars: Private ordinary functions
last-1: Private ordinary functions
let-special: Private macros

M
Macro, appendf: Private macros
Macro, case-test: Private macros
Macro, conditional-dynamic-bind: Private macros
Macro, defrule: Public macros
Macro, f-error: Private macros
Macro, if-hash: Private macros
Macro, let-special: Private macros
Macro, or2: Private macros
Macro, or2-exclusive: Private macros
Macro, rule-options-bind: Private macros
Macro, runtime-match: Private macros
Macro, test-and-advance: Private macros
Macro, try-and-advance: Private macros
Macro, with-expansion: Private macros
Macro, with-expansion-failure: Private macros
Macro, with-expansion-success: Private macros
Macro, with-gensyms: Private macros
Macro, with-left-recursion-protection: Private macros
Macro, with-local-rules: Public macros
Macro, with-packrat: Private macros
Macro, with-saved-rules: Public macros
Macro, with-special-vars-from-options: Private macros
Macro, with-tracing: Private macros
make-checklist: Private ordinary functions
make-packrat-key: Private ordinary functions
make-treepos: Private ordinary functions
Method, (setf parse-error-position): Public generic functions
Method, (setf parse-error-terminals): Public generic functions
Method, parse-error-position: Public generic functions
Method, parse-error-terminals: Public generic functions
mklist: Private ordinary functions

O
or2: Private macros
or2-exclusive: Private macros

P
parse-error-position: Public generic functions
parse-error-position: Public generic functions
parse-error-terminals: Public generic functions
parse-error-terminals: Public generic functions
parseq: Public ordinary functions
parseq-internal: Private ordinary functions
push-terminal-failure: Private ordinary functions

Q
quoted-symbol-p: Private ordinary functions

R
rule-options-bind: Private macros
runtime-dispatch: Private ordinary functions
runtime-match: Private macros

S
sequence=: Private ordinary functions
sequencep: Private ordinary functions
shuffle: Private ordinary functions
subseq-at: Private ordinary functions
symbol=: Private ordinary functions

T
test-and-advance: Private macros
trace-rule: Public ordinary functions
treeitem: Private ordinary functions
treepos-copy: Private ordinary functions
treepos-depth: Private ordinary functions
treepos-elt: Private ordinary functions
treepos-highest: Private ordinary functions
treepos-length: Private ordinary functions
treepos-lowest: Private ordinary functions
treepos-step: Private ordinary functions
treepos-step-down: Private ordinary functions
treepos-str: Private ordinary functions
treepos-valid: Private ordinary functions
treepos=: Private ordinary functions
treepos>: Private ordinary functions
try-and-advance: Private macros
two-way-index: Private ordinary functions

U
unsigned-byte-p: Private ordinary functions
untrace-rule: Public ordinary functions

W
with-expansion: Private macros
with-expansion-failure: Private macros
with-expansion-success: Private macros
with-gensyms: Private macros
with-left-recursion-protection: Private macros
with-local-rules: Public macros
with-packrat: Private macros
with-saved-rules: Public macros
with-special-vars-from-options: Private macros
with-tracing: Private macros


A.4 Data types

Jump to:   C   D   F   G   I   L   P   R   S   U  
Index Entry  Section

C
Condition, generic-parse-error: Public conditions
Condition, invalid-operation-error: Public conditions
Condition, invalid-rule-error: Public conditions
Condition, invalid-terminal-error: Public conditions
Condition, invalid-terminal-runtime-error: Private conditions
Condition, left-recursion-error: Public conditions
Condition, parse-junk-error: Public conditions
Condition, parse-match-error: Public conditions
Condition, parseq-error: Public conditions
Condition, processing-options-error: Public conditions
Condition, rule-definition-error: Public conditions
Condition, runtime-error: Public conditions
Condition, unknown-rule-error: Public conditions
conditions.lisp: The parseq/conditions․lisp file

D
defrule.lisp: The parseq/defrule․lisp file

F
File, conditions.lisp: The parseq/conditions․lisp file
File, defrule.lisp: The parseq/defrule․lisp file
File, package.lisp: The parseq/package․lisp file
File, parseq.asd: The parseq/parseq․asd file
File, utils.lisp: The parseq/utils․lisp file

G
generic-parse-error: Public conditions

I
invalid-operation-error: Public conditions
invalid-rule-error: Public conditions
invalid-terminal-error: Public conditions
invalid-terminal-runtime-error: Private conditions

L
left-recursion-error: Public conditions

P
Package, parseq: The parseq package
package.lisp: The parseq/package․lisp file
parse-junk-error: Public conditions
parse-match-error: Public conditions
parseq: The parseq system
parseq: The parseq package
parseq-error: Public conditions
parseq.asd: The parseq/parseq․asd file
processing-options-error: Public conditions

R
rule-definition-error: Public conditions
runtime-error: Public conditions

S
System, parseq: The parseq system

U
unknown-rule-error: Public conditions
utils.lisp: The parseq/utils․lisp file