Next: , Previous: , Up: Events   [Contents][Index]


25.6 Prediction events

This section contains methods for dealing with MARPA_EVENT_SYMBOL_PREDICTED events. See MARPA_EVENT_SYMBOL_PREDICTED.

To declare a symbol as a prediction event symbol use the marpa_g_symbol_is_prediction_event_set() method. The event will be activated by default.

To activate or deactivate a prediction symbol event use the marpa_r_prediction_symbol_activate() method.

Mutator function: int marpa_g_prediction_symbol_activate ( Marpa_Grammar g, Marpa_Symbol_ID sym_id, int reactivate )

Allows the user to deactivate and reactivate symbol prediction events in the grammar. On success, does the following:

The activation status of a prediction event in the grammar becomes the initial activation status of a prediction event in all of its child recognizers.

This method is seldom needed. When a symbol is declared as a prediction event symbol in the grammar, it is activated by default. See marpa_g_symbol_is_prediction_event_set(). And a prediction event can be deactivated and reactivated in the recognizer using the marpa_r_prediction_symbol_activate method. See marpa_r_prediction_symbol_activate().

Hard fails if the sym_id is not declared as a prediction event symbol in the grammar, or if the grammar has not been precomputed.

Return value: On success, the value of reactivate, which is a boolean. On hard failure, -2.

Mutator function: int marpa_r_prediction_symbol_activate ( Marpa_Recognizer r, Marpa_Symbol_ID sym_id, int boolean )

Allows the user to deactivate and reactivate symbol prediction events in the recognizer. On success, does the following:

Hard fails if sym_id was not declared for prediction events in the base grammar.

Return value: On success, the value of reactivate, which is a boolean. On hard failure, -2.

Accessor function: int marpa_g_symbol_is_prediction_event ( Marpa_Grammar g, Marpa_Symbol_ID sym_id)

On success, returns a boolean which is 1 iff sym_id is declared as a prediction event symbol. For more about prediction events, see marpa_g_symbol_is_prediction_event_set.

Soft fails iff sym_id is well-formed (a non-negative integer), but there is no such symbol.

Hard fails if g is precomputed.

Return value: On success, a boolean . On soft failure, -1. On hard failure, -2.

Mutator function: int marpa_g_symbol_is_prediction_event_set ( Marpa_Grammar g, Marpa_Symbol_ID sym_id, int value)

On success, if value is 1,

On success, if value is 0,

Soft fails iff sym_id is well-formed (a non-negative integer), but there is no such symbol.

Hards fails if the grammar is precomputed.

Return value: On success, value, which is a boolean. On soft failure, -1. On hard failure, -2.


Next: , Previous: , Up: Events   [Contents][Index]