InequalityExpressionParser

Parses inequality expression patterns. e.g. ie:%d=5.

  • Pattern of expression.

    Declaration

    Swift

    let pattern: ExpressionPattern
  • Initializes parser.

    Declaration

    Swift

    required init(_ pattern: ExpressionPattern)

    Parameters

    pattern

    A pattern that will be parsed.

  • Parses pattern passed during initialization.

    Declaration

    Swift

    func parse() -> ExpressionMatcher?

    Return Value

    ExpressionMatcher object or nil if pattern cannot be parsed.

  • Get ValueType. Finds only %d - Int is only one supported for now.

    Declaration

    Swift

    private func valueType() -> ValueType?

    Return Value

    ValueType or nil if value cannot be found.

  • Get mathematical inequality sign.

    Declaration

    Swift

    private func sign() -> InequalitySign?

    Return Value

    InequalitySign or nil if sign cannot be found.

  • Get value - Int.

    Declaration

    Swift

    private func value() -> Int?

    Return Value

    value or nil if value cannot be found

  • Get value with regex and prints failure message if not found.

    Declaration

    Swift

    func getValue(regex: String, failureMessage: String) -> Int?

    Parameters

    regex

    A regular expression.

    failureMessage

    A message that is printed out in console on failure.

    Return Value

    A value or nil if value cannot be found.

  • Get sign with regex and prints failure message if not found.

    Declaration

    Swift

    func getSign(regex: String, failureMessage: String) -> InequalitySign?

    Parameters

    regex

    A regular expression.

    failureMessage

    A message that is printed out in console on failure.

    Return Value

    A sign or nil if value cannot be found.

  • Get value type with regex and prints failure message if not found.

    Declaration

    Swift

    func getValueType(regex: String, failureMessage: String) -> ValueType?

    Parameters

    regex

    A regular expression.

    failureMessage

    A message that is printed out in console on failure.

    Return Value

    A value type or nil if value cannot be found.