-
Notifications
You must be signed in to change notification settings - Fork 1
Parser
kareman edited this page Aug 13, 2020
·
3 revisions
Takes a pattern, optimises it and tries to match it over an input.
public struct Parser<Input: BidirectionalCollection> where Input.Element: Hashable
A parser which matches pattern
at a given position.
@inlinable public init<P: Pattern>(_ pattern: P) throws where P.Input == Input
A parser which searches for pattern
from a given position.
@inlinable public init<P: Pattern>(search pattern: P) throws where P.Input == Input
Is the same as Parser(Skip() • pattern)
.
let matcher: VMEngine<Input>
Tries to match the pattern in input
at index
.
@inlinable public func match(in input: Input, at index: Input.Index? = nil) -> Match?
- index: - index: The position to match at, if not provided the beginning of input will be used.
A lazily generated sequence of consecutive matches of the pattern in input
.
@inlinable public func matches(in input: Input, from startindex: Input.Index? = nil) -> UnfoldSequence<Match, Input.Index>
Each match attempt starts at the .range.upperBound
of the previous match,
so the matches can be overlapping.
You can dictate where the next match should start by where you place the last capture.
- startindex: - startindex: The position to match from, if not provided the beginning of input will be used.
Generated at 2020-08-23T12:56:49+0000 using swift-doc 1.0.0-beta.3.