(t)
return t
r'(\"([^\\\n]|(\\.))*?\")|\'([^\\\n]|(\\.))*?\
r'(\"([^\\\n]|(\\.))*?\")|\'([^\\\n]|(\\.))*?\
r ( \ ( [ ^ \\\ n ] | ( \\ . )) * ? \ ) | \ ( [ ^ \\\ n ] | ( \\ . )) * ? \
def t_LITERAL(t):
    r'(\"([^\\\n]|(\\.))*?\")|\'([^\\\n]|(\\.))*?\''
    s = t.value[1:-1]
    maps = {
        't': '\t',
        'r': '\r',
        'n': '\n',
        '\\': '\\',
        '\'': '\'',
        '"': '\"'
    }
    i = 0
    length = len(s)
    val = ''
    while i < length:
        if s[i] == '\\':
            i += 1
            if s[i] in maps:
                val += maps[s[i]]
            else:
                msg = 'Unexcepted escaping characher: %s' % s[i]
                raise ThriftLexerError(msg)
        else:
            val += s[i]

        i += 1

    t.value = val
    return t
def t_LITERAL ( t ) : s = t . value [ 1 : - 1 ] maps = { 't' : '\t' , 'r' : '\r' , 'n' : '\n' , '\\' : '\\' , '\'' : '\'' , '"' : '\"' } i = 0 length = len ( s ) val = '' while i < length : if s [ i ] == '\\' : i += 1 if s [ i ] in maps : val += maps [ s [ i ] ] else : msg = 'Unexcepted escaping characher: %s' % s [ i ] raise ThriftLexerError ( msg ) else : val += s [ i ] i += 1 t . value = val return t