Skip to content
kareman edited this page Aug 13, 2020 · 4 revisions

OneOf

Matches and consumes a single element.

public struct OneOf<Input: BidirectionalCollection>: Pattern where Input.Element: Hashable & Comparable

Inheritance

OneOfConvertible, Pattern

Initializers

init(description:regex:group:)

@usableFromInline init(description: String, regex: String? = nil, group: Group<Input.Element>)

init(description:regex:contains:)

Matches any element for which contains returns true.

@inlinable public init(description: String, regex: String? = nil, contains: @escaping (Input.Element) -> Bool)

Parameters

  • 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.

init(description:regex:contains:)

Matches any element for which contains returns true.

@inlinable public init(description: String, regex: String? = nil, contains: @escaping (Input.Element) -> Bool) where Input == String

Parameters

  • 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.

init(_:)

Matches any elements in elements.

@inlinable public init(_ elements: Input)

Parameters

  • elements: - elements: A sequence of elements to match.

init(not:)

Matches any elements not in elements.

@inlinable public init(not elements: Input)

Parameters

  • elements: - elements: A sequence of elements not to match.

init(closures:description:isNegated:)

@usableFromInline internal init(closures: [(Input.Element) -> Bool], description: String, isNegated: Bool = false)

init(_:)

Matches any of the provided elements.

@inlinable public init<O1: OneOfConvertible>(_ o1: O1) where Input.Element == O1.Element

init(_:_:)

Matches any of the provided elements.

@inlinable public init<O1: OneOfConvertible, O2: OneOfConvertible>(_ o1: O1, _ o2: O2) where Input.Element == O1.Element, O1.Element == O2.Element

init(_:_:_:)

Matches any of the provided elements.

@inlinable public init<O1: OneOfConvertible, O2: OneOfConvertible, O3: OneOfConvertible>(_ o1: O1, _ o2: O2, _ o3: O3) where Input.Element == O1.Element, O1.Element == O2.Element, O2.Element == O3.Element

init(_:_:_:_:)

Matches any of the provided elements.

@inlinable public init<O1: OneOfConvertible, O2: OneOfConvertible, O3: OneOfConvertible, O4: OneOfConvertible>(_ o1: O1, _ o2: O2, _ o3: O3, _ o4: O4) where Input.Element == O1.Element, O1.Element == O2.Element, O2.Element == O3.Element, O3.Element == O4.Element

init(not:)

Matches any but the provided elements.

@inlinable public init<O1: OneOfConvertible>(not o1: O1) where Input.Element == O1.Element

init(not:_:)

Matches any but the provided elements.

@inlinable public init<O1: OneOfConvertible, O2: OneOfConvertible>(not o1: O1, _ o2: O2) where Input.Element == O1.Element, O1.Element == O2.Element

init(not:_:_:)

Matches any but the provided elements.

@inlinable public init<O1: OneOfConvertible, O2: OneOfConvertible, O3: OneOfConvertible>(not o1: O1, _ o2: O2, _ o3: O3) where Input.Element == O1.Element, O1.Element == O2.Element, O2.Element == O3.Element

init(not:_:_:_:)

Matches any of the provided elements.

@inlinable public init<O1: OneOfConvertible, O2: OneOfConvertible, O3: OneOfConvertible, O4: OneOfConvertible>(not o1: O1, _ o2: O2, _ o3: O3, _ o4: O4) where Input.Element == O1.Element, O1.Element == O2.Element, O2.Element == O3.Element, O3.Element == O4.Element

Properties

group

let group: Group<Input.Element>

description

let description: String

_regex

let _regex: String?

regex

var regex: String

Methods

createInstructions(_:)

@inlinable public func createInstructions(_ instructions: inout ContiguousArray<Instruction<Input>>)

==(lhs:rhs:)

public static func ==(lhs: OneOf, rhs: OneOf) -> Bool

contains(_:)

@inlinable public func contains(_ char: Input.Element) -> Bool
Clone this wiki locally