Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit e8ec15c

Browse files
committed
Merge branch 'master' of git://github.com/hcatlin/libsass into python
2 parents 3e838d3 + af133f6 commit e8ec15c

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

document_parser.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,11 +870,13 @@ namespace Sass {
870870
result << parse_string();
871871
result.should_eval() = true;
872872
}
873-
else if (lex< url_schema >()) {
873+
else if (peek< sequence< url_schema, spaces_and_comments, exactly<')'> > >()) {
874+
lex< url_schema >();
874875
result << Document::make_from_token(context, lexed, path, line).parse_url_schema();
875876
result.should_eval() = true;
876877
}
877-
else if (lex< url_value >()) {
878+
else if (peek< sequence< url_value, spaces_and_comments, exactly<')'> > >()) {
879+
lex< url_value >();
878880
result << context.new_Node(Node::identifier, path, line, lexed);
879881
}
880882
else {

eval_apply.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace Sass {
5757

5858
case Node::ruleset: {
5959
// if the selector contains interpolants, eval it and re-parse
60-
if (expr[0].type() == Node::selector_schema) {
60+
if (!expr[0].is_null() && expr[0].type() == Node::selector_schema) {
6161
Node schema(expr[0]);
6262
string expansion;
6363
for (size_t i = 0, S = schema.size(); i < S; ++i) {
@@ -987,7 +987,7 @@ namespace Sass {
987987
// combine the various kinds of selectors.
988988
Node expand_selector(Node sel, Node pre, Node_Factory& new_Node)
989989
{
990-
if (pre.is_null()) return sel;
990+
if (pre.is_null() || sel.is_null()) return sel;
991991

992992
if (sel.has_backref()) {
993993
if ((pre.type() == Node::selector_group) && (sel.type() == Node::selector_group)) {

node.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ namespace Sass {
349349
{
350350
children.push_back(n);
351351
has_children = true;
352+
if (n.is_null()) return;
352353
switch (n.type())
353354
{
354355
case Node::comment:

prelexer.cpp

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,5 +383,32 @@ namespace Sass {
383383
const char* folders(const char* src) {
384384
return zero_plus< folder >(src);
385385
}
386+
387+
const char* chunk(const char* src) {
388+
char inside_str = 0;
389+
const char* p = src;
390+
size_t depth = 0;
391+
while (true) {
392+
if (!*p) {
393+
return 0;
394+
}
395+
else if (!inside_str && (*p == '"' || *p == '\'')) {
396+
inside_str = *p;
397+
}
398+
else if (*p == inside_str && *(p-1) != '\\') {
399+
inside_str = 0;
400+
}
401+
else if (*p == '(' && !inside_str) {
402+
++depth;
403+
}
404+
else if (*p == ')' && !inside_str) {
405+
if (depth == 0) return p;
406+
else --depth;
407+
}
408+
++p;
409+
}
410+
// unreachable
411+
return 0;
412+
}
386413
}
387414
}

prelexer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,5 +447,7 @@ namespace Sass {
447447
}
448448
return counter;
449449
}
450+
451+
const char* chunk(const char* src);
450452
}
451453
}

0 commit comments

Comments
 (0)