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


25.2 Event codes

Accessor macro: int MARPA_EVENT_NONE

This is an implicit global event. This event code is reserved. No method triggers an event with this code.

Event value: Unspecified. Suggested message: "No event".

Accessor macro: int MARPA_EVENT_COUNTED_NULLABLE

This is an implicit per-symbol event. This event is triggered by the marpa_g_precompute() method (see marpa_g_precompute()), when a nullable symbol was used as either the separator for, or the right hand side of, a sequence.

Event value: The ID of the symbol. Suggested message: "This symbol is a counted nullable".

Accessor macro: int MARPA_EVENT_EARLEY_ITEM_THRESHOLD

This is an implicit global event. This event is triggered by the marpa_r_earleme_complete() method (see marpa_r_earleme_complete()), when an application-settable threshold on the number of Earley items has been reached or exceeded. See marpa_r_earley_item_warning_threshold_set().

Event value: The current Earley item count. Suggested message: "Too many Earley items".

Accessor macro: int MARPA_EVENT_EXHAUSTED

This is an implicit global event. This event is triggered by the marpa_r_earleme_complete() (see marpa_r_earleme_complete) and marpa_r_start_input() (see marpa_r_start_input) methods, when the parse is exhausted. See Exhaustion.

Event value: Unspecified. Suggested message: "Recognizer is exhausted".

Accessor macro: int MARPA_EVENT_LOOP_RULES

This is an implicit global event. This event is triggered by the marpa_g_precompute() method, when one or more rules are loop rules. (See marpa_g_precompute().

A rule is a loop rule iff it is part of a cycle. See Cycles. Parsing with a grammar than contains a loop rule is deprecated.

Event value: The count of loop rules. Suggested message: "Grammar contains a infinite loop".

Accessor macro: int MARPA_EVENT_NULLING_TERMINAL

This is an implicit per-symbol event. This event is triggered by the marpa_g_precompute() method. See marpa_g_precompute(). It only occurs if the LHS terminals feature is in use. The LHS terminals feature is deprecated. See LHS terminals.

Event value: The ID of the symbol. Suggested message: "This symbol is a nulling terminal".

Accessor macro: int MARPA_EVENT_SYMBOL_COMPLETED

This is an explicit per-symbol event. Intuitively, it triggers when a non-nulled non-terminal symbol is fully recognized.

More precisely, when an Earley set is completed at earleme j, the MARPA_EVENT_SYMBOL_COMPLETED event instance for symbol sym triggers iff

The MARPA_EVENT_SYMBOL_COMPLETED is triggered by the marpa_r_earleme_complete() method. See marpa_r_earleme_complete().

We recall that a symbol instance is a symbol, together with start and end parse locations. More than one symbol instance may trigger the same MARPA_EVENT_SYMBOL_COMPLETED event instance. For example, if x@40-42 and x@38-42 are symbol instances, they will trigger only one event instance — the MARPA_EVENT_SYMBOL_COMPLETED event instance at location 42 with symbol x.

To declare a completed symbol event, use the marpa_g_symbol_is_completion_event_set() method. See marpa_g_symbol_is_completion_event_set. To activate or deactivate a completed symbol event, use the marpa_g_completion_symbol_activate method (see marpa_g_completion_symbol_activate), or the marpa_r_completion_symbol_activate method (see marpa_r_completion_symbol_activate).

Event value: The ID of the completed symbol. Suggested message: "Completed symbol".

Accessor macro: int MARPA_EVENT_SYMBOL_EXPECTED

This is an explicit per-symbol event. Intuitively, it triggers when a terminal symbol is expected.

More precisely, when an Earley set is completed at earleme j, the MARPA_EVENT_SYMBOL_EXPECTED event instance for symbol sym triggers iff

This event is triggered by the marpa_r_earleme_complete() (see marpa_r_earleme_complete) and marpa_r_start_input() (see marpa_r_start_input) methods.

More than one symbol instance may trigger the same MARPA_EVENT_SYMBOL_EXPECTED event instance. For example, if

    [ [ X ::= B • x ], 0, 42 ] and
    [ [ Y ::= C • x ], 7, 42 ]

are Earley items, they will trigger only one event instance — the MARPA_EVENT_SYMBOL_EXPECTED event instance at location 42 with symbol x.

MARPA_EVENT_SYMBOL_EXPECTED events only trigger if their symbol is expected as a terminal. Predicted symbols that are not expected as terminals do not trigger this event.

To declare an expected terminal event, use the marpa_r_expected_symbol_event_set() method. The marpa_r_expected_symbol_event_set() method is also used to activate or deactivate an expected terminal event. See marpa_r_expected_symbol_event_set.

Event value: The ID of the expected symbol. Suggested message: "Expecting symbol".

Accessor macro: int MARPA_EVENT_SYMBOL_NULLED

This is an explicit per-symbol event. Intuitively, this event triggers when a nulled instance of a symbol is recognized.

More precisely, when an Earley set is completed at earleme j, the MARPA_EVENT_SYMBOL_NULLED event instance for symbol sym triggers iff

This event is triggered by the marpa_r_earleme_complete() (see marpa_r_earleme_complete) and marpa_r_start_input() (see marpa_r_start_input) methods.

Duplicate nulled nodes may occur. See Duplicate nulled nodes. Even if there are duplicate nulled nodes for symbol sym at location j, only one MARPA_EVENT_SYMBOL_NULLED event instance for sym will be triggered at location j.

To declare an nulled symbol event, use the recognizer’s marpa_g_symbol_is_nulled_event_set() method. See marpa_g_symbol_is_nulled_event_set. To activate or deactivate a nulled symbol event, use the marpa_g_nulled_symbol_activate method (see marpa_g_nulled_symbol_activate), or the marpa_r_nulled_symbol_activate method (see marpa_r_nulled_symbol_activate).

Event value: The ID of the nulled symbol. Suggested message: "Symbol was nulled".

Accessor macro: int MARPA_EVENT_SYMBOL_PREDICTED

This is an explicit per-symbol event. Intuitively, this event triggers when a symbol is predicted. Unlike the MARPA_EVENT_SYMBOL_EXPECTED event, the MARPA_EVENT_SYMBOL_PREDICTED event triggers for predictions of both non-terminals and terminals.

More precisely, when an Earley set is completed at earleme j, the MARPA_EVENT_SYMBOL_PREDICTED event instance for symbol sym triggers iff

This event is triggered by the marpa_r_earleme_complete() (see marpa_r_earleme_complete) and marpa_r_start_input() (see marpa_r_start_input) methods.

In an Earley set, multiple Earley items may have the same postdot symbol, but they will trigger only one event instance. For example, if

    [ [ X ::= B • X ], 0, 42 ] and
    [ [ Y ::= C • X ], 7, 42 ]

are Earley items, they will trigger only one event instance — the MARPA_EVENT_SYMBOL_PREDICTED event instance at location 42 with symbol X.

To declare a predicted symbol event, use the recognizer’s marpa_g_symbol_is_prediction_event_set() method. See marpa_g_symbol_is_prediction_event_set. To activate or deactivate a predicted symbol event, use the marpa_g_prediction_symbol_activate method (see marpa_g_prediction_symbol_activate), or the marpa_r_prediction_symbol_activate method (see marpa_r_prediction_symbol_activate).

Event value: The ID of the predicted symbol. Suggested message: "Symbol was predicted".


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