Struct ast_grep_core::ops::Op
source · Implementations§
source§impl<L: Language, M: Matcher<L>> Op<L, M>
impl<L: Language, M: Matcher<L>> Op<L, M>
pub fn not(pattern: M) -> Not<L, M>
pub fn with_meta_var(
&mut self,
var_id: String,
matcher: MetaVarMatcher<L>
) -> &mut Self
source§impl<L: Language, M: Matcher<L>> Op<L, M>
impl<L: Language, M: Matcher<L>> Op<L, M>
pub fn every(pattern: M) -> Op<L, And<L, M, MatchAll>>
pub fn either(pattern: M) -> Op<L, Or<L, M, MatchNone>>
pub fn all<MS: IntoIterator<Item = M>>(patterns: MS) -> All<L, M>
pub fn any<MS: IntoIterator<Item = M>>(patterns: MS) -> Any<L, M>
pub fn new(matcher: M) -> Op<L, M>
Trait Implementations§
source§impl<L, M> Matcher<L> for Op<L, M>where
L: Language,
M: Matcher<L>,
impl<L, M> Matcher<L> for Op<L, M>where
L: Language,
M: Matcher<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_matchers(&self) -> MetaVarMatchers<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.