Skip to content

Parser_Match

kareman edited this page Aug 13, 2020 · 3 revisions

Parser.Match

Contains information about a patterns successfully completed match.

public struct Match: Equatable

Inheritance

Equatable

Initializers

init(endIndex:captures:)

@inlinable init(endIndex: Input.Index, captures: [(name: String?, range: Range<Input.Index>)])

init(_:instructions:)

@usableFromInline init(_ thread: VMEngine<Input>.Thread, instructions: VMEngine<Input>.Instructions)

Properties

endIndex

The position in the input when the pattern completed.

let endIndex: Input.Index

Note: If the last part of the pattern is a `!` or `&&`, `endIndex` is the position when that last part *started*.

captures

The names and ranges of all captures.

let captures: [(name: String?, range: Range<Input.Index>)]

range

The range from the beginning of the first capture to the end of the last one. If there are no captures, the empty range at the endIndex of this Match.

var range: Range<Input.Index>

captureNames

The names of all the captures.

var captureNames: Set<String>

Methods

==(lhs:rhs:)

@inlinable public static func ==(lhs: Parser<Input>.Match, rhs: Parser<Input>.Match) -> Bool

description(using:)

public func description(using input: Input) -> String
Clone this wiki locally