Type object
File match **/.astgrep/rules/**/*.yaml **/.astgrep/rules/**/*.yml **/.ast-grep/rules/**/*.yaml **/.ast-grep/rules/**/*.yml **/ast-grep/rules/**/*.yaml **/ast-grep/rules/**/*.yml **/astgrep/rules/**/*.yaml **/astgrep/rules/**/*.yml
Schema URL https://catalog.lintel.tools/schemas/ast-grep/ast-grep-rules/latest.json
Source https://raw.githubusercontent.com/ast-grep/ast-grep/main/schemas/rule.json

Validate with Lintel

npx @lintel/lintel check
Type: object

Used for global rules, rewriters, and pyo3/napi

Properties

rule object required

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

2 nested properties
line integer required

0-based line number in the source code

format=uintmin=0
column integer | null

0-based column number in the source code

format=uintmin=0
end object required

Represents a zero-based character-wise position in a document

2 nested properties
line integer required

0-based line number in the source code

format=uintmin=0
column integer | null

0-based column number in the source code

format=uintmin=0
inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
matches string | object
language string required

Placeholder for language, used in JSON schema only.

constraints Record<string, object>

Additional meta variables pattern to filter matching

utils Record<string, object>

Utility rules that can be used in matches

transform Record<string, string | Trans>

A dictionary for metavariable manipulation. Dict key is the new variable name. Dict value is a [transformation] that specifies how meta var is processed. See transformation doc.

fix SerializableFixer | null

A pattern string or a FixConfig object to auto fix the issue. It can reference metavariables appeared in rule. See details in fix object reference.

id string

Unique, descriptive identifier, e.g., no-unused-variable

Default: ""
rewriters array | null

Rewrite rules for rewrite transformation

message string

Main message highlighting why this rule fired. It should be single line and concise, but specific enough to be understood without additional context.

Default: ""
note string | null

Additional notes to elaborate the message and provide potential fix to the issue. notes can contain markdown syntax, but it cannot reference meta-variables.

severity string | string | string | string | string
labels Record<string, object>

Custom label dictionary to configure reporting. Key is the meta-variable name and value is the label message and label style.

files array | null

Glob patterns to specify that the rule only applies to matching files

ignores array | null

Glob patterns that exclude rules from applying to files

url string | null

Documentation link to this rule

metadata Metadata | null

Extra information for the rule

Definitions

SerializableRule object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

2 nested properties
line integer required

0-based line number in the source code

format=uintmin=0
column integer | null

0-based column number in the source code

format=uintmin=0
end object required

Represents a zero-based character-wise position in a document

2 nested properties
line integer required

0-based line number in the source code

format=uintmin=0
column integer | null

0-based column number in the source code

format=uintmin=0
inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
matches string | object
PatternStyle string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

Strictness string | string | string | string | string | string
SerializableNthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

NthChildSimple integer | string

A string or number describing the indices of matching nodes in a list of siblings.

SerializableRange object

Represents a position in source code using 0-based line and column numbers

start object required

Represents a zero-based character-wise position in a document

2 nested properties
line integer required

0-based line number in the source code

format=uintmin=0
column integer | null

0-based column number in the source code

format=uintmin=0
end object required

Represents a zero-based character-wise position in a document

2 nested properties
line integer required

0-based line number in the source code

format=uintmin=0
column integer | null

0-based column number in the source code

format=uintmin=0
SerializablePosition object

Represents a zero-based character-wise position in a document

line integer required

0-based line number in the source code

format=uintmin=0
column integer | null

0-based column number in the source code

format=uintmin=0
Relation object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

2 nested properties
line integer required

0-based line number in the source code

format=uintmin=0
column integer | null

0-based column number in the source code

format=uintmin=0
end object required

Represents a zero-based character-wise position in a document

2 nested properties
line integer required

0-based line number in the source code

format=uintmin=0
column integer | null

0-based column number in the source code

