diff options
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index f9115181d1..14ac0fb916 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -226,6 +226,16 @@ static uint8_t parse_char_literal(ParseContext *pc, Token *token) { static void parse_string_literal(ParseContext *pc, Token *token, Buf *buf, bool *out_c_str, ZigList<SrcPos> *offset_map) { + if (token->raw_string_start > 0) { + uint8_t c1 = *((uint8_t*)buf_ptr(pc->buf) + token->start_pos); + uint8_t c2 = *((uint8_t*)buf_ptr(pc->buf) + token->start_pos + 1); + assert(c1 == 'r'); + *out_c_str = (c2 == 'c'); + const char *str = buf_ptr(pc->buf) + token->raw_string_start; + buf_init_from_mem(buf, str, token->raw_string_end - token->raw_string_start); + return; + } + // skip the double quotes at beginning and end // convert escape sequences // detect c string literal |
