Query

actual class Query constructor(language: Language, source: String) : AutoCloseable(source)

A class that represents a set of patterns which match nodes in a syntax tree.

NOTE: If you're targeting Android SDK level < 33, you must use or close the instance to free up resources.

Throws

If any error occurred while creating the query.

expect class Query constructor(language: Language, source: String)(source)

A class that represents a set of patterns which match nodes in a syntax tree.

Throws

If any error occurred while creating the query.

actual class Query constructor(language: Language, source: String)(source)

A class that represents a set of patterns which match nodes in a syntax tree.

Throws

If any error occurred while creating the query.

actual class Query constructor(language: Language, source: String)(source)

A class that represents a set of patterns which match nodes in a syntax tree.

Throws

If any error occurred while creating the query.

Constructors

Link copied to clipboard
actual constructor(language: Language, source: String)

Create a new query from a particular language and a string containing one or more S-expression patterns.

expect constructor(language: Language, source: String)

Create a new query from a particular language and a string containing one or more S-expression patterns.

actual constructor(language: Language, source: String)

Create a new query from a particular language and a string containing one or more S-expression patterns.

actual constructor(language: Language, source: String)

Create a new query from a particular language and a string containing one or more S-expression patterns.

Properties

Link copied to clipboard
actual var byteRange: UIntRange

The range of bytes in which the query will be executed.

expect var byteRange: UIntRange

The range of bytes in which the query will be executed.

actual var byteRange: UIntRange

The range of bytes in which the query will be executed.

actual var byteRange: UIntRange

The range of bytes in which the query will be executed.

Link copied to clipboard
@get:JvmName(name = "getCaptureCount")
actual val captureCount: UInt

The number of captures in the query.

expect val captureCount: UInt

The number of captures in the query.

@get:JvmName(name = "getCaptureCount")
actual val captureCount: UInt

The number of captures in the query.

actual val captureCount: UInt

The number of captures in the query.

Link copied to clipboard
@get:JvmName(name = "didExceedMatchLimit")
actual val didExceedMatchLimit: Boolean

Check if the query exceeded its maximum number of in-progress matches during its last execution.

Check if the query exceeded its maximum number of in-progress matches during its last execution.

@get:JvmName(name = "didExceedMatchLimit")
actual val didExceedMatchLimit: Boolean

Check if the query exceeded its maximum number of in-progress matches during its last execution.

Check if the query exceeded its maximum number of in-progress matches during its last execution.

Link copied to clipboard
@get:JvmName(name = "getMatchLimit")
@set:JvmName(name = "setMatchLimit")
actual var matchLimit: UInt

The maximum number of in-progress matches.

expect var matchLimit: UInt

The maximum number of in-progress matches.

@get:JvmName(name = "getMatchLimit")
@set:JvmName(name = "setMatchLimit")
actual var matchLimit: UInt

The maximum number of in-progress matches.

actual var matchLimit: UInt

The maximum number of in-progress matches.

Link copied to clipboard
@get:JvmName(name = "getMaxStartDepth")
@set:JvmName(name = "setMaxStartDepth")
actual var maxStartDepth: UInt

The maximum start depth for the query.

expect var maxStartDepth: UInt

The maximum start depth for the query.

@get:JvmName(name = "getMaxStartDepth")
@set:JvmName(name = "setMaxStartDepth")
actual var maxStartDepth: UInt

The maximum start depth for the query.

actual var maxStartDepth: UInt

The maximum start depth for the query.

Link copied to clipboard
@get:JvmName(name = "getPatternCount")
actual val patternCount: UInt

The number of patterns in the query.

expect val patternCount: UInt

The number of patterns in the query.

@get:JvmName(name = "getPatternCount")
actual val patternCount: UInt

The number of patterns in the query.

actual val patternCount: UInt

The number of patterns in the query.

Link copied to clipboard

The range of points in which the query will be executed.

The range of points in which the query will be executed.

The range of points in which the query will be executed.

The range of points in which the query will be executed.

Link copied to clipboard
@get:JvmName(name = "getTimeoutMicros")
@set:JvmName(name = "setTimeoutMicros")
actual var timeoutMicros: ULong

The maximum duration in microseconds that query execution should be allowed to take before halting.

expect var timeoutMicros: ULong

The maximum duration in microseconds that query execution should be allowed to take before halting.

@get:JvmName(name = "getTimeoutMicros")
@set:JvmName(name = "setTimeoutMicros")
actual var timeoutMicros: ULong

The maximum duration in microseconds that query execution should be allowed to take before halting.

actual var timeoutMicros: ULong

The maximum duration in microseconds that query execution should be allowed to take before halting.

Functions

Link copied to clipboard
@JvmName(name = "assertions")
actual fun assertions(index: UInt): Map<String, Pair<String?, Boolean>>

Get the property assertions for the given pattern index.

expect fun assertions(index: UInt): Map<String, Pair<String?, Boolean>>

Get the property assertions for the given pattern index.

@JvmName(name = "assertions")
actual fun assertions(index: UInt): Map<String, Pair<String?, Boolean>>

Get the property assertions for the given pattern index.

actual fun assertions(index: UInt): Map<String, Pair<String?, Boolean>>

