def string_esc_hex_any(state, p): s = p[1].getstr() end = len(s) - 1 assert end >= 0 return ast.StringContent(p[0].get_strparts() + [hex_to_utf8(state, p[0], s[3:end])], srcpos=sr(p))
def string_esc_simple(state, p): part = { 'a': '\a', 'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t', 'v': '\v', '0': '\0', '$': '$', }[p[1].getstr()[1]] return ast.StringContent(p[0].get_strparts() + [part], srcpos=sr(p))
def rawstring_char(state, p): return ast.StringContent(p[0].get_strparts() + [p[1].getstr()], srcpos=sr(p))
def rawstring_empty(state, p): return ast.StringContent([], srcpos=(0, 0))
def string_esc_unrecognised(state, p): return ast.StringContent(p[0].get_strparts() + [p[1].getstr()], srcpos=sr(p))
def string_esc_hex_fixed(state, p): s = p[1].getstr() return ast.StringContent(p[0].get_strparts() + [hex_to_utf8(state, p[0], s[2:])], srcpos=sr(p))
def string_esc_esc(state, p): return ast.StringContent(p[0].get_strparts() + ['\\'], srcpos=sr(p))
def string_esc_quote(state, p): return ast.StringContent(p[0].get_strparts() + [p[1].getstr()[1]], srcpos=sr(p))
def rawstring_empty(state, p): return ast.StringContent([])
def string_char(state, p): return ast.StringContent(p[0].get_strparts() + [p[1].getstr()])