MCPcopy Create free account
hub / github.com/csskit/csskit / build_visit_attr_matcher

Function build_visit_attr_matcher

crates/csskit_source_finder/src/lib.rs:101–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

99}
100
101fn build_visit_attr_matcher() -> RegexMatcher {
102 RegexMatcherBuilder::new()
103 .multi_line(true)
104 .dot_matches_new_line(true)
105 .ignore_whitespace(true)
106 .build(
107 r#"
108 ^\s*\#\[
109 # Match any type with derive(Visitable)
110 cfg_attr\([^,]+,\s*derive\((?:csskit_derives::)?Visitable\)
111 # Capture everything from here until the type declaration to search for visit attr
112 # This captures the visit attr whether it's on same line or separate line
113 ([^\{\}]*?)
114 # Match the type declaration
115 (pub\s*(?:struct|enum)\s*)
116 # munch any comments/attributes between this and our name (for macros)
117 (:?\n?\s*(:?\/\/|\#)[^\n]*)*
118 # finally grab the word (plus any generics)
119 \s*(\w*(:?<[^>]+>)?)"#,
120 )
121 .unwrap()
122}
123
124fn build_manual_impl_matcher() -> RegexMatcher {
125 RegexMatcherBuilder::new()

Callers 1

find_visitable_nodesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected