### ----------------------------------------------------
### -- Marpa
### -- Licenses: Artistic-2.0
### -- Authors: 
### -- File: lib/Marpa.rakumod
### ----------------------------------------------------
### -- Chunk 3 of 4
[Pointer[void]] $p_pvalue )
         returns Int
         is native( LIB ) { * }
  method r-earley-set-values
         ( Marpa-Recognizer $r, Marpa-Earley-Set-ID $earley-set, Pointer[Int] $p-value, Pointer[Pointer[void]] $p-pvalue )
         returns Int {
           marpa_r_earley_set_values( $r, $earley-set, $p-value, $p-pvalue ) }

  #|{ Success value: The furthest earleme.
      Failure value: Always succeeds.
    }
  my sub marpa_r_furthest_earleme
         ( Marpa-Recognizer $r )
         returns UInt
         is native( LIB ) { * }
  method r-furthest-earleme
         ( Marpa-Recognizer $r )
         returns UInt {
           marpa_r_furthest_earleme( $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.

      Success value: the ID of the latest Earley set.
      Failure value: Always succeeds.
    }
  my sub marpa_r_latest_earley_set
         ( Marpa-Recognizer $r )
         returns Marpa-Earley-Set-ID
         is native( LIB ) { * }
  method r-latest-earley-set
         ( Marpa-Recognizer $r )
         returns Marpa-Earley-Set-ID {
           marpa_r_latest_earley_set( $r ) }

  #|{ Sets the integer value of the latest Earley set. For more details, see the description of marpa_r_latest_earley_set_values_set().

      Success value: The new value of earley_set.
      Failure value: −2. 
    }
  my sub marpa_r_latest_earley_set_value_set
         ( Marpa-Recognizer $r, Int $value )
         returns Int
         is native( LIB ) { * }
  method r-latest-earley-set-value-set
         ( Marpa-Recognizer $r, Int $value )
         returns Int {
           marpa_r_latest_earley_set_value_set( $r, $value ) }

  #|{ 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.

      Success value: Returns a non-negative integer.
      Failure value: −2. 
    }
  my sub marpa_r_latest_earley_set_values_set
         ( Marpa-Recognizer $r, Int $value, Pointer[void] $pvalue )
         returns Int
         is native( LIB ) { * }
  method r-latest-earley-set-values-set
         ( Marpa-Recognizer $r, Int $value, Pointer[void] $pvalue )
         returns Int {
           marpa_r_latest_earley_set_values_set( $r, $value, $pvalue ) }

  #|{ Allows the user to deactivate and reactivate symbol completion events in the recognizer. If reactivate is zero, the event is deactivated. If reactivate is one, the event is activated.

      Symbol completion events are active by default if the symbol was set up for completion events in the grammar. If a symbol was not set up for completion events in the grammar, symbol completion events are inactive by default and any attempt to change that is a fatal error.

      Success value: The method returns the value of reactivate. The method succeeds trivially if the symbol is already set as indicated by reactivate.
      Failure value: If the active status of the completion event for sym_id cannot be set as indicated by reactivate, the method fails. On failure, −2 is returned. 
    }
  my sub marpa_r_completion_symbol_activate
         ( Marpa-Recognizer $r, Marpa-Symbol-ID $sym_id, Int $reactivate )
         returns Int
         is native( LIB ) { * }
  method r-completion-symbol-activate
         ( Marpa-Recognizer $r, Marpa-Symbol-ID $sym-id, Int $reactivate )
         returns Int {
           marpa_r_completion_symbol_activate( $r, $sym-id, $reactivate ) }

  #|{ These methods, respectively, set and query the Earley item warning threshold. The Earley item warning threshold is a number that is compared with the count of Earley items in each Earley set. When it is matched or exceeded, a MARPA-EVENT-EARLEY-ITEM-THRESHOLD event is created.

      If threshold is zero or less, an unlimited number of Earley items will be allowed without warning. This will rarely be what the user wants.

      By default, Libmarpa calculates a value based on the grammar. The formula Libmarpa uses is the result of some experience, and most applications will be happy with it.

      Success value: The value that the Earley item warning threshold has after the method call is finished.
      Failure value: Always succeeds.
    }
  my sub marpa_r_earley_item_warning_threshold_set
         ( Marpa-Recognizer $r, Int $threshold )
         returns Int
         is native( LIB ) { * }
  method r-earley-item-warning-threshold-set
         ( Marpa-Recognizer $r, Int $threshold )
         returns Int {
           marpa_r_earley_item_warning_threshold_set( $r, $threshold ) }
  my sub marpa_r_earley_item_warning_threshold
         ( Marpa-Recognizer $r )
         returns Int
         is native( LIB ) { * }
  method r-earley-item-warning-threshold
         ( Marpa-Recognizer $r )
         returns Int {
           marpa_r_earley_item_warning_threshold( $r ) }

  #|{ Sets the “expected symbol event bit” for symbol_id to value. A recognizer event is created whenever symbol symbol_id is expected at the current earleme. if and only if the expected symbol event bit for symbol_id is 1. The “expected symbol event bit” must be 1 or 0.

      In this context, “expected” means “expected as a terminal”. Even if a symbol is predicted at the current earleme, if it is not acceptable as a terminal, it does not trigger an “expected symbol event”.

      By default, the “expected symbol event bit” is 0. It is an error to attempt to set the “expected symbol event bit” to 1 for a nulling symbol, an inaccessible symbol, or an unproductive symbol.

      Success value: The value of the event bit after the method call is finished.
      Failure value: -2 if symbol_id is not the ID of a valid symbol; if it is the ID of an nulling, inaccessible for unproductive symbol; or on other failure. 
    }
  my sub marpa_r_expected_symbol_event_set
         ( Marpa-Recognizer $r, Marpa-Symbol-ID $symbol_id, Int $value )
         returns Int
         is native( LIB ) { * }
  method r-expected-symbol-event-set
         ( Marpa-Recognizer $r, Marpa-Symbol-ID $symbol-id, Int $value )
         returns Int {
           marpa_r_expected_symbol_event_set( $r, $symbol-id, $value ) }

  #|{ A parser is “exhausted” if it cannot accept any more input. Both successful and failed parses can be exhausted. In many grammars, the parse is always exhausted as soon as it succeeds. Good parses may also exist at earlemes prior to the current one.

      Success value: 1 if the parser is exhausted, 0 otherwise.
      Failure value: Always succeeds.
    }
  my sub marpa_r_is_exhausted
         ( Marpa-Recognizer $r )
         returns Int
         is native( LIB ) { * }
  method r-is-exhausted
         ( Marpa-Recognizer $r )
         returns Int {
           marpa_r_is_exhausted( $r ) }

  #|{ Allows the user to deactivate and reactivate symbol nulled events in the recognizer. If boolean is zero, the event is deactivated. If boolean is one, the event is activated.

      Symbol nulled events are active by default if the symbol was set up for nulled events in the grammar. If a symbol was not set up for nulled events in the grammar, symbol nulled events are inactive by default and any attempt to change that is a fatal error.

      Success cases: On success, the method returns the value of boolean. The method succeeds trivially if the symbol is already set as indicated by boolean.

      Failure cases: If the active status of the nulled event for sym_id cannot be set as indicated by boolean, the method fails. On failure, −2 is returned. 
    }
  my sub marpa_r_nulled_symbol_activate
         ( Marpa-Recognizer $r, Marpa-Symbol-ID $sym_id, Int $boolean )
         returns Int
         is native( LIB ) { * }
  method r-nulled-symbol-activate
         ( Marpa-Recognizer $r, Marpa-Symbol-ID $sym-id, Int $boolean )
         returns Int {
           marpa_r_nulled_symbol_activate( $r, $sym-id, $boolean ) }

  #|{ Allows the user to deactivate and reactivate symbol prediction events in the recognizer. If boolean is zero, the event is deactivated. If boolean is one, the event is activated.

      Symbol prediction events are active by default if the symbol was set up for prediction events in the grammar. If a symbol was not set up for prediction events in the grammar, symbol prediction events are inactive by default and any attempt to change that is a fatal error.

      Success value: The method returns the value of boolean. The method succeeds trivially if the symbol is already set as indicated by boolean.

      Failure value: If the active status of the prediction event for sym_id cannot be set as indicated by boolean, the method fails. On failure, −2 is returned. 
    }
  my sub marpa_r_prediction_symbol_activate
         ( Marpa-Recognizer $r, Marpa-Symbol-ID $sym_id, Int $boolean )
         returns Int
         is native( LIB ) { * }
  method r-prediction-symbol-activate
         ( Marpa-Recognizer $r, Marpa-Symbol-ID $sym-id, Int $boolean )
         returns Int {
           marpa_r_prediction_symbol_activate( $r, $sym-id, $boolean ) }

  #|{ Returns a list of the ID's of the symbols that are acceptable as tokens at the current earleme. buffer is expected to be large enough to hold the result. This is guaranteed to be the case if the buffer is large enough to hold a number of Marpa-Symbol-ID's that is greater than or equal to the number of symbols in the grammar.

      Success value: The number of Marpa-Symbol-ID's in buffer.
      Failure value: −2. 
    }
  my sub marpa_r_terminals_expected
         ( Marpa-Recognizer $r, Pointer[Marpa-Symbol-ID] $buffer )
         returns Int
         is native( LIB ) { * }
  method r-terminals-expected
         ( Marpa-Recognizer $r, Pointer[Marpa-Symbol-ID] $buffer )
         returns Int {
           marpa_r_terminals_expected( $r, $buffer ) }

  #|{ Success value: If symbol_id is the ID of a valid terminal symbol that is expected at the current earleme, a number greater than zero. If symbol_id is the ID of a valid terminal symbol that is not expected at the current earleme, or if symbol_id is the ID of a valid symbol that is not a terminal, zero.

      Failure value: −2. It is a failure if symbol_id is not the ID of a valid symbol. 
    }
  my sub marpa_r_terminal_is_expected
         ( Marpa-Recognizer $r, Marpa-Symbol-ID $symbol_id )
         returns Int
         is native( LIB ) { * }
  method r-terminal-is-expected
         ( Marpa-Recognizer $r, Marpa-Symbol-ID $symbol-id )
         returns Int {
           marpa_r_terminal_is_expected( $r, $symbol-id ) }

  #|{ Resets the progress report. Assumes a report of the progress has already been initialized at some Earley set for recognizer r, with marpa_r_progress_report_start(). The reset progress report will be positioned before its first item.

      Success value: A non-negative value.
      Failure value: −2. 
    }
  my sub marpa_r_progress_report_reset
         ( Marpa-Recognizer $r )
         returns Int
         is native( LIB ) { * }
  method r-progress-report-reset
         ( Marpa-Recognizer $r )
         returns Int {
           marpa_r_progress_report_reset( $r ) }

  #|{ Initializes a report of the progress at Earley set set_id for recognizer r. If a progress report already exists, it is destroyed and its memory is freed. Initially, the progress report is positioned before its first item.

      If no Earley set with ID set_id exists, marpa_r_progress_report_start() fails. The error code is MARPA-ERR-INVALID-LOCATION if set_id is negative. The error code is MARPA-ERR-NO-EARLEY-SET-AT-LOCATION if set_id is greater than the ID of the latest Earley set.

      Success value: the number of report items available. If the recognizer has not been started; if set_id does not exist; or on other failure, −2. 
      Failure value: −2. 
    }
  my sub marpa_r_progress_report_start
         ( Marpa-Recognizer $r, Marpa-Earley-Set-ID $set_id )
         returns Int
         is native( LIB ) { * }
  method r-progress-report-start
         ( Marpa-Recognizer $r, Marpa-Earley-Set-ID $set-id )
         returns Int {
           marpa_r_progress_report_start( $r, $set-id ) }

  #|{ Destroys the report of the progress at Earley set set_id for recognizer r, freeing the memory and other resources. It is often not necessary to call this method. Any previously existing progress report is destroyed automatically whenever a new progress report is started, and when the recognizer is destroyed.

      Success value: A non-negative value.
      Failure value: −2 if no progress report has been started, or on other failure.
    }
  my sub marpa_r_progress_report_finish
         ( Marpa-Recognizer $r )
         returns Int
         is native( LIB ) { * }
  method r-progress-report-finish
         ( Marpa-Recognizer $r )
         returns Int {
           marpa_r_progress_report_finish( $r ) }

  #|{ This method allows access to the data for the next item of a progress report. If there are no more progress report items, it returns −1 as a termination indicator and sets the error code to MARPA-ERR-PROGRESS-REPORT-EXHAUSTED. Either the termination indicator, or the item count returned by marpa_r_progress_report_start(), can be used to determine when the last item has been seen.

      On success, the dot position is returned in the location pointed to by the position argument, and the origin is returned in the location pointed to by the origin argument. On failure, the locations pointed to by the position and origin arguments are unchanged.

      Success value: The rule ID of the next progress report item. If there are no more progress report items, −1. If either the position or the origin argument is NULL, or on other failure, −2. 
      Failure value: −2. 
    }
  my sub marpa_r_progress_item
         ( Marpa-Recognizer $r, Pointer[Int] $position, Pointer[Marpa-Earley-Set-ID] $origin )
         returns Marpa-Rule-ID
         is native( LIB ) { * }
  method r-progress-item
         ( Marpa-Recognizer $r, Pointer[Int] $position, Pointer[Marpa-Earley-Set-ID] $origin )
         returns Marpa-Rule-ID {
           marpa_r_progress_item( $r, $position, $origin ) }

  #|{ Creates a new bocage object, with a reference count of 1. The reference count of its parent recognizer object, r, is increased by 1. If earley_set_ID is −1, the Earley set at the current earleme is used, if there is one.

      If earley_set_ID is −1 and there is no Earley set at the current earleme; or if earley_set_ID is −1 and there is no parse ending at Earley set earley_set_ID, marpa_b_new() fails and the error code is set to MARPA-ERR-NO-PARSE.

      Success value: The new bocage object.
      Failure value: NULL. 
    }
  my sub marpa_b_new
         ( Marpa-Recognizer $r, Marpa-Earley-Set-ID $earley_set_ID )
         returns Marpa-Bocage
         is native( LIB ) { * }
  method b-new
         ( Marpa-Recognizer $r, Marpa-Earley-Set-ID $earley-set-ID )
         returns Marpa-Bocage {
           marpa_b_new( $r, $earley-set-ID ) }

  #|{ Increases the reference count by 1. Not needed by most applications.

      Success value: $b.
      Failure value: NULL.
    }
  my sub marpa_b_ref
         ( Marpa-Bocage $b )
         returns Marpa-Bocage
         is native( LIB ) { * }
  method b-ref
         ( Marpa-Bocage $b )
         returns Marpa-Bocage {
           marpa_b_ref( $b ) }

  #|{ Decreases the reference count by 1, destroying b once the reference count reaches zero. When b is destroyed, the reference count of its parent recognizer is decreased by 1. If this takes the reference count of the parent recognizer to zero, it too is destroyed. If the parent recognizer is destroyed, the reference count of its base grammar is decreased by 1. If this takes the reference count of the base grammar to zero, it too is destroyed. 
    }
  my sub marpa_b_unref
        ( Marpa-Bocage $b )
        is native( LIB ) { * }
  method b-unref
        ( Marpa-Bocage $b ) {
          marpa_b_unref( $b ) }

  #|{ Returns an ambiguity metric. The metric is 1 is the parse is unambiguous. If the metric is 2 or greater, the parse is ambiguous. It was originally intended to have values greater than 2 be an cheaply computed estimate of the degree of ambiguity, but a satisfactory scheme for this has yet to be implemented.

      Success value: 1 if the bocage is not for an ambiguous parse; 2 or greater if the bocage is for an ambiguous parse.
      Failure value: −2. 
    }
  my sub marpa_b_ambiguity_metric
         ( Marpa-Bocage $b )
         returns Int
         is native( LIB ) { * }
  method b-ambiguity-metric
         ( Marpa-Bocage $b )
         returns Int {
           marpa_b_ambiguity_metric( $b ) }

  #|{ Success value: A number greater than or equal to 1 if the bocage is for a null parse; otherwise, 0.
      Failure value: −2. 
    }
  my sub marpa_b_is_null
         ( Marpa-Bocage $b )
         returns Int
         is native( LIB ) { * }
  method b-is-null
         ( Marpa-Bocage $b )
         returns Int {
           marpa_b_is_null( $b ) }

  #|{ Creates a new ordering object, with a reference count of 1. The reference count of its parent bocage object, b, is increased by 1.

      Success value: the new ordering object.
      Failure value: NULL. 
    }
  my sub marpa_o_new
         ( Marpa-Bocage $b )
         returns Marpa-Order
         is native( LIB ) { * }
  method o-new
         ( Marpa-Bocage $b )
         returns Marpa-Order {
           marpa_o_new( $b ) }

  #|{ Increases the reference count by 1. Not needed by most applications.

      Success value: o.
      Failure value: NULL. 
    }
  my sub marpa_o_ref
         ( Marpa-Order $o )
         returns Marpa-Order
         is native( LIB ) { * }
  method o-ref
         ( Marpa-Order $o )
         returns Marpa-Order {
           marpa_o_ref( $o ) }

  #|{ Decreases the reference count by 1, destroying o once the reference count reaches zero. Beginning with o's parent bocage, Libmarpa then proceeds up the chain of parent objects. Every time a child is destroyed, the reference count of its parent is decreased by 1. Every time the reference count of an object is decreased by 1, if that reference count is now zero, that object is destroyed. Libmarpa follows this chain of decrements and destructions as required, all the way back to the base grammar, if necessary. 
    }
  my sub marpa_o_unref
         ( Marpa-Order $o )
         is native( LIB ) { * }
  method o-unref
         ( Marpa-Order $o ) {
           marpa_o_unref( $o ) }

  #|{ Returns an ambiguity metric. The metric is 1 is the parse is unambiguous. If the metric is 2 or greater, the parse is ambiguous. It was originally intended to have values greater than 2 be an cheaply computed estimate of the degree of ambiguity, but a satisfactory scheme for this has yet to be implemented.

      If the ordering is not already frozen, it will be frozen on return from marpa_o_ambiguity_metric(). marpa_o_ambiguity_metric() is considered an “accessor”, because it is assumed that the ordering is frozen when marpa_o_ambiguity_metric() is called.

      Success value: 1 if the ordering is not for an ambiguous parse; 2 or greater if the ordering is for an ambiguous parse.
      Failure value: −2. 
    }
  my sub marpa_o_ambiguity_metric
         ( Marpa-Order $o )
         returns Int
         is native( LIB ) { * }
  method o-ambiguity-metric
         ( Marpa-Order $o )
         returns Int {
           marpa_o_ambiguity_metric( $o ) }

  #|{ Success value: A number greater than or equal to 1 if the ordering is for a null parse; otherwise, 0.
      Failure value: −2. 
    }
  my sub marpa_o_is_null
         ( Marpa-Order $o )
         returns Int
         is native( LIB ) { * }
  method o-is-null
         ( Marpa-Order $o )
         returns Int {
           marpa_o_is_null( $o ) }

  #|{ These methods, respectively, set and query the “high rank only” flag of ordering o. A flag of 1 indicates that, when ranking, all choices should be discarded except those of the highest rank. A flag of 0 indicates that no choices should be discarded on the basis of their rank.

      A value of 1 is the default. The value of the “high rank only” flag has no effect unless ranking has been turned on using the marpa_o_rank() method.

      Success value: the value of the “high rank only” flag after the call.
      Failure value: −2. 
    }
  my sub marpa_o_high_rank_only_set
         ( Marpa-Order $o, Int $flag )
         returns Int
         is native( LIB ) { * }
  method o-high-rank-only-set
         ( Marpa-Order $o, Int $flag )
         returns Int {
           marpa_o_high_rank_only_set( $o, $flag ) }
  my sub marpa_o_high_rank_only
         ( Marpa-Order $o )
         returns Int
         is native( LIB ) { * }
  method o-high-rank-only
         ( Marpa-Order $o )
         returns Int {
           marpa_o_high_rank_only( $o ) }

  #|{ By default, the ordering of parse trees is arbitrary. This method causes the ordering to be ranked according to the ranks of symbols and rules, the “null ranks high” flags of the rules, and the “high rank only” flag of the ordering. Once this method returns, the ordering is frozen.

      Success value: A non-negative value.
      Failure value: −2. 
    }
  my sub marpa_o_rank
         ( Marpa-Order $o )
         returns Int
         is native( LIB ) { * }
  method o-rank
         ( Marpa-Order $o )
         returns Int {
           marpa_o_rank( $o ) }

  #|{ Creates a new tree iterator, with a reference count of 1. The reference count of its parent ordering object, o, is increased by 1.

      When initialized, a tree iterator is positioned before the first parse tree. To position the tree iterator to the first parse, the application must call marpa_t_next().

      Success value: A newly created tree.
      Failure value: NULL.
    }
  my sub marpa_t_new
         ( Marpa-Order $o )
         returns Marpa-Tree
         is native( LIB ) { * }
  method t-new
         ( Marpa-Order $o )
         returns Marpa-Tree {
           marpa_t_new( $o ) }

  #|{ Increases the reference count by 1. Not needed by most applications.

      Success value: t.
      Failure value: NULL.
    }
  my sub marpa_t_ref
         ( Marpa-Tree $t )
         returns Marpa-Tree
         is native( LIB ) { * }
  method t-ref
         ( Marpa-Tree $t )
         returns Marpa-Tree {
           marpa_t_ref( $t ) }

  #|{ Decreases the reference count by 1, destroying t once the reference count reaches zero. Beginning with t's parent ordering, Libmarpa then proceeds up the chain of parent objects. Every time a child is destroyed, the reference count of its parent is decreased by 1. Every time the reference count of an object is decreased by 1, if that reference count is now zero, that object is destroyed. Libmarpa follows this chain of decrements and destructions as required, all the way back to the base grammar, if necessary. 
    }
  my sub marpa_t_unref
         ( Marpa-Tree $t )
         is native( LIB ) { * }
  method t-unref
         ( Marpa-Tree $t ) {
           marpa_t_unref( $t ) }

  #|{ Positions t at the next parse tree in the iteration. Tree iterators are initialized to the position before the first parse tree, so this method must be called before creating a valuator from a tree.

      If a tree iterator is positioned after the last parse, the tree is said to be “exhausted”. A tree iterator for a bocage with no parse trees is considered to be “exhausted” when initialized. If the tree iterator is exhausted, marpa_t_next() returns −1 as a termination indicator, and sets the error code to MARPA-ERR-TREE-EXHAUSTED.

      Success value: A non-negative value. If the tree iterator is exhausted, −1.
      Failure value: −2. 
    }
  my sub marpa_t_next
         ( Marpa-Tree $t )
         returns Int
         is native( LIB ) { * }
  method t-next
         ( Marpa-Tree $t )
         returns Int {
           marpa_t_next( $t ) }

  #|{ The parse counter counts the number of parse trees traversed so far. The count includes the current iteration of the tree, so that a value of 0 indicates that the tree iterator is at its initialized position, before the first parse tree.

      Success value: The number of parses traversed so far.
      Failure value: Always succeeds.
    }
  my sub marpa_t_parse_count
         ( Marpa-Tree $t )
         returns Int
         is native( LIB ) { * }
  method t-parse-count
         ( Marpa-Tree $t )
         returns Int {
           marpa_t_parse_count( $t ) }

  #|{ Creates a new valuator. The parent object of the new valuator will be the tree iterator t, and the reference count of the new valuator will be 1. The reference count of t is increased by 1.

      The parent tree iterator is “paused”, so that the tree iterator cannot move on to a new parse tree until the valuator is destroyed. Many valuators of the same parse tree can exist at once. A tree iterator is “unpaused” when all of the valuators of that tree iterator are destroyed.

      Success value: The newly created valuator.
      Failure value: NULL. 
    }
  my sub marpa_v_new
         ( Marpa-Tree $t )
         returns Marpa-Value
         is native( LIB ) { * }
  method v-new
         ( Marpa-Tree $t )
         returns Marpa-Value {
           marpa_v_new( $t ) }

  #|{ Increases the reference count by 1. Not needed by most applications.

      Success value: v.
      Failure value: NULL. 
    }
  my sub marpa_v_ref
         ( Marpa-Value $v )
         returns Marpa-Value
         is native( LIB ) { * }
  method v-ref
         ( Marpa-Value $v )
         returns Marpa-Value {
           marpa_v_ref( $v ) }

  #|{ Decreases the reference count by 1, destroying v once the reference count reaches zero. Beginning with v's parent tree, Libmarpa then proceeds up the chain of parent objects. Every time a child is destroyed, the reference count of its parent is decreased by 1. Every time the reference count of an object is decreased by 1, if that reference count is now zero, that object is destroyed. Libmarpa follows this chain of decrements and destructions as required, all the way back to the base grammar, if necessary. 
    }
  my sub marpa_v_unref
        ( Marpa-Value $v )
        is native( LIB ) { * }
  method v-unref
        ( Marpa-Value $v ) {
          marpa_v_unref( $v ) }

  #|{ This method “steps through” the valuator. The return value is a Marpa-Step_Type, an integer which indicates the type of step. How the application is expected to act on each step is described below. See Valuator steps by type. When the iteration through the steps is finished, marpa_v_step returns MARPA-STEP-INACTIVE.

      Success value: The type of the step to be performed.
                     This will always be a non-negative number.
      Failure value: −2. 
    }
  my sub marpa_v_step
         ( Marpa-Value $v )
         returns Marpa-Step-Type
         is native( LIB ) { * }
  method v-step
         ( Marpa-Value $v )
         returns Marpa-Step-Type {
           marpa_v_step( $v ) }

  #|{ On success, the type of the ix'th event is returned and the data for the ix'th event is placed in the location pointed to by event.

      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 queried using the marpa_g_event_count() method.

      Success value: The type of event ix. If there is no ix'th event, if ix is negative, or on other failure, −2.
      Failure value: −2. 
                     The locations pointed to by event are not changed. 
    }
  my sub marpa_g_event
         ( g $g, Pointer[Marpa-Event] $event, Int $ix )
         returns Marpa-Event-Code
         is native( LIB ) { * }
  method g-event
         ( g $g, Pointer[Marpa-Event] $event, Int $ix )
         returns Marpa-Event-Code {
           marpa_g_event( $g, $event, $ix ) }

  #|{ Success value: The number of events.
      Failure value: −2. 
    }
  my sub marpa_g_event_count
         ( g $g )
         returns Int
         is native( LIB ) { * }
  method g-event-count
         ( g $g )
         returns Int {
           marpa_g_event_count( $g ) }

  #|{ When a method fails, this method allows the application to read the error code. p_error_string is reserved for use by the internals. Applications should set it to NULL.

      Success value: The last error code from a Libmarpa method.
      Failure value: Always succeeds.
    }
  my sub marpa_g_error
         ( g $g, Pointer[Str] $p_error_string )
         returns Marpa-Error-Code
         is native( LIB ) { * }
  method g-error
         ( g $g, Pointer[Str] $p-error-string )
         returns Marpa-Error-Code {
           marpa_g_error( $g, $p-error-string ) }

  #|{ Sets the error code to MARPA-ERR-NONE. Not often used, but now and then it can be useful to force the error code to a known state.

      Success value: MARPA-ERR-NONE.
      Failure value: Always succeeds.
    }
  my sub marpa_g_error_clear
         ( g $g )
         returns Marpa-Error-Code
         is native( LIB ) { * }
  method g-error-clear
         ( g $g )
         returns Marpa-Error-Code {
           marpa_g_error_clear( $g ) }

  #|{ 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.

      Success value: 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. 
      Failure value: −2. 
    }
  my sub marpa_g_default_rank_set
         ( g $g, Marpa-Rank $rank )
         returns Marpa-Rank
         is native( LIB ) { * }
  method g-default-rank-set
         ( g $g, Marpa-Rank $rank )
         returns Marpa-Rank {
           marpa_g_default_rank_set( $g, $rank ) }
  my sub marpa_g_default_rank
         ( g $g )
         returns Marpa-Rank
         is native( LIB ) { * }
  method g-default-rank
         ( g $g )
         returns Marpa-Rank {
           marpa_g_default_rank( $g ) }

  #|{ 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.

      Success value: 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. 
      Failure value: −2. 
    }
  my sub marpa_g_symbol_rank_set
         ( g $g, Marpa-Symbol-ID $sym_id, Marpa-Rank $rank )
         returns Marpa-Rank
         is native( LIB ) { * }
  method g-symbol-rank-set
         ( g $g, Marpa-Symbol-ID $sym-id, Marpa-Rank $rank )
         returns Marpa-Rank {
           marpa_g_symbol_rank_set( $g, $sym-id, $rank ) }
  my sub marpa_g_symbol_rank
         ( g $g, Marpa-Symbol-ID $sym_id )
         returns Marpa-Rank
         is native( LIB ) { * }
  method g-symbol-rank
         ( g $g, Marpa-Symbol-ID $sym-id )
         returns Marpa-Rank {
           marpa_g_symbol_rank( $g, $sym-id ) }

  #|{ On success, returns previous default value of the assertion. 
    }
  my sub mar