module Net::IMAP::StringPrep

def check_bidi!(string, c_8: false, profile: nil)

added to any exception that is raised (it does not affect behavior).
requirements are met. +profile+ is an optional string which will be
Raises either ProhibitedCodepoint or BidiStringError unless all

checked when c_8: true.
This is usually combined with #check_prohibited!, so table "C.8" is only

RandALCat character MUST be the last character of the string.
character MUST be the first character of the string, and a
* If a string contains any RandALCat character, a RandALCat
contain any LCat character.
* If a string contains any RandALCat character, the string MUST NOT
* The characters in \StringPrep\[\"C.8\"] MUST be prohibited

requirements in RFC-3454, ยง6:
Checks that +string+ obeys all of the "Bidirectional Characters"
def check_bidi!(string, c_8: false, profile: nil)
  check_prohibited!(string, "C.8", profile: profile) if c_8
  if Tables::BIDI_FAILS_REQ2.match?(string)
    raise BidiStringError.new(
      Tables::BIDI_DESC_REQ2, string: string, profile: profile,
    )
  elsif Tables::BIDI_FAILS_REQ3.match?(string)
    raise BidiStringError.new(
      Tables::BIDI_DESC_REQ3, string: string, profile: profile,
    )
  end
end