TreeSitterQuery class final
A compiled capture query over the node kinds emitted by a grammar.
Constructors
-
TreeSitterQuery(Map<
String, String> capturesByKind, {Map<String, int> capturePatternIndicesByKind = const {}, List<TreeSitterQueryPattern> contextualCaptures = const [], List<TreeSitterStructuralQueryPattern> structuralPatterns = const [], List<TreeSitterStructuralQueryPattern> matchPatterns = const [], List<int> patternStartBytes = const [], List<int> patternEndBytes = const [], List<bool> patternRooted = const [], List<String> declaredCaptureNames = const [], List<Map< captureQuantifiersByPattern = const [], List<String, TreeSitterCaptureQuantifier> >bool> patternNonLocal = const [], List<int> guaranteedStepOffsets = const [], List<bool> guaranteedStepValues = const [], List<List< generalPredicatesByPattern = const [], List<TreeSitterQueryGeneralPredicate> >List< propertyPredicatesByPattern = const [], List<(TreeSitterQueryProperty, bool)> >List< propertySettingsByPattern = const [], List<TreeSitterQueryProperty> >String> predicateStrings = const [], List<List< predicateStepsByPattern = const [], int? patternCount})TreeSitterQueryPredicateStep> > -
const
-
TreeSitterQuery.fromRaw(TreeSitterRawHandle<
TreeSitterQuery> raw) -
Reconstructs ownership transferred through intoRaw.
factory
Properties
- captureCount → int
-
no setter
-
captureNames
→ List<
String> -
Capture names declared by every compiled query representation.
no setter
-
capturePatternIndicesByKind
→ Map<
String, int> -
final
-
captureQuantifiersByPattern
→ List<
Map< String, TreeSitterCaptureQuantifier> > -
final
-
capturesByKind
→ Map<
String, String> -
final
-
contextualCaptures
→ List<
TreeSitterQueryPattern> -
final
-
declaredCaptureNames
→ List<
String> -
final
-
generalPredicatesByPattern
→ List<
List< TreeSitterQueryGeneralPredicate> > -
final
-
guaranteedStepOffsets
→ List<
int> -
final
-
guaranteedStepValues
→ List<
bool> -
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isDisposed → bool
-
no setter
-
matchPatterns
→ List<
TreeSitterStructuralQueryPattern> -
Patterns retained only for matches. Capture-only highlighting keeps
using the compact maps above, while the match API preserves patterns
with no captures and their upstream pattern indices.
final
- patternCount → int
-
The number of source patterns in this query.
no setter
-
patternEndBytes
→ List<
int> -
final
-
patternNonLocal
→ List<
bool> -
final
-
patternRooted
→ List<
bool> -
final
-
patternStartBytes
→ List<
int> -
final
-
predicateStepsByPattern
→ List<
List< TreeSitterQueryPredicateStep> > -
final
-
predicateStrings
→ List<
String> -
final
-
propertyPredicatesByPattern
→ List<
List< (TreeSitterQueryProperty, bool)> > -
final
-
propertySettingsByPattern
→ List<
List< TreeSitterQueryProperty> > -
final
- requiresLocalProperties → bool
-
Whether this query reads properties produced by a locals pass.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringCount → int
-
no setter
-
structuralPatterns
→ List<
TreeSitterStructuralQueryPattern> -
final
Methods
-
captureIndexForName(
String name) → int? -
captureNameForId(
int captureId) → String -
captureQuantifierForId(
int patternIndex, int captureId) → TreeSitterCaptureQuantifier -
captureQuantifiers(
int patternIndex) → Map< String, TreeSitterCaptureQuantifier> -
captures(
TreeSitterNode node, {String? source, TreeSitterUtf16Range? range, TreeSitterQueryTextProvider? textProvider}) → List< TreeSitterQueryCapture> -
capturesForHighlighting(
TreeSitterNode node, {String? source, TreeSitterUtf16Range? range, TreeSitterQueryTextProvider? textProvider}) → List< TreeSitterQueryCapture> - Returns the winning capture for each syntax node using the complete structural query semantics.
-
disableCapture(
String name) → void -
disablePattern(
int patternIndex) → void - Prevents one source pattern from producing future captures or matches.
-
dispose(
) → void -
Releases the managed query owner, matching
ts_query_delete. -
endByteForPattern(
int patternIndex) → int - Returns the UTF-8 byte offset immediately after a source pattern.
-
generalPredicates(
int patternIndex) → List< TreeSitterQueryGeneralPredicate> -
intoRaw(
) → TreeSitterRawHandle< TreeSitterQuery> - Moves this compiled query into a one-shot logical raw handle.
-
isPatternGuaranteedAtStep(
int byteOffset) → bool -
Whether reaching the query step at
byteOffsetguarantees that its root pattern will finish matching. -
isPatternNonLocal(
int patternIndex) → bool -
isPatternRooted(
int patternIndex) → bool - Whether a pattern has one root node rather than a sibling forest or a top-level repetition.
-
matches(
TreeSitterNode node, {String? source, TreeSitterUtf16Range? range, TreeSitterQueryTextProvider? textProvider}) → List< TreeSitterQueryMatch> - Returns structural query matches without flattening their capture sets.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
predicatesForPattern(
int patternIndex) → List< TreeSitterQueryPredicateStep> -
propertyPredicates(
int patternIndex) → List< (TreeSitterQueryProperty, bool)> -
propertySettings(
int patternIndex) → List< TreeSitterQueryProperty> -
startByteForPattern(
int patternIndex) → int - Returns the UTF-8 byte offset at which a source pattern begins.
-
stringValueForId(
int stringId) → String -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
Compiled queries compare by owner identity, matching Rust's native
TSQuerypointer equality rather than structural query-source equality.override