Skip to content

Literal

kareman edited this page Aug 23, 2020 · 5 revisions

Literal

Matches a sequence of elements.

public struct Literal<Input: BidirectionalCollection>: Pattern where Input.Element: Hashable

If empty, it will always succeed without consuming any input.

Inheritance

ExpressibleByExtendedGraphemeClusterLiteral, ExpressibleByStringLiteral, ExpressibleByUnicodeScalarLiteral, Pattern, RegexConvertible

Initializers

init(_:)

@inlinable public init(_ input: Input)

init(_:)

Matches sequence.

@inlinable public init<S: Sequence>(_ sequence: S) where S.Element == Input.Element, Input == String

Properties

elements

let elements: Input

description

var description: String

Methods

createInstructions(_:)

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

&&(me:)

Matches the following pattern without consuming any input.

@inlinable public static prefix func &&(me: Literal) -> AndPattern<Literal>

Note: in standard PEG this operator is `&`, but that is not allowed in Swift.

Clone this wiki locally