class PDF::Reader::Buffer
def prepare_literal_token
problem.
processing to fix things like escaped new lines, but that's someone else's
The entire literal string will be returned as a single token. It will need further
string.
start of a new token in regular mode are left untouched when inside a literal
we find the closing ) delimiter. Lots of bytes that would otherwise indicate the
if we're currently inside a literal string we more or less just read bytes until
def prepare_literal_token str = "".dup count = 1 while count > 0 byte = @io.getbyte if byte.nil? count = 0 # unbalanced params elsif byte == 0x5C str << byte << @io.getbyte elsif byte == 0x28 # "(" str << "(" count += 1 elsif byte == 0x29 # ")" count -= 1 str << ")" unless count == 0 else str << byte unless count == 0 end end @tokens << str if str.size > 0 @tokens << ")" end