fn ops_is_prefix(
    sess: &ParseSess,
    node_id: NodeId,
    span: Span,
    name: MacroRulesNormalizedIdent,
    binder_ops: &[KleeneToken],
    occurrence_ops: &[KleeneToken]
)
Expand description

Returns whether binder_ops is a prefix of occurrence_ops.

The stack of Kleene operators of a meta-variable occurrence just needs to have the stack of Kleene operators of its binder as a prefix.

Consider $i in the following example:

( $( $i:ident = $($j:ident),+ );* ) => { $($( $i += $j; )+)* }

It occurs under the Kleene stack [“”, “+”] and is bound under [“”] only.

Arguments:

  • sess is used to emit diagnostics and lints
  • node_id is used to emit lints
  • span is the span of the meta-variable being check
  • name is the name of the meta-variable being check
  • binder_ops is the stack of Kleene operators for the binder
  • occurrence_ops is the stack of Kleene operators for the occurrence