RegexQuery class
Regex/glob query: each segment is a compiled regex, with ** support
for crossing hierarchy boundaries.
Segment syntax
The query string is split on / into segments. Each segment is
independently compiled as a case-sensitive RegExp anchored to the
full occurrence or signal name (^…$). This means:
- Plain names match exactly:
Top/CPU/clk. - Glob wildcards are auto-converted before compilation:
*→.*(match any characters)?→.(match one character)- These compose naturally:
clk*matchesclk,clk_gated,clk_div2, etc.
- Full regex is supported within each segment since the string
is passed to RegExp:
d[0-9]+— signals namedd0,d1,d12, …(clk|reset)— eitherclkorresetdata_[a-z]{2}—data_ab,data_xy, ….*mux.*— any name containingmuxch[0-3]—ch0,ch1,ch2,ch3r[0-9]{1,2}—r0throughr99
**(double-star, as its own segment) matches zero or more hierarchy levels, allowing searches to cross boundaries:Top/**/clk—clkat any depth belowTop**/d[0-9]+— any signal liked0anywhereTop/**/ch*/data_*—data_*signals insidech*modules
Interaction between glob and regex
Glob conversion happens before regex compilation, so * and ?
are always expanded. If you need a literal * or ? in the regex,
escape them: \*, \?. All other regex metacharacters (., +,
|, (, ), [, ], {, }, ^, $) work as-is inside
each segment.
Examples
Query Matches
─────────────────────────────────────────────────────────────
Top/CPU/clk exact: Top → CPU → clk
Top/CPU/* all signals in Top/CPU
Top/*/clk clk one level below Top
Top/**/clk clk at any depth below Top
Top/**/c.* signals starting with 'c' anywhere
**/clk clk anywhere in hierarchy
**/(clk|reset) clk or reset anywhere
Top/CPU/d[0-9]+ d0, d1, d12, … in Top/CPU
Top/**/ch[0-3]/data_* data_* in ch0–ch3 at any depth
Top/mem_*/addr[0-9]* addr0, addr1, … in mem_* modules
**/.*mux.* any name containing 'mux' anywhere
- Inheritance
-
- Object
- HierarchyQuery
- RegexQuery
Constructors
- RegexQuery(String rawQuery, {SearchTarget target = SearchTarget.signals})
-
Create a regex query from
rawQuery.
Properties
- crossesBoundaries → bool
-
Whether this query can match across hierarchy boundaries.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isEmpty → bool
-
Whether the query is empty / trivial (should return no results).
no setterinherited
- rawQuery → String
-
The original user-supplied query string.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- segmentCount → int
-
Number of logical segments in the parsed query.
no setteroverride
-
segments
↔ List<
RegexSegment> -
Compiled segments — either a regex or a glob-star sentinel.
latefinal
- target → SearchTarget
-
What this query matches — occurrences, signals, or both.
finalinherited
Methods
-
isComplete(
int stateIndex) → bool -
Whether the query is fully consumed at
stateIndex.override -
matchOccurrence(
String occurrenceName, int stateIndex) → Set< int> -
Try matching an occurrence name at match state
stateIndex.override -
matchSignal(
String signalName, int stateIndex) → bool -
Whether
signalNamematches the query at statestateIndex.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited