From e91cb75dccf6a78ba00c8d095535b3067ecaa949 Mon Sep 17 00:00:00 2001 From: Ilmir Usmanov Date: Fri, 10 Oct 2014 17:14:48 +0400 Subject: [PATCH] Fix locus of strings --- src/libjsparser/lexer.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libjsparser/lexer.c b/src/libjsparser/lexer.c index 1f98db206..512fd1cb3 100644 --- a/src/libjsparser/lexer.c +++ b/src/libjsparser/lexer.c @@ -346,7 +346,20 @@ convert_current_token_to_token (token_type tt) { if (current_token_equals_to_lp (STACK_ELEMENT (strings, i))) { - return create_token (tt, i); + if (tt == TOK_STRING) + { + // locus must point to the first '"' + return (token) + { + .type = tt, + .loc = current_locus () - 1, + .uid = i + }; + } + else + { + return create_token (tt, i); + } } }