Previous: Location accessors, Up: Recognizer methods [Contents][Index]
Details about the “earley item warning threshold” are
in the description of the
marpa_r_earley_item_warning_threshold_set()
method.
See marpa_r_earley_item_warning_threshold_set().
Return value: The Earley item warning threshold. Always succeeds.
On success, sets
the Earley item warning threshold.
The
Earley item warning threshold
is a number that is compared with
the count of Earley items in each Earley set.
When it is matched or exceeded,
a MARPA_EVENT_EARLEY_ITEM_THRESHOLD
event is created.
See MARPA_EVENT_EARLEY_ITEM_THRESHOLD.
If threshold is zero or less, an unlimited number of Earley items will be allowed without warning. This will rarely be what the user wants.
By default, Libmarpa calculates a value based on the grammar. The formula Libmarpa uses is the result of some experience, and most applications will be happy with it.
What should be done when the threshold is exceeded, depends on the application,
but exceeding the threshold means that it is very likely
that the time and space resources consumed by
the parse will prove excessive.
This is often a sign of a bug in the grammar.
Applications often will want to smoothly shut down
the parse,
in effect treating
the MARPA_EVENT_EARLEY_ITEM_THRESHOLD
event
as equivalent to library-recoverable hard failure.
Return value: The value that the Earley item warning threshold has after the method call is finished. Always succeeds.
A parser is “exhausted” if it cannot accept any more input. See Exhaustion.
Return value: 1 if the parser is exhausted, 0 otherwise. Always succeeds.
Returns a list of the ID’s of the symbols
that are acceptable as tokens
at the current earleme.
buffer is expected to be large enough to hold
the result.
This is guaranteed to be the case if the buffer
is large enough to hold an array of
Marpa_Symbol_ID
’s whose length
is greater than or equal to the number of symbols
in the grammar.
Return value: On success, the number of Marpa_Symbol_ID
’s
in buffer, which is always non-negative.
On hard failure, -2.
On success, does the folloing:
Hard fails if the symbol with ID symbol_id does not exist.
Return value: On success, 0 or 1. On hard failure, -2.
Previous: Location accessors, Up: Recognizer methods [Contents][Index]