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


23.1 Overview

This chapter discusses Libmarpa’s events. It contains descriptions of both grammar and recognizer methods.

A method is event-generating iff it can add events to the event queue. The event-generating methods are marpa_g_precompute(), marpa_r_earleme_complete(), and marpa_r_start_input(). The event-generating methods always clear all previous events so that, on return from an event-generating method, the only events in the event queue will be the events generated by that method.

A Libmarpa method or macro is event-safe iff it does not change the events queue. All Libmarpa accessors are event-safe.

Regardless of the event-safety of the methods calls between event generation and event access, it is good practice to access events as soon as reasonable after the method that generated them. Note that events are kept in the base grammar, so that multiple recognizers using the same base grammar overwrite each other’s events.

To find out how many events are in the event queue, use the marpa_g_event_count() method.

To access specific events, use the marpa_g_event() and marpa_g_event_value() methods.