From 7021663a18f4670852e039a832073feb3c99ff30 Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Sat, 27 Dec 2014 03:29:03 +0100 Subject: [PATCH 1/2] Add a check to really only remove backslashes --- inspect.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inspect.cpp b/inspect.cpp index f8949f3f3d..e68b1ff1a6 100644 --- a/inspect.cpp +++ b/inspect.cpp @@ -698,7 +698,7 @@ namespace Sass { t.reserve(s.length()-2); for (size_t i = 1, L = s.length()-1; i < L; ++i) { // if we see a quote, we need to remove the preceding backslash from t - if (s[i] == q) t.erase(t.length()-1); + if (s[i-1] == '\\' && s[i] == q) t.erase(t.length()-1); t.push_back(s[i]); } return t; From d349d811062d59a6e5f64c4835887c36fb1de7c6 Mon Sep 17 00:00:00 2001 From: Marcel Greter Date: Sat, 27 Dec 2014 03:53:42 +0100 Subject: [PATCH 2/2] Fix parsing of quoted string in interpolates --- parser.cpp | 3 ++- parser.hpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/parser.cpp b/parser.cpp index 809d19317c..2ab331374d 100644 --- a/parser.cpp +++ b/parser.cpp @@ -35,6 +35,7 @@ namespace Sass { p.source = t.begin; p.position = p.source; p.end = t.end; + p.dequote = true; return p; } @@ -1209,7 +1210,7 @@ namespace Sass { // see if there any interpolants const char* p = find_first_in_interval< sequence< negate< exactly<'\\'> >, exactly > >(chunk.begin, chunk.end); if (!p) { - String_Constant* str_node = new (ctx.mem) String_Constant(path, source_position, chunk); + String_Constant* str_node = new (ctx.mem) String_Constant(path, source_position, chunk, dequote); str_node->is_delayed(true); return str_node; } diff --git a/parser.hpp b/parser.hpp index 1e7860aa57..b0047d0728 100644 --- a/parser.hpp +++ b/parser.hpp @@ -55,11 +55,12 @@ namespace Sass { Token lexed; + bool dequote; Parser(Context& ctx, string path, Position source_position) : ctx(ctx), stack(vector()), source(0), position(0), end(0), path(path), column(1), source_position(source_position) - { stack.push_back(nothing); } + { dequote = false; stack.push_back(nothing); } static Parser from_string(string src, Context& ctx, string path = "", Position source_position = Position()); static Parser from_c_str(const char* src, Context& ctx, string path = "", Position source_position = Position());