Next: Symbol nulled events, Previous: Basic event accessors, Up: Events [Contents][Index]
Allows the user to deactivate and reactivate symbol completion events in the grammar. When a recognizer is created, the activation status of each of its events is initialized to the activation status of that event in the base grammar. If reactivate is zero, the event is deactivated in the grammar. If reactivate is one, the event is activated in the grammar.
Symbol completion events are active by default if the symbol was set up for completion events in the grammar. If a symbol was not set up for completion events in the grammar, symbol completion events are inactive by default and any attempt to change that is a fatal error.
The activation status of a completion event in the grammar can only be changed if the symbol is marked as a completion event symbol in the grammar, and before the grammar is precomputed. However, if a symbol is marked as a completion event symbol in the recognizer, the completion event can be deactivated and reactivated in the recognizer.
Success cases: On success, the method returns the value of reactivate. The method succeeds trivially if the symbol is already set as indicated by reactivate.
Failure cases: If the active status of the completion event for sym_id cannot be set as indicated by reactivate, the method fails. On failure, -2 is returned.
Allows the user to deactivate and reactivate symbol completion events in the recognizer. If reactivate is zero, the event is deactivated. If reactivate is one, the event is activated.
Symbol completion events are active by default if the symbol was set up for completion events in the grammar. If a symbol was not set up for completion events in the grammar, symbol completion events are inactive by default and any attempt to change that is a fatal error.
Success cases: On success, the method returns the value of reactivate. The method succeeds trivially if the symbol is already set as indicated by reactivate.
Failure cases: If the active status of the completion event for sym_id cannot be set as indicated by reactivate, the method fails. On failure, -2 is returned.
Libmarpa can be set up to generate an
MARPA_EVENT_SYMBOL_COMPLETED
event whenever the symbol is completed.
A symbol is said to be completed
when a non-nulling rule with
that symbol on its LHS is completed.
For completion events to occur, the symbol must be marked
as a completion event symbol.
The
marpa_g_symbol_is_completion_event_set()
function
marks symbol sym_id as a completion event symbol
if value is 1,
and unmarks it
it as a completion event symbol if value is 0.
The
marpa_g_symbol_is_completion_event()
method
returns the current value of the completion event marking
for symbol sym_id.
Marking a completion event sets its activation status to on. Unmarking a completion event sets its activation status to off. The completion event marking cannot be changed once the grammar is precomputed.
If a completion event is marked,
its activation status can be changed using the
marpa_g_completion_symbol_activate()
method.
Note that, if a symbol is marked as a completion event symbol
in the recognizer,
its completion event can be deactivated
and reactivated in the recognizer.
Nulled rules and symbols will never cause completion events. Nullable symbols may be marked as completion event symbols, but this will have an effect only when the symbol is not nulled. Nulling symbols may be marked as completion event symbols, but no completion events will ever be generated for a nulling symbol. Note that this implies at no completion event will ever be generated at earleme 0, the start of parsing.
Success: On success, 1 if symbol sym_id is a completion event symbol after the call, 0 otherwise.
Failures: If sym_id is well-formed, but there is no such symbol, -1. If the grammar g is precomputed; or on other failure, -2.
Next: Symbol nulled events, Previous: Basic event accessors, Up: Events [Contents][Index]