Keyword
public class Keyword : PatternElement, Equatable
Keyword
instances are used to provide static points in match sequences so that they can be used as pillars of the expressions the developer tries to match
-
The type of the Keyword determines whether the item holds some special purpose, or it’s just an ordinary static String
See moreDeclaration
Swift
public enum KeywordType : Equatable
-
Name (and value) of the
Keyword
Declaration
Swift
let name: String
-
Type of the keyword, which gives the framework some extra semantics about its nature
Declaration
Swift
let type: KeywordType
-
Keyword
initialiserDeclaration
Swift
public init(_ name: String, type: KeywordType = .generic)
Parameters
name
The name (and value) of the
Keyword
type
Type of the keyword, which gives the framework some extra semantics about its nature. Defaults to
KeywordType.generic
-
Keyword
instances are returning exactMatch, when they are equal to theprefix
input. If the input is really just a prefix of the keyword, possible metch is returned. noMatch otherwise.Declaration
Swift
public func matches(prefix: String, options: PatternOptions = []) -> MatchResult<Any>
Parameters
prefix
The input
options
Options that modify the matching algorithm
Return Value
The result of the match operation
-
Keyword
instances areEquatable
sDeclaration
Swift
public static func == (lhs: Keyword, rhs: Keyword) -> Bool
Parameters
lhs
Left hand side
rhs
Right hand side
Return Value
Whether the names and types are equal in
lhs
andrhs