@@ -1190,31 +1190,28 @@ namespace Sass {
1190
1190
1191
1191
Expression* Parser::parse_term ()
1192
1192
{
1193
- Expression* fact1 = parse_factor ();
1194
-
1193
+ Expression* factor = parse_factor ();
1195
1194
// Special case: Ruby sass never tries to modulo if the lhs contains an interpolant
1196
- if (peek < exactly<' %' > >(position) && fact1 ->concrete_type () == Expression::STRING) {
1197
- String_Schema* ss = dynamic_cast <String_Schema*>(fact1 );
1198
- if (ss && ss->has_interpolants ()) return fact1 ;
1195
+ if (peek_css < exactly<' %' > >(position) && factor ->concrete_type () == Expression::STRING) {
1196
+ String_Schema* ss = dynamic_cast <String_Schema*>(factor );
1197
+ if (ss && ss->has_interpolants ()) return factor ;
1199
1198
}
1200
-
1201
1199
// if it's a singleton, return it directly; don't wrap it
1202
- if (!(peek< exactly<' *' > >(position) ||
1203
- peek< exactly<' /' > >(position) ||
1204
- peek< exactly<' %' > >(position)))
1205
- { return fact1; }
1206
-
1207
- while (lex< block_comment >());
1208
- vector<Expression*> operands;
1209
- vector<Binary_Expression::Type> operators;
1210
- while (lex< exactly<' *' > >() || lex< exactly<' /' > >() || lex< exactly<' %' > >()) {
1211
- if (lexed.to_string () == " *" ) operators.push_back (Binary_Expression::MUL);
1212
- else if (lexed.to_string () == " /" ) operators.push_back (Binary_Expression::DIV);
1213
- else operators.push_back (Binary_Expression::MOD);
1200
+ if (!peek< class_char< static_ops > >(position)) return factor;
1201
+ // parse more factors and operators
1202
+ vector<Expression*> operands; // factors
1203
+ vector<Binary_Expression::Type> operators; // ops
1204
+ while (lex_css< class_char< static_ops > >()) {
1205
+ switch (*lexed.begin ) {
1206
+ case ' *' : operators.push_back (Binary_Expression::MUL); break ;
1207
+ case ' /' : operators.push_back (Binary_Expression::DIV); break ;
1208
+ case ' %' : operators.push_back (Binary_Expression::MOD); break ;
1209
+ default : throw runtime_error (" unknown static op parsed" ); break ;
1210
+ }
1214
1211
operands.push_back (parse_factor ());
1215
1212
}
1216
-
1217
- return fold_operands (fact1 , operands, operators);
1213
+ // operands and operators to binary expression
1214
+ return fold_operands (factor , operands, operators);
1218
1215
}
1219
1216
1220
1217
Expression* Parser::parse_factor ()
0 commit comments