Struct ast_grep_config::RuleWithConstraint
source · pub struct RuleWithConstraint<L: Language> {
pub rule: Rule<L>,
pub matchers: MetaVarMatchers<L>,
}Fields§
§rule: Rule<L>§matchers: MetaVarMatchers<L>Trait Implementations§
source§impl<L: Language> Default for RuleWithConstraint<L>
impl<L: Language> Default for RuleWithConstraint<L>
source§impl<L: Language> Matcher<L> for RuleWithConstraint<L>
impl<L: Language> Matcher<L> for RuleWithConstraint<L>
source§fn match_node_with_env<'tree>(
&self,
node: Node<'tree, L>,
env: &mut MetaVarEnv<'tree, L>
) -> Option<Node<'tree, L>>
fn match_node_with_env<'tree>(
&self,
node: Node<'tree, L>,
env: &mut MetaVarEnv<'tree, L>
) -> Option<Node<'tree, L>>
Returns the node why the input is matched or None if not matched.
The return value is usually input node itself, but it can be different node.
For example
Has matcher can return the child or descendant node.fn get_meta_var_env<'tree>(&self) -> MetaVarEnv<'tree, L>
source§fn potential_kinds(&self) -> Option<BitSet>
fn potential_kinds(&self) -> Option<BitSet>
Returns a bitset for all possible target node kind ids.
Returns None if the matcher needs to try against all node kind.
source§fn get_match_len(&self, _node: Node<'_, L>) -> Option<usize>
fn get_match_len(&self, _node: Node<'_, L>) -> Option<usize>
get_match_len will skip trailing anonymous child node to exclude punctuation.