authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-05-18 17:55:07-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-05-18 17:55:07-07:00
logf6b16c99ba44cf1cb6d5ea106093e426e6623443
tree918e20f16f654214bc11dba9e96718f564cd3972
parent3273e99d705cd5bd7d1da86668385bda75a2a3bd

fix raw string literal crash


1 files changed, 3 insertions(+), 1 deletions(-)

src/parser.cpp+3-1
...@@ -262,7 +262,9 @@ static void parse_string_literal(ParseContext *pc, Token *token, Buf *buf, bool...@@ -262,7 +262,9 @@ static void parse_string_literal(ParseContext *pc, Token *token, Buf *buf, bool
262 uint8_t c1 = *((uint8_t*)buf_ptr(pc->buf) + token->start_pos);262 uint8_t c1 = *((uint8_t*)buf_ptr(pc->buf) + token->start_pos);
263 uint8_t c2 = *((uint8_t*)buf_ptr(pc->buf) + token->start_pos + 1);263 uint8_t c2 = *((uint8_t*)buf_ptr(pc->buf) + token->start_pos + 1);
264 assert(c1 == 'r');264 assert(c1 == 'r');
265 *out_c_str = (c2 == 'c');265 if (out_c_str) {
266 *out_c_str = (c2 == 'c');
267 }
266 const char *str = buf_ptr(pc->buf) + token->raw_string_start;268 const char *str = buf_ptr(pc->buf) + token->raw_string_start;
267 buf_init_from_mem(buf, str, token->raw_string_end - token->raw_string_start);269 buf_init_from_mem(buf, str, token->raw_string_end - token->raw_string_start);
268 return;270 return;