Function rustc_expand::mbe::macro_check::ops_is_prefix
source · fn ops_is_prefix(
psess: &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:
psess
is used to emit diagnostics and lintsnode_id
is used to emit lintsspan
is the span of the meta-variable being checkname
is the name of the meta-variable being checkbinder_ops
is the stack of Kleene operators for the binderoccurrence_ops
is the stack of Kleene operators for the occurrence