Skip to content

Commit 3cf31ef

Browse files
committed
Merge pull request #1184 from mgreter/bugfix/issue_948
Fix `String_Schema` and `Binary_Expression` parsing
2 parents 5a089a0 + b9880e8 commit 3cf31ef

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

parser.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1246,6 +1246,11 @@ namespace Sass {
12461246
}
12471247
// if it's a singleton, return it directly; don't wrap it
12481248
if (!peek< class_char< static_ops > >(position)) return factor;
1249+
return parse_operators(factor);
1250+
}
1251+
1252+
Expression* Parser::parse_operators(Expression* factor)
1253+
{
12491254
// parse more factors and operators
12501255
vector<Expression*> operands; // factors
12511256
vector<Binary_Expression::Type> operators; // ops
@@ -1549,7 +1554,12 @@ namespace Sass {
15491554
(*schema) << new (ctx.mem) Textual(pstate, Textual::DIMENSION, lexed);
15501555
}
15511556
else if (lex< number >()) {
1552-
(*schema) << new (ctx.mem) Textual(pstate, Textual::NUMBER, lexed);
1557+
Expression* factor = new (ctx.mem) Textual(pstate, Textual::NUMBER, lexed);
1558+
if (peek< class_char< static_ops > >()) {
1559+
(*schema) << parse_operators(factor);
1560+
} else {
1561+
(*schema) << factor;
1562+
}
15531563
}
15541564
else if (lex< hex >()) {
15551565
(*schema) << new (ctx.mem) Textual(pstate, Textual::HEX, unquote(lexed));

parser.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ namespace Sass {
243243
String* parse_ie_property();
244244
String* parse_ie_keyword_arg();
245245
String_Schema* parse_value_schema(const char* stop);
246+
Expression* parse_operators(Expression* factor);
246247
String* parse_identifier_schema();
247248
// String_Schema* parse_url_schema();
248249
If* parse_if_directive(bool else_if = false);

0 commit comments

Comments
 (0)