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


25.3 Basic event accessors

Accessor function: Marpa_Event_Type marpa_g_event (Marpa_Grammar g, Marpa_Event* event, int ix)

On success,

Event indexes are in sequence. Valid events will be in the range from 0 to n, where n is one less than the event count. The event count can be read using the marpa_g_event_count() method.

Hard fails if there is no ix’th event, or if ix is negative. On failure, the locations pointed to by event are not changed.

Return value: On success, the type of event ix, which is always non-negative. On hard failure, -2.

Accessor function: int marpa_g_event_count ( Marpa_Grammar g )

Return value: On success, the number of events, which is always non-negative. On hard failure, -2.

Accessor macro: int marpa_g_event_value (Marpa_Event* event)

Returns the “value” of the event. The semantics of the value varies according to the type of the event, and is described in the section on event codes. See Event codes.

Return value: The “value” of the event. Always succeeds.