grit_pattern_matcher/
pattern.rs1mod accessor;
2mod accumulate;
3mod add;
4mod after;
5mod and;
6mod any;
7mod assignment;
8mod ast_node_pattern;
9mod before;
10mod boolean_constant;
11mod bubble;
12mod call;
13mod call_built_in;
14mod callback_pattern;
15mod container;
16mod contains;
17mod divide;
18mod dynamic_snippet;
19mod equal;
20mod every;
21mod file_pattern;
22mod files;
23mod float_constant;
24mod function_definition;
25mod functions;
26mod r#if;
27mod includes;
28mod int_constant;
29mod iter_pattern;
30mod like;
31mod limit;
32mod list;
33mod list_index;
34mod map;
35mod r#match;
36mod maybe;
37mod modulo;
38mod multiply;
39mod not;
40mod or;
41mod pattern_definition;
42mod patterns;
43mod predicate_definition;
44mod predicate_return;
45mod predicates;
46mod range;
47mod regex;
48mod resolved_pattern;
49mod rewrite;
50mod sequential;
51mod some;
52mod state;
53mod step;
54mod string_constant;
55mod subtract;
56mod undefined;
57mod variable;
58mod variable_content;
59mod r#where;
60mod within;
61
62pub use accessor::{Accessor, AccessorKey, AccessorMap};
63pub use accumulate::Accumulate;
64pub use add::Add;
65pub use after::After;
66pub use and::{And, PrAnd};
67pub use any::{Any, PrAny};
68pub use assignment::Assignment;
69pub use ast_node_pattern::{AstLeafNodePattern, AstNodePattern};
70pub use before::Before;
71pub use boolean_constant::BooleanConstant;
72pub use bubble::Bubble;
73pub use call::{Call, PrCall};
74pub use call_built_in::CallBuiltIn;
75pub use callback_pattern::CallbackPattern;
76pub use container::{Container, PatternOrResolved, PatternOrResolvedMut};
77pub use contains::Contains;
78pub use divide::Divide;
79pub use dynamic_snippet::{DynamicList, DynamicPattern, DynamicSnippet, DynamicSnippetPart};
80pub use equal::Equal;
81pub use every::Every;
82pub use file_pattern::FilePattern;
83pub use files::Files;
84pub use float_constant::FloatConstant;
85pub use function_definition::{FunctionDefinition, GritFunctionDefinition};
86pub use functions::{CallForeignFunction, CallFunction, Evaluator, FuncEvaluation, GritCall};
87pub use includes::Includes;
88pub use int_constant::IntConstant;
89pub use iter_pattern::{PatternOrPredicate, PatternOrPredicateIterator};
90pub use like::Like;
91pub use limit::Limit;
92pub use list::List;
93pub use list_index::{to_unsigned, ContainerOrIndex, ListIndex, ListOrContainer};
94pub use map::GritMap;
95pub use maybe::{Maybe, PrMaybe};
96pub use modulo::Modulo;
97pub use multiply::Multiply;
98pub use not::{Not, PrNot};
99pub use or::{Or, PrOr};
100pub use pattern_definition::PatternDefinition;
101pub use patterns::{CodeSnippet, Matcher, Pattern, PatternName};
102pub use predicate_definition::PredicateDefinition;
103pub use predicate_return::PrReturn;
104pub use predicates::Predicate;
105pub use r#if::{If, PrIf};
106pub use r#match::Match;
107pub use r#where::Where;
108pub use range::{Point, Range};
109pub use regex::{RegexLike, RegexPattern};
110pub use resolved_pattern::ResolvedPattern;
111pub use resolved_pattern::{File, JoinFn, LazyBuiltIn, ResolvedFile, ResolvedSnippet};
112pub use rewrite::Rewrite;
113pub use sequential::Sequential;
114pub use some::Some;
115pub use state::{get_top_level_effects, EffectRange, FilePtr, FileRegistry, State};
116pub use step::Step;
117pub use string_constant::StringConstant;
118pub use subtract::Subtract;
119pub use undefined::Undefined;
120pub use variable::{
121 get_absolute_file_name, get_file_name, is_reserved_metavariable, Variable, VariableSource,
122};
123pub use variable_content::VariableContent;
124pub use within::Within;
125
126use crate::context::QueryContext;
127
128#[cfg(feature = "grit_tracing")]
129use tracing::{instrument, span};
130#[cfg(feature = "grit_tracing")]
131use tracing_opentelemetry::OpenTelemetrySpanExt as _;
132
133pub trait Work<Q: QueryContext> {
141 fn execute(&self, state: &mut State<Q>);
146}