module TOML::BasicString
def self.decode_unicode(str)
Replace the unicode escaped characters with the corresponding character
def self.decode_unicode(str) [str[2..-1].to_i(16)].pack('U') end
def self.parse_error(m)
def self.parse_error(m) fail ParseError.new "Escape sequence #{m} is reserved" end
def self.transform_escaped_chars(str)
def self.transform_escaped_chars(str) str.gsub(/\\(u[\da-fA-F]{4}|U[\da-fA-F]{8}|.)/) do |m| if m.size == 2 SPECIAL_CHARS[m] || parse_error(m) else decode_unicode(m).force_encoding('UTF-8') end end end
def value
def value aux = TOML::BasicString.transform_escaped_chars first.value aux[1...-1] end