Get the property assertions for the given pattern index.

Link copied to clipboard

Iterate over all the individual captures in the order that they appear.

expect fun captures(node: Node, predicate: QueryPredicate.(QueryMatch) -> Boolean = { true }): Sequence<Pair<UInt, QueryMatch>>

Iterate over all the individual captures in the order that they appear.

Iterate over all the individual captures in the order that they appear.

actual fun captures(node: Node, predicate: QueryPredicate.(QueryMatch) -> Boolean = { true }): Sequence<Pair<UInt, QueryMatch>>

Iterate over all the individual captures in the order that they appear.

Link copied to clipboard
open override fun close()
Link copied to clipboard
actual fun disableCapture(name: String)

Disable a certain capture within a query.

expect fun disableCapture(name: String)

Disable a certain capture within a query.

actual fun disableCapture(name: String)

Disable a certain capture within a query.

actual fun disableCapture(name: String)

Disable a certain capture within a query.

Link copied to clipboard
@JvmName(name = "disablePattern")
actual external fun disablePattern(index: UInt)

Disable a certain pattern within a query.

expect fun disablePattern(index: UInt)

Disable a certain pattern within a query.

@JvmName(name = "disablePattern")
actual external fun disablePattern(index: UInt)

Disable a certain pattern within a query.

actual fun disablePattern(index: UInt)

Disable a certain pattern within a query.

Link copied to clipboard
@JvmName(name = "endByteForPattern")
actual external fun endByteForPattern(index: UInt): UInt

Get the byte offset where the given pattern ends in the query's source.

expect fun endByteForPattern(index: UInt): UInt

Get the byte offset where the given pattern ends in the query's source.

@JvmName(name = "endByteForPattern")
actual external fun endByteForPattern(index: UInt): UInt

Get the byte offset where the given pattern ends in the query's source.

actual fun endByteForPattern(index: UInt): UInt

Get the byte offset where the given pattern ends in the query's source.

Link copied to clipboard
@JvmName(name = "isPatternGuaranteedAtStep")
actual fun isPatternGuaranteedAtStep(offset: UInt): Boolean

Check if a pattern is guaranteed to match once a given byte offset is reached.

Check if a pattern is guaranteed to match once a given byte offset is reached.

@JvmName(name = "isPatternGuaranteedAtStep")
actual fun isPatternGuaranteedAtStep(offset: UInt): Boolean

Check if a pattern is guaranteed to match once a given byte offset is reached.

Check if a pattern is guaranteed to match once a given byte offset is reached.

Link copied to clipboard
@JvmName(name = "isPatternNonLocal")
actual external fun isPatternNonLocal(index: UInt): Boolean

Check if the pattern with the given index is "non-local".

expect fun isPatternNonLocal(index: UInt): Boolean

Check if the pattern with the given index is "non-local".

@JvmName(name = "isPatternNonLocal")
actual external fun isPatternNonLocal(index: UInt): Boolean

Check if the pattern with the given index is "non-local".

actual fun isPatternNonLocal(index: UInt): Boolean

Check if the pattern with the given index is "non-local".

Link copied to clipboard
@JvmName(name = "isPatternRooted")
actual external fun isPatternRooted(index: UInt): Boolean

Check if the pattern with the given index has a single root node.

expect fun isPatternRooted(index: UInt): Boolean

Check if the pattern with the given index has a single root node.

@JvmName(name = "isPatternRooted")
actual external fun isPatternRooted(index: UInt): Boolean

Check if the pattern with the given index has a single root node.

actual fun isPatternRooted(index: UInt): Boolean

Check if the pattern with the given index has a single root node.

Link copied to clipboard

Iterate over all the matches in the order that they were found.

expect fun matches(node: Node, predicate: QueryPredicate.(QueryMatch) -> Boolean = { true }): Sequence<QueryMatch>

Iterate over all the matches in the order that they were found.

Iterate over all the matches in the order that they were found.

actual fun matches(node: Node, predicate: QueryPredicate.(QueryMatch) -> Boolean = { true }): Sequence<QueryMatch>

Iterate over all the matches in the order that they were found.

Link copied to clipboard
@JvmName(name = "settings")
actual fun settings(index: UInt): Map<String, String?>

Get the property settings for the given pattern index.

expect fun settings(index: UInt): Map<String, String?>

Get the property settings for the given pattern index.

@JvmName(name = "settings")
actual fun settings(index: UInt): Map<String, String?>

Get the property settings for the given pattern index.

actual fun settings(index: UInt): Map<String, String?>

Get the property settings for the given pattern index.

Link copied to clipboard
@JvmName(name = "startByteForPattern")
actual external fun startByteForPattern(index: UInt): UInt

Get the byte offset where the given pattern starts in the query's source.

expect fun startByteForPattern(index: UInt): UInt

Get the byte offset where the given pattern starts in the query's source.

@JvmName(name = "startByteForPattern")
actual external fun startByteForPattern(index: UInt): UInt

Get the byte offset where the given pattern starts in the query's source.

actual fun startByteForPattern(index: UInt): UInt

Get the byte offset where the given pattern starts in the query's source.

toString
Link copied to clipboard
open override fun toString(): String
open override fun toString(): String
open override fun toString(): String