Next: Zero-width assertion methods, Previous: Untested methods, Up: Untested methods [Contents][Index]
These methods, respectively, set and query the default rank of the grammar. When a grammar is created, the default rank is 0. When rules and symbols are created, their rank is the default rank of the grammar.
Changing the grammar’s default rank does not affect those rules and symbols already created, only those that will be created. This means that the grammar’s default rank can be used to, in effect, assign ranks to groups of rules and symbols. Applications may find this behavior useful.
Return value: On success, returns
the rank after
the call,
and sets the error code to
MARPA_ERR_NONE
.
On failure, returns -2,
and sets the error code to an appropriate
value, which will never be
MARPA_ERR_NONE
.
Note that when the rank is -2,
the error code is the only way to distinguish
success from failure.
The error code can be determined by using the
marpa_g_error()
call.
These methods, respectively, set and query the rank of a symbol sym_id. When sym_id is created, its rank initialized to the default rank of the grammar.
Return value: On success, returns
the rank after
the call,
and sets the error code to
MARPA_ERR_NONE
.
On failure, returns -2,
and sets the error code to an appropriate
value, which will never be
MARPA_ERR_NONE
.
Note that when the rank is -2,
the error code is the only way to distinguish
success from failure.
The error code can be determined by using the
marpa_g_error()
call.
Next: Zero-width assertion methods, Previous: Untested methods, Up: Untested methods [Contents][Index]