Previous: , Up: Parse location   [Contents][Index]


7.1.6 The furthest earleme

Loosely speaking, the furthest earleme is the furthest earleme reached by the parse. More precisely, it is the highest numbered earleme at which a token ends and is 0 if there are no tokens. The furthest earleme is 0 when a recognizer is created. With every call to marpa_r_alternative(), the end of the token it adds is calculated. A token ends at the earleme location current+length, where current is the current earleme, and length is the length of the newly added token. If old_f is the furthest earleme before a call to marpa_r_alternative(), the furthest earleme after the call is max(old_f, current+length).

The furthest earleme is set implicitly by the marpa_r_new() (see marpa_r_new) and the marpa_r_alternative() (see marpa_r_alternative) methods. Applications can access the value of the furthest earleme via the marpa_r_furthest_earleme() method (see marpa_r_furthest_earleme).

In the basic input models, where every token has length 1, calling marpa_r_earleme_complete() after each marpa_r_alternative() call is sufficient to process all inputs, and the furthest earleme’s value can be ignored. In alternative input models, where tokens have lengths greater than 1, calling marpa_r_earleme_complete() once after the last token is read may not be enough to ensure that all tokens have been processed. To ensure that all tokens have been processed, an application must advance the current earleme by calling marpa_r_earleme_complete(), until the current earleme is equal to the furthest earleme.