Module matcher

Module matcher 

Source
Expand description

This module defines the core Matcher trait in ast-grep.

Matcher has three notable implementations in this module:

  • Pattern: matches against a tree-sitter node based on its tree structure.
  • KindMatcher: matches a node based on its kind
  • RegexMatcher: matches a node based on its textual content using regex.

Modules§

kind_utils

Structs§

KindMatcher
MatchAll
MatchNone
NodeMatch
Represents the matched node with populated MetaVarEnv. It derefs to the Node so you can use it as a Node. To access the underlying MetaVarEnv, call get_env method.
Pattern
PatternBuilder
RegexMatcher

Enums§

KindMatcherError
PatternError
PatternNode
RegexMatcherError

Traits§

Matcher
Matcher defines whether a tree-sitter node matches certain pattern, and update the matched meta-variable values in MetaVarEnv. N.B. At least one positive term is required for matching
MatcherExt
MatcherExt provides additional utility methods for Matcher. It is implemented for all types that implement Matcher. N.B. This trait is not intended to be implemented by users.