This is the esrap Reference Manual, version 0.18, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 05:07:33 2024 GMT+0.
esrap/esrap.asd
esrap/early/package.lisp
esrap/early/types.lisp
esrap/early/protocol.lisp
esrap/early/variables.lisp
esrap/early/conditions.lisp
esrap/early/expressions.lisp
esrap/early/rule.lisp
esrap/early/results.lisp
esrap/cache/chunk.lisp
esrap/cache/packrat.lisp
esrap/src/context.lisp
esrap/src/evaluator.lisp
esrap/src/macros.lisp
esrap/src/interface.lisp
esrap/src/editor-support.lisp
The main system appears first, followed by any subsystem dependency.
esrap
A Packrat / Parsing Grammar / TDPL parser for Common Lisp.
Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
Nikodemus Siivola <nikodemus@random-state.net>
Jan Moringen <jmoringe@techfak.uni-bielefeld.de>
(GIT https://github.com/scymtym/esrap.git)
MIT
A Packrat / Parsing Grammar / TDPL parser for Common Lisp.
Notable features include
* dynamic redefinition of nonterminals
* inline grammars
* semantic predicates
* introspective facilities (describing grammars,
tracing, setting breaks)
* left-recursive grammars
* functions as terminals
* accurate, customizable parse error reports
See README.org and :homepage for more information.
0.18
alexandria
(system).
trivial-with-current-source-form
(system).
early
(module).
cache
(module).
src
(module).
examples
(module).
readme.org
(file).
Modules are listed depth-first from the system components tree.
esrap/early
esrap
(system).
package.lisp
(file).
types.lisp
(file).
protocol.lisp
(file).
variables.lisp
(file).
conditions.lisp
(file).
expressions.lisp
(file).
rule.lisp
(file).
results.lisp
(file).
esrap/cache
early
(module).
esrap
(system).
chunk.lisp
(file).
packrat.lisp
(file).
esrap/src
esrap
(system).
context.lisp
(file).
evaluator.lisp
(file).
macros.lisp
(file).
interface.lisp
(file).
editor-support.lisp
(file).
esrap/examples
esrap
(system).
sexp.lisp
(file).
symbol-table.lisp
(file).
left-recursion.lisp
(file).
function-terminals.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
esrap/esrap.asd
esrap/early/package.lisp
esrap/early/types.lisp
esrap/early/protocol.lisp
esrap/early/variables.lisp
esrap/early/conditions.lisp
esrap/early/expressions.lisp
esrap/early/rule.lisp
esrap/early/results.lisp
esrap/cache/chunk.lisp
esrap/cache/packrat.lisp
esrap/src/context.lisp
esrap/src/evaluator.lisp
esrap/src/macros.lisp
esrap/src/interface.lisp
esrap/src/editor-support.lisp
esrap/early/types.lisp
package.lisp
(file).
early
(module).
cache-policy
(type).
character-range
(type).
error-report-behavior-suitable-for-report-part-p
(function).
error-report-part
(type).
input-length
(type).
input-position
(type).
left-recursion-policy
(type).
nonterminal
(type).
predicate
(type).
predicate-name
(type).
rule-error-report
(type).
rule-error-report-pattern
(type).
terminal
(type).
esrap/early/protocol.lisp
types.lisp
(file).
early
(module).
esrap-error-position
(generic function).
esrap-parse-error-context
(generic function).
esrap-parse-error-result
(generic reader).
esrap/early/variables.lisp
protocol.lisp
(file).
early
(module).
*on-left-recursion*
(special variable).
*eval-nonterminals*
(special variable).
esrap/early/conditions.lisp
variables.lisp
(file).
early
(module).
esrap-error
(condition).
esrap-error-position
(reader method).
esrap-error-position
(method).
esrap-error-text
(reader method).
esrap-parse-error
(function).
esrap-parse-error
(condition).
esrap-parse-error-context
(method).
esrap-parse-error-result
(reader method).
invalid-expression-error
(function).
invalid-expression-error
(condition).
invalid-expression-error-expression
(reader method).
left-recursion
(function).
left-recursion
(condition).
left-recursion-nonterminal
(reader method).
left-recursion-path
(reader method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
undefined-rule-error
(condition).
undefined-rule-symbol
(reader method).
esrap-parse-error-%context
(reader method).
(setf esrap-parse-error-%context)
(writer method).
undefined-rule
(function).
undefined-rule
(condition).
esrap/early/expressions.lisp
conditions.lisp
(file).
early
(module).
describe-terminal
(function).
expression-start-terminals
(function).
%expression-dependencies
(function).
%expression-direct-dependencies
(function).
*expression-kinds*
(special variable).
check-expression
(function).
check-function-reference
(function).
expression-case
(macro).
expression-equal-p
(function).
expression-simple-p
(function).
expression<
(function).
print-terminal
(function).
with-expression
(macro).
esrap/early/rule.lisp
expressions.lisp
(file).
early
(module).
print-object
(method).
rule
(class).
rule-dependencies
(function).
rule-symbol
(reader method).
shared-initialize
(method).
%rule-direct-dependencies
(function).
*rules*
(special variable).
+default-rule-properties+
(constant).
cell-%info
(reader).
(setf cell-%info)
(writer).
cell-function
(function).
cell-referents
(reader).
(setf cell-referents)
(writer).
cell-rule
(function).
cell-trace-info
(reader).
(setf cell-trace-info)
(writer).
clear-rules
(function).
delete-rule-cell
(function).
dereference-rule-cell
(function).
detach-rule
(function).
ensure-rule-cell
(function).
find-rule-cell
(function).
make-rule-cell
(function).
make-rule-properties
(function).
reference-rule-cell
(function).
rule-around
(reader method).
rule-cell
(structure).
rule-condition
(reader method).
rule-direct-dependencies
(function).
rule-error-report
(reader method).
rule-guard-expression
(reader method).
rule-properties
(reader method).
rule-properties/packed
(type).
rule-property-p
(function).
rule-suitable-for-report-part-p
(function).
rule-transform
(reader method).
set-cell-info
(function).
sort-dependencies
(function).
undefined-rule-function
(function).
esrap/early/results.lisp
rule.lisp
(file).
early
(module).
print-object
(method).
%make-successful-parse
(function).
*result-pprint-dispatch*
(special variable).
error-report
(function).
error-result
(structure).
error-result-%position
(function).
(setf error-result-%position)
(function).
error-result-detail
(function).
error-result-expression
(function).
error-result-p
(function).
failed-parse
(structure).
failed-parse-%position
(function).
(setf failed-parse-%position)
(function).
failed-parse-detail
(function).
failed-parse-expression
(function).
failed-parse-p
(function).
flattened-children
(function).
inactive-rule
(structure).
inactive-rule-%position
(function).
(setf inactive-rule-%position)
(function).
inactive-rule-detail
(function).
inactive-rule-expression
(function).
inactive-rule-p
(function).
inactive-rule-rule
(function).
left-recursion-result
(structure).
left-recursion-result-%position
(function).
(setf left-recursion-result-%position)
(function).
left-recursion-result-detail
(function).
left-recursion-result-expression
(function).
left-recursion-result-head
(reader).
(setf left-recursion-result-head)
(writer).
left-recursion-result-p
(function).
left-recursion-result-rule
(function).
list-of-result-productions
(function).
list-of-result-productions/butlast
(function).
make-failed-parse
(function).
make-failed-parse/no-position
(function).
make-inactive-rule
(function).
make-left-recursion-result
(function).
make-successful-parse
(macro).
map-max-leaf-results
(function).
map-max-results
(function).
map-results
(function).
max-of-result-positions
(function).
maybe-augment-inactive-rules
(function).
partition-results
(function).
print-result
(function).
result
(structure).
result-%position
(reader).
(setf result-%position)
(writer).
result-context
(function).
result-detail
(reader).
result-expected-input
(function).
result-expression
(reader).
result-nonterminal-p
(function).
result-p
(function).
result-position
(function).
result-root-cause
(function).
result-suitable-for-report-part-p
(function).
result-trivial-predicate-p
(function).
result-unsatisfied-predicate-p
(function).
successful-parse
(structure).
successful-parse-%position
(function).
(setf successful-parse-%position)
(function).
successful-parse-%production
(reader).
(setf successful-parse-%production)
(writer).
successful-parse-detail
(function).
successful-parse-expression
(function).
successful-parse-p
(function).
successful-parse-production
(function).
esrap/cache/chunk.lisp
cache
(module).
%make-chunk-array
(function).
+chunk-divisor+
(constant).
chunk
(type).
chunk-array
(type).
chunk-cache
(structure).
chunk-cache-chunks
(reader).
(setf chunk-cache-chunks)
(writer).
ensure-chunk
(function).
find-chunk
(function).
make-chunk
(function).
make-chunk-array
(function).
make-chunk-cache
(function).
esrap/cache/packrat.lisp
chunk.lisp
(file).
cache
(module).
+packrat-hash-table-switch-point+
(constant).
alist-hash-table/no-dups
(macro).
cached
(function).
(setf cached)
(function).
esrap/src/context.lisp
src
(module).
*context*
(special variable).
context
(structure).
context-cache
(reader).
context-heads
(reader).
context-nonterminal-stack
(reader).
(setf context-nonterminal-stack)
(writer).
context-p
(function).
copy-context
(function).
get-cached
(function).
(setf get-cached)
(function).
get-head
(function).
(setf get-head)
(function).
head
(structure).
head-eval-set
(reader).
(setf head-eval-set)
(writer).
head-involved-set
(reader).
(setf head-involved-set)
(writer).
head-rule
(reader).
(setf head-rule)
(writer).
make-cache
(function).
make-context
(function).
make-head
(function).
make-heads
(function).
recall
(function).
with-cached-result
(macro).
with-pushed-nonterminal
(macro).
esrap/src/evaluator.lisp
context.lisp
(file).
src
(module).
*current-rule*
(special variable).
analyze-ordered-choise
(function).
check-ordered-choise-prefix
(function).
compile-character
(function).
compile-character-ranges
(function).
compile-expression
(function).
compile-followed-by
(function).
compile-greedy-positive-repetition
(function).
compile-greedy-repetition
(function).
compile-look-ahead
(function).
compile-look-behind
(function).
compile-negation
(function).
compile-nonterminal
(function).
compile-not-followed-by
(function).
compile-optional
(function).
compile-ordered-choise
(function).
compile-rule
(function).
compile-semantic-predicate
(function).
compile-sequence
(function).
compile-string
(function).
compile-terminal
(function).
compile-terminal-function
(function).
eval-character
(function).
eval-character-ranges
(function).
eval-expression
(function).
eval-followed-by
(function).
eval-greedy-positive-repetition
(function).
eval-greedy-repetition
(function).
eval-look-ahead
(function).
eval-look-behind
(function).
eval-negation
(function).
eval-nonterminal
(function).
eval-not-followed-by
(function).
eval-optional
(function).
eval-ordered-choise
(function).
eval-semantic-predicate
(function).
eval-sequence
(function).
eval-string
(function).
eval-terminal
(function).
eval-terminal-function
(function).
exec-character-ranges
(function).
exec-negation
(function).
exec-nonterminal
(function).
exec-string
(function).
exec-terminal-function
(function).
expression-lambda
(macro).
make-ordered-choise-result
(function).
match-terminal/1/case-insensitive-p
(function).
match-terminal/1/case-sensitive-p
(function).
match-terminal/case-insensitive-p
(function).
match-terminal/case-sensitive-p
(function).
resolve-function
(function).
rule-trivial-p
(function).
esrap/src/macros.lisp
evaluator.lisp
(file).
src
(module).
text
(function).
check-lambda-list
(function).
expand-transforms
(function).
parse-defrule-options
(function).
parse-lambda-list-maybe-containing-&bounds
(function).
singleton-option
(function).
esrap/src/interface.lisp
macros.lisp
(file).
src
(module).
add-rule
(function).
change-rule
(function).
defrule
(macro).
describe-grammar
(function).
find-rule
(function).
parse
(compiler macro).
parse
(function).
remove-rule
(function).
rule-expression
(function).
(setf rule-expression)
(function).
trace-rule
(function).
untrace-all-rules
(function).
untrace-rule
(function).
*trace-level*
(special variable).
process-parse-result
(function).
esrap/src/editor-support.lisp
interface.lisp
(file).
src
(module).
*indentation-hint-table*
(special variable).
hint-slime-indentation
(function).
hint-sly-indentation
(function).
Packages are listed by definition order.
esrap
alexandria
.
common-lisp
.
*on-left-recursion*
(special variable).
add-rule
(function).
change-rule
(function).
defrule
(macro).
describe-grammar
(function).
describe-terminal
(function).
esrap-error
(condition).
esrap-error-position
(generic function).
esrap-error-text
(generic reader).
esrap-parse-error
(function).
esrap-parse-error
(condition).
esrap-parse-error-context
(generic function).
esrap-parse-error-result
(generic reader).
expression-start-terminals
(function).
find-rule
(function).
invalid-expression-error
(function).
invalid-expression-error
(condition).
invalid-expression-error-expression
(generic reader).
left-recursion
(function).
left-recursion
(condition).
left-recursion-nonterminal
(generic reader).
left-recursion-path
(generic reader).
parse
(compiler macro).
parse
(function).
remove-rule
(function).
rule
(class).
rule-dependencies
(function).
rule-expression
(function).
(setf rule-expression)
(function).
rule-symbol
(generic reader).
text
(function).
trace-rule
(function).
undefined-rule-error
(condition).
undefined-rule-symbol
(generic reader).
untrace-all-rules
(function).
untrace-rule
(function).
%expression-dependencies
(function).
%expression-direct-dependencies
(function).
%make-chunk-array
(function).
%make-successful-parse
(function).
%rule-direct-dependencies
(function).
*context*
(special variable).
*current-rule*
(special variable).
*eval-nonterminals*
(special variable).
*expression-kinds*
(special variable).
*indentation-hint-table*
(special variable).
*result-pprint-dispatch*
(special variable).
*rules*
(special variable).
*trace-level*
(special variable).
+chunk-divisor+
(constant).
+default-rule-properties+
(constant).
+packrat-hash-table-switch-point+
(constant).
alist-hash-table/no-dups
(macro).
analyze-ordered-choise
(function).
cache-policy
(type).
cached
(function).
(setf cached)
(function).
cell-%info
(reader).
(setf cell-%info)
(writer).
cell-function
(function).
cell-referents
(reader).
(setf cell-referents)
(writer).
cell-rule
(function).
cell-trace-info
(reader).
(setf cell-trace-info)
(writer).
character-range
(type).
check-expression
(function).
check-function-reference
(function).
check-lambda-list
(function).
check-ordered-choise-prefix
(function).
chunk
(type).
chunk-array
(type).
chunk-cache
(structure).
chunk-cache-chunks
(reader).
(setf chunk-cache-chunks)
(writer).
clear-rules
(function).
compile-character
(function).
compile-character-ranges
(function).
compile-expression
(function).
compile-followed-by
(function).
compile-greedy-positive-repetition
(function).
compile-greedy-repetition
(function).
compile-look-ahead
(function).
compile-look-behind
(function).
compile-negation
(function).
compile-nonterminal
(function).
compile-not-followed-by
(function).
compile-optional
(function).
compile-ordered-choise
(function).
compile-rule
(function).
compile-semantic-predicate
(function).
compile-sequence
(function).
compile-string
(function).
compile-terminal
(function).
compile-terminal-function
(function).
context
(structure).
context-cache
(reader).
context-heads
(reader).
context-nonterminal-stack
(reader).
(setf context-nonterminal-stack)
(writer).
context-p
(function).
copy-context
(function).
delete-rule-cell
(function).
dereference-rule-cell
(function).
detach-rule
(function).
ensure-chunk
(function).
ensure-rule-cell
(function).
error-report
(function).
error-report-behavior-suitable-for-report-part-p
(function).
error-report-part
(type).
error-result
(structure).
error-result-%position
(function).
(setf error-result-%position)
(function).
error-result-detail
(function).
error-result-expression
(function).
error-result-p
(function).
esrap-parse-error-%context
(generic reader).
(setf esrap-parse-error-%context)
(generic writer).
eval-character
(function).
eval-character-ranges
(function).
eval-expression
(function).
eval-followed-by
(function).
eval-greedy-positive-repetition
(function).
eval-greedy-repetition
(function).
eval-look-ahead
(function).
eval-look-behind
(function).
eval-negation
(function).
eval-nonterminal
(function).
eval-not-followed-by
(function).
eval-optional
(function).
eval-ordered-choise
(function).
eval-semantic-predicate
(function).
eval-sequence
(function).
eval-string
(function).
eval-terminal
(function).
eval-terminal-function
(function).
exec-character-ranges
(function).
exec-negation
(function).
exec-nonterminal
(function).
exec-string
(function).
exec-terminal-function
(function).
expand-transforms
(function).
expression-case
(macro).
expression-equal-p
(function).
expression-lambda
(macro).
expression-simple-p
(function).
expression<
(function).
failed-parse
(structure).
failed-parse-%position
(function).
(setf failed-parse-%position)
(function).
failed-parse-detail
(function).
failed-parse-expression
(function).
failed-parse-p
(function).
find-chunk
(function).
find-rule-cell
(function).
flattened-children
(function).
get-cached
(function).
(setf get-cached)
(function).
get-head
(function).
(setf get-head)
(function).
head
(structure).
head-eval-set
(reader).
(setf head-eval-set)
(writer).
head-involved-set
(reader).
(setf head-involved-set)
(writer).
head-rule
(reader).
(setf head-rule)
(writer).
hint-slime-indentation
(function).
hint-sly-indentation
(function).
inactive-rule
(structure).
inactive-rule-%position
(function).
(setf inactive-rule-%position)
(function).
inactive-rule-detail
(function).
inactive-rule-expression
(function).
inactive-rule-p
(function).
inactive-rule-rule
(function).
input-length
(type).
input-position
(type).
left-recursion-policy
(type).
left-recursion-result
(structure).
left-recursion-result-%position
(function).
(setf left-recursion-result-%position)
(function).
left-recursion-result-detail
(function).
left-recursion-result-expression
(function).
left-recursion-result-head
(reader).
(setf left-recursion-result-head)
(writer).
left-recursion-result-p
(function).
left-recursion-result-rule
(function).
list-of-result-productions
(function).
list-of-result-productions/butlast
(function).
make-cache
(function).
make-chunk
(function).
make-chunk-array
(function).
make-chunk-cache
(function).
make-context
(function).
make-failed-parse
(function).
make-failed-parse/no-position
(function).
make-head
(function).
make-heads
(function).
make-inactive-rule
(function).
make-left-recursion-result
(function).
make-ordered-choise-result
(function).
make-rule-cell
(function).
make-rule-properties
(function).
make-successful-parse
(macro).
map-max-leaf-results
(function).
map-max-results
(function).
map-results
(function).
match-terminal/1/case-insensitive-p
(function).
match-terminal/1/case-sensitive-p
(function).
match-terminal/case-insensitive-p
(function).
match-terminal/case-sensitive-p
(function).
max-of-result-positions
(function).
maybe-augment-inactive-rules
(function).
nonterminal
(type).
parse-defrule-options
(function).
parse-lambda-list-maybe-containing-&bounds
(function).
partition-results
(function).
predicate
(type).
predicate-name
(type).
print-result
(function).
print-terminal
(function).
process-parse-result
(function).
recall
(function).
reference-rule-cell
(function).
resolve-function
(function).
result
(structure).
result-%position
(reader).
(setf result-%position)
(writer).
result-context
(function).
result-detail
(reader).
result-expected-input
(function).
result-expression
(reader).
result-nonterminal-p
(function).
result-p
(function).
result-position
(function).
result-root-cause
(function).
result-suitable-for-report-part-p
(function).
result-trivial-predicate-p
(function).
result-unsatisfied-predicate-p
(function).
rule-around
(generic reader).
rule-cell
(structure).
rule-condition
(generic reader).
rule-direct-dependencies
(function).
rule-error-report
(generic reader).
rule-error-report
(type).
rule-error-report-pattern
(type).
rule-guard-expression
(generic reader).
rule-properties
(generic reader).
rule-properties/packed
(type).
rule-property-p
(function).
rule-suitable-for-report-part-p
(function).
rule-transform
(generic reader).
rule-trivial-p
(function).
set-cell-info
(function).
singleton-option
(function).
sort-dependencies
(function).
successful-parse
(structure).
successful-parse-%position
(function).
(setf successful-parse-%position)
(function).
successful-parse-%production
(reader).
(setf successful-parse-%production)
(writer).
successful-parse-detail
(function).
successful-parse-expression
(function).
successful-parse-p
(function).
successful-parse-production
(function).
terminal
(type).
undefined-rule
(function).
undefined-rule
(condition).
undefined-rule-function
(function).
with-cached-result
(macro).
with-expression
(macro).
with-pushed-nonterminal
(macro).
Definitions are sorted by export status, category, package, and then by lexicographic order.
This special variable controls Esrap’s behavior with respect to
allowing left recursion.
When :ERROR, PARSE signals a LEFT-RECURSION error when it encounters a
left recursive rule. Otherwise the rule is processed.
Note: when processing left recursive rules, linear-time guarantees generally no longer hold.
Define SYMBOL as a nonterminal, using EXPRESSION as associated the parsing expression.
Multiple OPTIONS specifying transforms are composed in the order of
appearance:
(:text t)
(:function parse-integer)
=>
(alexandria:compose #’parse-integer #’text)
Following OPTIONS can be specified:
* (:WHEN TEST)
The rule is active only when TEST evaluates to true. This can be used
to specify optional extensions to a grammar.
This option can only be supplied once.
* (:CONSTANT CONSTANT)
No matter what input is consumed or what EXPRESSION produces, the production
of the rule is always CONSTANT.
* (:FUNCTION FUNCTION)
If provided the production of the expression is transformed using
FUNCTION. FUNCTION can be a function name or a lambda-expression.
* (:IDENTITY BOOLEAN)
If true, the production of expression is used as-is, as if (:FUNCTION IDENTITY) has been specified. If no production option is specified, this is the default.
* (:TEXT BOOLEAN)
If true, the production of expression is flattened and concatenated into a string
as if by (:FUNCTION TEXT) has been specified.
* (:LAMBDA LAMBDA-LIST &BODY BODY)
If provided, same as using the corresponding lambda-expression with :FUNCTION.
As an extension of the standard lambda list syntax, LAMBDA-LIST accepts
the optional pseudo lambda-list keyword ESRAP:&BOUNDS, which (1) must appear
after all standard lambda list keywords. (2) can be followed by one or two
variables to which bounding indexes of the matching substring are bound.
Therefore:
LAMBDA-LIST ::= (STANDARD-LAMBDA-LIST-ELEMENTS [&BOUNDS START [END]])
* (:DESTRUCTURE DESTRUCTURING-LAMBDA-LIST &BODY BODY)
If provided, same as using a lambda-expression that destructures its argument
using DESTRUCTURING-BIND and the provided lambda-list with :FUNCTION.
DESTRUCTURING-LAMBDA-LIST can use ESRAP:&BOUNDS in the same way
as described for :LAMBDA.
* (:AROUND ([&BOUNDS START [END]]) &BODY BODY)
If provided, execute BODY around the construction of the production of the
rule. BODY has to call ESRAP:CALL-TRANSFORM to trigger the computation of
the production. Any transformation provided via :LAMBDA, :FUNCTION
or :DESTRUCTURE is executed inside the call to ESRAP:CALL-TRANSFORM. As a
result, modification to the dynamic state are visible within the
transform.
ESRAP:&BOUNDS can be used in the same way as described for :LAMBDA
and :DESTRUCTURE.
This option can be used to safely track nesting depth, manage symbol
tables or for other stack-like operations.
* (:USE-CACHE ( T | NIL | :UNLESS-TRIVIAL ))
Defaults to :UNLESS-TRIVIAL if not provided. Controls whether the
rule should be compiled with caching. :UNLESS-TRIVIAL
automatically disables caching if 1) it doesn’t change the
behavior of the rule (see below) 2) the expression of the rule is
simple enough to guarantee that disabling caching will improve
performance.
For rules with simple expressions, the overhead of cache lookup
and update can by far exceed the cost of simply evaluating the
rule expression. Disabling caching can improve performance in such
cases.
Note that disabling caching can change the behavior of the rule,
for example when the rule transform returns a fresh object.
* (:ERROR-REPORT ( T | NIL | :CONTEXT | :DETAIL ))
Defaults to T if not provided. Controls whether and how the rule
is used in parse error reports:
* T
The rule is used in parse error reports without
restriction (i.e. when describing the context of a failure as
well as listing failed rules and expected inputs).
* NIL
The rule is not used in parse error reports in any capacity. In
particular, inputs expected by the rule are not mentioned.
This value is useful for things like whitespace rules since
something like "expected space, tab or newline", even if it
would have allowed the parser to continue for one character, is
rarely helpful.
* :CONTEXT
The rule is used in the "context" part of parse error
reports. The rule is neither mentioned in the list of failed
rules nor are inputs expected by it.
* :DETAIL
The rule is not used in the "context" part of parse error
reports, but can appear in the list of failed rules. Inputs
expected by the rule are mentioned as well.
Associates RULE with the nonterminal SYMBOL. Signals an error if the rule is already associated with a nonterminal. If the symbol is already associated with a rule, the old rule is removed first.
Modifies the nonterminal SYMBOL to use EXPRESSION instead. Temporarily removes the rule while it is being modified.
Prints the grammar tree rooted at nonterminal SYMBOL to STREAM for human inspection.
Print a description of TERMINAL onto STREAM.
In additional to actual terminals, TERMINAL can be of the forms
(PREDICATE-NAME TERMINALS)
({not,!} TERMINALS)
({<,>} OFFSET TERMINALS)
(i.e. as produced by EXPRESSION-START-TERMINALS).
Return a list of terminals or tree of expressions with which a text
parsable by EXPRESSION can start.
A tree instead of a list is returned when EXPRESSION contains
semantic predicates, NOT or !. Elements in the returned list or
tree are
* case (in)sensitive characters, character ranges,
case (in)sensitive strings, function terminals
* semantic predicates represented as
(PREDICATE-NAME NESTED-ELEMENTS)
where NESTED-ELEMENTS is the list of start terminals of the
expression to which PREDICATE-NAME is applied.
* NOT and ! expressions are represented as
({not,!} NESTED-ELEMENTS)
where NESTED-ELEMENTS is the list of start terminals of the
negated expression.
* < and > expressions are represented as
({<,>} OFFSET NESTED-ELEMENTS)
where OFFSET is a positive integer and NESTED-ELEMENTS is the list of start terminals of the expression that should match OFFSET characters backward/forward from the current position.
The (outermost) list is sorted likes this:
1. string terminals
2. character terminals
3. the CHARACTER wildcard terminal
4. semantic predicates
5. everything else
If supplied, WHEN-RULE-ERROR-REPORT restricts processing of nonterminals to rules whose :ERROR-REPORT option is compatible with the value of WHEN-RULE-ERROR-REPORT.
Returns rule designated by SYMBOL, if any. Symbol must be a nonterminal symbol.
Parses TEXT using EXPRESSION from START to END.
Incomplete parses, that is not consuming the entirety of TEXT, are
allowed only if JUNK-ALLOWED is true.
Returns three values:
1) A production, if the parse succeeded, NIL otherwise.
2) The position up to which TEXT has been consumed or NIL if the
entirety of TEXT has been consumed.
3) If the parse succeeded, even if it did not consume any input, T is
returned as a third value.
The third return value is necessary to distinguish successful and
failed parses for cases like
(parse ’(! #\a) "a" :junk-allowed t)
(parse ’(! #\a) "b" :junk-allowed t)
in which the first two return values cannot indicate failures.
RAW controls whether the parse result is interpreted and translated
into the return values described above. If RAW is true, a parse result
of type RESULT or ERROR-RESULT is returned as a single value.
Note that the combination of arguments :junk-allowed t :raw t does not make sense since the JUNK-ALLOWED parameter is used when parse results are interpreted and translated into return values which does not happen when :raw t.
Makes the nonterminal SYMBOL undefined. If the nonterminal is defined an already referred to by other rules, an error is signalled unless :FORCE is true.
Returns the dependencies of the RULE: primary value is a list of defined nonterminal symbols, and secondary value is a list of undefined nonterminal symbols.
Return the parsing expression associated with the RULE.
Modify RULE to use EXPRESSION as the parsing expression. The rule must be detached beforehand.
Arguments must be strings, or lists whose leaves are strings. Catenates all the strings in arguments into a single string.
Turn on tracing of nonterminal SYMBOL.
If RECURSIVE is true, turn on tracing for the whole grammar rooted at SYMBOL. If RECURSIVE is a positive integer, turn on tracing for all rules reachable from the nonterminal SYMBOL in that number of steps.
If BREAK is true, break is entered when the rule is invoked.
If supplied, CONDITION has to be a function whose lambda-list is
compatible to (symbol text position end). This function is called to
determine whether trace actions should be executed for the traced
rule.
SYMBOL is the name of the rule being executed.
TEXT is the whole text being parsed.
POSITION is the position within TEXT at which the rule is executed.
END is the end position of the portion of TEXT being parsed.
Turn off tracing of all nonterminals.
Turn off tracing of nonterminal SYMBOL.
If RECURSIVE is true, turn off tracing for the whole grammar rooted at SYMBOL. If RECURSIVE is a positive integer, turn off tracing for all rules reachable from the nonterminal SYMBOL in that number of steps.
BREAK and CONDITION are ignored, and are provided only for symmetry with TRACE-RULE.
Return the input position at which the parse failure represented by CONDITION occurred.
left-recursion
)) ¶esrap-parse-error
)) ¶esrap-error
)) ¶text
.
Return the context result associated to the parse error represented by CONDITION.
esrap-parse-error
)) ¶Return the result associated to the parse error represented by CONDITION.
esrap-parse-error
)) ¶invalid-expression-error
)) ¶left-recursion
)) ¶left-recursion
)) ¶path
.
Returns the nonterminal associated with the RULE, or NIL if the rule is not attached to any nonterminal.
undefined-rule
)) ¶invalid-expression-error
) stream) ¶esrap-parse-error
) stream) ¶esrap-error
) stream) ¶left-recursion
) stream) ¶undefined-rule
) stream) ¶Signaled when an Esrap parse fails. Use ESRAP-ERROR-TEXT to obtain the string that was being parsed, and ESRAP-ERROR-POSITION the position at which the error occurred.
parse-error
.
(quote nil)
:text
This slot is read-only.
This error is signaled when a parse attempt fails because the input text does not conform to the grammar.
Signaled when an invalid expression is encountered.
error
.
Initarg | Value |
---|---|
:expression | (required-argument expression) |
:expression
This slot is read-only.
May be signaled when left recursion is detected during Esrap parsing.
LEFT-RECURSION-NONTERMINAL names the symbol for which left recursion
was detected, and LEFT-RECURSION-PATH lists nonterminals of which the
left recursion cycle consists.
Note: This error is only signaled if *ON-LEFT-RECURSION* is bound to :ERROR.
common-lisp
.
(quote nil)
:position
This slot is read-only.
(quote nil)
:nonterminal
This slot is read-only.
(quote nil)
:path
This slot is read-only.
Signaled when an undefined rule is encountered.
error
.
undefined-rule
.
This slot is read-only.
(alexandria:required-argument :expression)
:expression
t
:guard-expression
This slot is read-only.
t
:condition
This slot is read-only.
:transform
This slot is read-only.
:around
This slot is read-only.
esrap::rule-error-report
t
:error-report
This slot is read-only.
esrap::rule-properties/packed
esrap::+default-rule-properties+
:properties
This slot is read-only.
Names and corresponding types of acceptable expression constructors.
Similar to
(cl:typecase EXPRESSION CLAUSES)
but clause heads designate kinds of expressions instead of types. See *EXPRESSION-KINDS*.
Return true if QUERY is suitable for PART-OR-PARTS.
rule
.
head
.
Parse &BOUNDS section in LAMBDA-LIST and return three values:
1. The standard lambda list sublist of LAMBDA-LIST
2. A symbol that should be bound to the start of a matching substring
3. A symbol that should be bound to the end of a matching substring
4. A list containing symbols that were GENSYM’ed.
The second and/or third values are GENSYMS if LAMBDA-LIST contains a partial or no &BOUNDS section, in which case fourth value contains them for use with IGNORE.
esrap-parse-error
)) ¶esrap-parse-error
)) ¶condition
.
common-lisp
.
:symbol
This slot is read-only.
structure-object
.
esrap::chunk-array
(or null esrap::head)
structure-object
.
This slot is read-only.
(or function esrap::input-position)
(function esrap::max-of-result-positions)
(or structure-object list string condition)
This slot is read-only.
(or list function)
A character range is either a single character or a list of two characters.
Named part of a parse error report.
Any symbol except CHARACTER and NIL can be used as a nonterminal symbol.
Suitability of a rule for error report parts.
In addition to the ERROR-REPORT-PART values, NIL indicates unsuitability for all error report parts, while T indicates suitability for all parts.
ERROR-REPORT-PART or a list thereof.
Literal strings and characters are used as case-sensitive terminal symbols, and expressions of the form (~ <literal>) denote case-insensitive terminals.
Jump to: | %
(
A C D E F G H I L M P R S T U W |
---|
Jump to: | %
(
A C D E F G H I L M P R S T U W |
---|
Jump to: | %
*
+
C D E H I N P R S T |
---|
Jump to: | %
*
+
C D E H I N P R S T |
---|
Jump to: | C E F H I L M N P R S T U V |
---|
Jump to: | C E F H I L M N P R S T U V |
---|