Terminal

public enum Terminal
extension Terminal: ExpressibleByStringLiteral
extension Terminal: Hashable
extension Terminal: CustomStringConvertible
extension Terminal: Codable

A terminal symbol which can occur in a string recognized by a parser and which cannot be replaced by any production

  • A terminal that is a string. The terminal is matched when the tokenized subsequence of a word is equal to this string.

    Declaration

    Swift

    case string(string: String, hash: Int)
  • A terminal that is a range of characters. The terminal is matched when the tokenized subsequence is a character contained in this range.

    Declaration

    Swift

    case characterRange(range: ClosedRange<Character>, hash: Int)
  • A terminal that is a regular epxression. The terminal is matched when the tokenized subsequence is contained in the language generated by the given regular expression

    Declaration

    Swift

    case regularExpression(expression: NSRegularExpression, hash: Int)
  • Creates a terminal that is a string. The terminal is matched when the tokenized subsequence of a word is equal to this string.

    Declaration

    Swift

    init(string: String)

    Parameters

    string

    Terminal string

  • Creates a terminal that is a range of characters. The terminal is matched when the tokenized subsequence is a character contained in this range.

    Declaration

    Swift

    init(range: ClosedRange<Character>)

    Parameters

    range

    Range of matched characters

  • Creates a terminal that is a regular epxression. The terminal is matched when the tokenized subsequence is contained in the language generated by the given regular expression

    Throws

    An error indicating that the regular expression is invalid

    Declaration

    Swift

    init(expression: String) throws

    Parameters

    expression

    Regular expression specifying the language matched by terminal

  • Indicates that this terminal matches the empty string and only the empty string.

    Declaration

    Swift

    var isEmpty: Bool { get }
  • Declaration

    Swift

    public init(stringLiteral value: String)
  • Declaration

    Swift

    public static func == (lhs: Terminal, rhs: Terminal) -> Bool
  • Declaration

    Swift

    public var hashValue: Int { get }
  • Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • Declaration

    Swift

    public var description: String { get }
  • Declaration

    Swift

    public init(from decoder: Decoder) throws
  • Declaration

    Swift

    public func encode(to encoder: Encoder) throws