@@ -385,27 +385,22 @@ namespace Sass {
385
385
386
386
Parameters_Obj Parser::parse_parameters ()
387
387
{
388
+ std::string name (lexed);
389
+ Position position = after_token;
388
390
Parameters_Obj params = SASS_MEMORY_NEW (Parameters, pstate);
389
391
if (lex_css< exactly<' (' > >()) {
390
392
// if there's anything there at all
391
393
if (!peek_css< exactly<' )' > >()) {
392
- do {
393
- if (peek< exactly<' )' > >()) break ;
394
- params->append (parse_parameter ());
395
- } while (lex_css< exactly<' ,' > >());
396
- }
397
- if (!lex_css< exactly<' )' > >()) {
398
- css_error (" Invalid CSS" , " after " , " : expected \" )\" , was " );
394
+ do params->append (parse_parameter ());
395
+ while (lex_css< exactly<' ,' > >());
399
396
}
397
+ if (!lex_css< exactly<' )' > >()) error (" expected a variable name (e.g. $x) or ')' for the parameter list for " + name, position);
400
398
}
401
399
return params;
402
400
}
403
401
404
402
Parameter_Obj Parser::parse_parameter ()
405
403
{
406
- if (peek< alternatives< exactly<' ,' >, exactly< ' {' >, exactly<' ;' > > >()) {
407
- css_error (" Invalid CSS" , " after " , " : expected variable (e.g. $foo), was " );
408
- }
409
404
while (lex< alternatives < spaces, block_comment > >());
410
405
lex < variable >();
411
406
std::string name (Util::normalize_underscores (lexed));
@@ -425,27 +420,22 @@ namespace Sass {
425
420
426
421
Arguments_Obj Parser::parse_arguments ()
427
422
{
423
+ std::string name (lexed);
424
+ Position position = after_token;
428
425
Arguments_Obj args = SASS_MEMORY_NEW (Arguments, pstate);
429
426
if (lex_css< exactly<' (' > >()) {
430
427
// if there's anything there at all
431
428
if (!peek_css< exactly<' )' > >()) {
432
- do {
433
- if (peek< exactly<' )' > >()) break ;
434
- args->append (parse_argument ());
435
- } while (lex_css< exactly<' ,' > >());
436
- }
437
- if (!lex_css< exactly<' )' > >()) {
438
- css_error (" Invalid CSS" , " after " , " : expected expression (e.g. 1px, bold), was " );
429
+ do args->append (parse_argument ());
430
+ while (lex_css< exactly<' ,' > >());
439
431
}
432
+ if (!lex_css< exactly<' )' > >()) error (" expected a variable name (e.g. $x) or ')' for the parameter list for " + name, position);
440
433
}
441
434
return args;
442
435
}
443
436
444
437
Argument_Obj Parser::parse_argument ()
445
438
{
446
- if (peek< alternatives< exactly<' ,' >, exactly< ' {' >, exactly<' ;' > > >()) {
447
- css_error (" Invalid CSS" , " after " , " : expected \" )\" , was " );
448
- }
449
439
if (peek_css< sequence < exactly< hash_lbrace >, exactly< rbrace > > >()) {
450
440
position += 2 ;
451
441
css_error (" Invalid CSS" , " after " , " : expected expression (e.g. 1px, bold), was " );
0 commit comments