Skip to content

Commit

Permalink
Merge pull request #779 from mgreter/fix/string-in-interpolates
Browse files Browse the repository at this point in the history
Fix String_Const unquoting in interpolates
  • Loading branch information
mgreter committed Dec 27, 2014
2 parents aaf7db7 + d349d81 commit 5483186
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion inspect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ namespace Sass {
p.source = t.begin;
p.position = p.source;
p.end = t.end;
p.dequote = true;
return p;
}

Expand Down Expand Up @@ -1209,7 +1210,7 @@ namespace Sass {
// see if there any interpolants
const char* p = find_first_in_interval< sequence< negate< exactly<'\\'> >, exactly<hash_lbrace> > >(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;
}
Expand Down
3 changes: 2 additions & 1 deletion parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ namespace Sass {


Token lexed;
bool dequote;

Parser(Context& ctx, string path, Position source_position)
: ctx(ctx), stack(vector<Syntactic_Context>()),
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());
Expand Down

0 comments on commit 5483186

Please sign in to comment.