format=uintmin=0
inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
SerializableMatches string | object
SerializableStopBy string | SerializableRule

Control how the relational rule search should stop

Transformation string | Trans
Trans object | object | object | object

Represents a transformation that can be applied to a matched AST node. Available transformations are substring, replace and convert.

Substring object

Extracts a substring from the meta variable's text content.

Both start_char and end_char support negative indexing, which counts character from the end of an array, moving backwards.

source string required

source meta variable to be transformed

startChar integer | null

optional starting character index of the substring, defaults to 0.

format=int32
endChar integer | null

optional ending character index of the substring, defaults to the end of the string.

format=int32
Replace object

Replaces a substring in the meta variable's text content with another string.

source string required

source meta variable to be transformed

replace string required

a regex to find substring to be replaced

by string required

the replacement string

Convert object

Converts the source meta variable's text content to a specified case format.

source string required

source meta variable to be transformed

toCase string required

An enumeration representing different cases for strings.

Values: "lowerCase" "upperCase" "capitalize" "camelCase" "snakeCase" "kebabCase" "pascalCase"
separatedBy array | null

optional separators to specify how to separate word

StringCase string

An enumeration representing different cases for strings.

Separator string

Separator to split string. e.g. user_accountName -> user, accountName It will be rejoin according to StringCase.

Rewrite object
source string required
rewriters string[] required
joinBy string | null
SerializableFixer string | SerializableFixConfig | SerializableFixConfig[]

A pattern string or fix object to auto fix the issue. It can reference metavariables appeared in rule.

SerializableFixConfig object
template string required
expandEnd object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
expandStart object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
title string | null
Language string

Placeholder for language, used in JSON schema only.

SerializableRewriter object

Used for global rules, rewriters, and pyo3/napi

rule object required

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

2 nested properties
start object required

Represents a zero-based character-wise position in a document

end object required

Represents a zero-based character-wise position in a document

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null
follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

15 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
stopBy string | SerializableRule

Control how the relational rule search should stop

field string | null

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

13 nested properties
pattern string | object

A String pattern will match one single AST node according to pattern syntax. Or an object with field context, selector and optionally strictness.

kind string

The kind name of the node to match. You can look up code's kind names in playground.

regex string

A Rust regular expression to match the node's text. https://docs.rs/regex/latest/regex/#syntax

nthChild NthChildSimple | object

nthChild accepts either a number, a string or an object.

range object

Represents a position in source code using 0-based line and column numbers

inside object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

has object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

precedes object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

follows object

A relational rule object, which is a Rule object with two additional fields stopBy and field.

A list of sub rules and matches a node if all of sub rules match. The meta variables of the matched node contain all variables from the sub-rules.

A list of sub rules and matches a node if any of sub rules match. The meta variables of the matched node only contain those of the matched sub-rule.

not object

A rule object to find matching AST nodes. We have three categories of rules in ast-grep.

  • Atomic: the most basic rule to match AST. We have two variants: Pattern and Kind.

  • Relational: filter matched target according to their position relative to other nodes.

  • Composite: use logic operation all/any/not to compose the above rules to larger rules.

Every rule has it's unique name so we can combine several rules in one object.

matches string | object
matches string | object
id string required

Unique, descriptive identifier, e.g., no-unused-variable

constraints Record<string, object>

Additional meta variables pattern to filter matching

utils Record<string, object>

Utility rules that can be used in matches

transform Record<string, string | Trans>

A dictionary for metavariable manipulation. Dict key is the new variable name. Dict value is a [transformation] that specifies how meta var is processed. See transformation doc.

fix SerializableFixer | null

A pattern string or a FixConfig object to auto fix the issue. It can reference metavariables appeared in rule. See details in fix object reference.

Severity string | string | string | string | string
LabelConfig object
style string | string required
message string | null
LabelStyle string | string
RuleFileGlob string | object
Metadata object

Additional metadata for the rule, can be used to store extra information.