Skip to content

Commit

Permalink
Fix String_Schema and Binary_Expression parsing
Browse files Browse the repository at this point in the history
Fixes sass#948
  • Loading branch information
mgreter committed May 9, 2015
1 parent f802410 commit d313b88
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,11 @@ namespace Sass {
}
// if it's a singleton, return it directly; don't wrap it
if (!peek< class_char< static_ops > >(position)) return factor;
return parse_operators(factor);
}

Expression* Parser::parse_operators(Expression* factor)
{
// parse more factors and operators
vector<Expression*> operands; // factors
vector<Binary_Expression::Type> operators; // ops
Expand Down Expand Up @@ -1522,7 +1527,12 @@ namespace Sass {
(*schema) << new (ctx.mem) Textual(pstate, Textual::DIMENSION, lexed);
}
else if (lex< number >()) {
(*schema) << new (ctx.mem) Textual(pstate, Textual::NUMBER, lexed);
Expression* factor = new (ctx.mem) Textual(pstate, Textual::NUMBER, lexed);
if (peek< class_char< static_ops > >()) {
(*schema) << parse_operators(factor);
} else {
(*schema) << factor;
}
}
else if (lex< hex >()) {
(*schema) << new (ctx.mem) Textual(pstate, Textual::HEX, unquote(lexed));
Expand Down
1 change: 1 addition & 0 deletions parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ namespace Sass {
String* parse_ie_property();
String* parse_ie_keyword_arg();
String_Schema* parse_value_schema(const char* stop);
Expression* parse_operators(Expression* factor);
String* parse_identifier_schema();
// String_Schema* parse_url_schema();
If* parse_if_directive(bool else_if = false);
Expand Down

0 comments on commit d313b88

Please sign in to comment.