class AdLint::Cc1::EscapeSequence
Public Class Methods
new(str)
click to toggle source
# File lib/adlint/cc1/util.rb, line 36 def initialize(str) @str = str end
Public Instance Methods
value()
click to toggle source
# File lib/adlint/cc1/util.rb, line 40 def value case @str when "\\'" then "'".ord when "\\\"" then "\"".ord when "\\?" then "?".ord when "\\\\" then "\\".ord when "\\a" then "\a".ord when "\\b" then "\b".ord when "\\f" then "\f".ord when "\\n" then "\n".ord when "\\r" then "\r".ord when "\\t" then "\t".ord when "\\v" then "\v".ord else case @str when /\A\\([0-9]{1,3})\z/ $1.to_i(8) when /\A\\x([0-9A-F]+)\z/i $1.to_i(16) when /\A\\u([0-9A-F]{4,8})\z/i $1.to_i(16) else 0 end end end