def _string(self, quote, token):
    'Tokenizes a string.'
    if (quote == '"'):
        if re.search('[$\\\\]', token):
            token = re.sub('\\\\([\\\\"])', '\\1', token)
            token = re.sub('\\\\([^$nrt])', '\\1', token)
            token = re.sub('\\\\([nrt])', (lambda m: ESCAPE[m.group(1)]), token)
            return ((['"', '"'] + self.interpolate_text(token)) + ['"', '"'])
        else:
            return ('LITERAL', ('scalar(%r)' % token))
    else:
        token = re.sub('\\\\(.)', (lambda m: m.group((m.group(1) in "'\\"))), token)
        return ('LITERAL', ('scalar(%r)' % token))
Tokenizes a string.
def _string(self, quote, token):
    
    if (quote == '"'):
        if re.search('[$\\\\]', token):
            token = re.sub('\\\\([\\\\"])', '\\1', token)
            token = re.sub('\\\\([^$nrt])', '\\1', token)
            token = re.sub('\\\\([nrt])', (lambda m: ESCAPE[m.group(1)]), token)
            return ((['"', '"'] + self.interpolate_text(token)) + ['"', '"'])
        else:
            return ('LITERAL', ('scalar(%r)' % token))
    else:
        token = re.sub('\\\\(.)', (lambda m: m.group((m.group(1) in "'\\"))), token)
        return ('LITERAL', ('scalar(%r)' % token))