-
Notifications
You must be signed in to change notification settings - Fork 1
OneOf
kareman edited this page Jul 1, 2020
·
4 revisions
Matches and consumes a single element.
public struct OneOf: Pattern, RegexConvertible
OneOfConvertible
, Pattern
, RegexConvertible
@usableFromInline init(description: String, regex: String? = nil, group: Group<Input.Element>)
Matches any element for which contains
returns true
.
@inlinable public init(description: String, regex: String? = nil, contains: @escaping (Input.Element) -> Bool)
- description: - description: A descriptive identifier for textual representation of the pattern.
- regex: - regex: An optional regex matching the same elements.
- contains: - contains: A closure returning true for any element that matches.
Matches any elements in elements
.
@inlinable public init<S: Sequence>(_ elements: S) where S.Element == Input.Element
- elements: - elements: A sequence of elements to match.
Matches any elements not in elements
.
@inlinable public init<S: Sequence>(not elements: S) where S.Element == Input.Element
- elements: - elements: A sequence of elements not to match.
Matches any of the provided elements.
@inlinable public init(_ oneofs: OneOfConvertible)
Matches anything that is not among the provided elements.
@inlinable public init(not oneofs: OneOfConvertible)
let group: Group<Input.Element>
let description: String
let _regex: String?
var regex: String
Predefined OneOf patterns.
let patterns: [OneOf]
@inlinable public func createInstructions(_ instructions: inout Instructions)
@inlinable public func contains(_ char: Pattern.Input.Element) -> Bool
All the predefined OneOf patterns that match element
.
public static func patterns(for element: Input.Element) -> [OneOf]
The predefined OneOf patterns that match all the elements in sequence
.
public static func patterns<S: Sequence>(for sequence: S) -> [OneOf] where S.Element == Input.Element
Generated at 2020-08-23T12:56:49+0000 using swift-doc 1.0.0-beta.3.