Next: Other parse status methods, Previous: Recognizer life cycle mutators, Up: Recognizer methods [Contents]

- Function:
`Marpa_Earleme`

**marpa_r_current_earleme***(Marpa_Recognizer*`r`) Return value: If input has started, the current earleme. If input has not started, -1. Always succeeds.

- Function:
*Marpa_Earleme***marpa_r_earleme***( Marpa_Recognizer*`r`, Marpa_Earley_Set_ID`set_id`) -
In the default, token-stream model, Earley set ID and earleme are always equal, but this is not the case in other input models. (The ID of an Earley set ID is also called its ordinal.) If there is no Earley set whose ID is

`set_id`,`marpa_r_earleme()`

fails. If`set_id`was negative, the error code is set to`MARPA_ERR_INVALID_LOCATION`

. If`set_id`is greater than the ordinal of the latest Earley set, the error code is set to`MARPA_ERR_NO_EARLEY_SET_AT_LOCATION`

.At this writing, there is no method for the inverse operation (conversion of an earleme to an Earley set ID). One consideration in writing such a method is that not all earlemes correspond to Earley sets. Applications that want to map earlemes to Earley sets will have no trouble if they are using the standard input model — the Earley set ID is always exactly equal to the earleme in that model. For other applications that want an earleme-to-ID mapping, the most general method is create an ID-to-earleme array using the

`marpa_r_earleme()`

method and invert it.Return value: On success, the earleme corresponding to Earley set

`set_id`. On failure, -2.

- Function:
*int***marpa_r_earley_set_value***( Marpa_Recognizer*`r`, Marpa_Earley_Set_ID earley_set) Returns the integer value of

`earley_set`. For more details, see the description of`marpa_r_earley_set_values()`

.Return value: On success, the value of

`earley_set`. On failure, -2.

- Function:
*int***marpa_r_earley_set_values***( Marpa_Recognizer*`r`, Marpa_Earley_Set_ID earley_set, int* p_value, void** p_pvalue ) If

`p_value`is non-zero, sets the location pointed to by`p_value`to the integer value of the Earley set. Similarly, if`p_pvalue`is non-zero, sets the location pointed to by`p_pvalue`to the pointer value of the Earley set.The “value” and “pointer” of an Earley set are an arbitrary integer and an arbitrary pointer that the application can use for its own purposes. In character-per-earleme input models, for example, the integer can be the codepoint of the current character. In a traditional token-per-earleme input model, they could be used to indicate the string value of the token – the pointer could point to the start of the string, and the integer could indicate its length.

The Earley set value and pointer can be set using the

`marpa_r_latest_earley_set_values_set()`

method. The Earley set integer value defaults to -1, and the pointer value defaults to`NULL`

.Return value: On success, returns a non-negative integer. On failure, returns -2.

- Function:
`unsigned int`

**marpa_r_furthest_earleme***(Marpa_Recognizer*`r`) Return value: On success, the furthest earleme. Always succeeds.

- Function:
*Marpa_Earley_Set_ID***marpa_r_latest_earley_set***(Marpa_Recognizer*`r`) This method returns the Earley set ID (ordinal) of the latest Earley set. Applications that want the value of the latest earleme can convert this value using the

`marpa_r_earleme()`

method.Return value: On success, the ID of the latest Earley set. Always succeeds.

- Function:
*int***marpa_r_latest_earley_set_value_set***( Marpa_Recognizer*`r`, int value) Sets the integer value of the latest Earley set. For more details, see the description of

`marpa_r_latest_earley_set_values_set()`

.Return value: On success, the new value of

`earley_set`. On failure, -2.

- Function:
*int***marpa_r_latest_earley_set_values_set***( Marpa_Recognizer*`r`, int value, void* pvalue) Sets the integer and pointer value of the latest Earley set. For more about the “integer value” and “pointer value” of an Earley set, see the description of the

`marpa_r_earley_set_values()`

method.Return value: On success, returns a non-negative integer. On failure, returns -2.