@@ -385,27 +385,22 @@ namespace Sass {
385385
386386 Parameters_Obj Parser::parse_parameters ()
387387 {
388+ std::string name (lexed);
389+ Position position = after_token;
388390 Parameters_Obj params = SASS_MEMORY_NEW (Parameters, pstate);
389391 if (lex_css< exactly<' (' > >()) {
390392 // if there's anything there at all
391393 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<' ,' > >());
399396 }
397+ if (!lex_css< exactly<' )' > >()) error (" expected a variable name (e.g. $x) or ')' for the parameter list for " + name, position);
400398 }
401399 return params;
402400 }
403401
404402 Parameter_Obj Parser::parse_parameter ()
405403 {
406- if (peek< alternatives< exactly<' ,' >, exactly< ' {' >, exactly<' ;' > > >()) {
407- css_error (" Invalid CSS" , " after " , " : expected variable (e.g. $foo), was " );
408- }
409404 while (lex< alternatives < spaces, block_comment > >());
410405 lex < variable >();
411406 std::string name (Util::normalize_underscores (lexed));
@@ -425,27 +420,22 @@ namespace Sass {
425420
426421 Arguments_Obj Parser::parse_arguments ()
427422 {
423+ std::string name (lexed);
424+ Position position = after_token;
428425 Arguments_Obj args = SASS_MEMORY_NEW (Arguments, pstate);
429426 if (lex_css< exactly<' (' > >()) {
430427 // if there's anything there at all
431428 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<' ,' > >());
439431 }
432+ if (!lex_css< exactly<' )' > >()) error (" expected a variable name (e.g. $x) or ')' for the parameter list for " + name, position);
440433 }
441434 return args;
442435 }
443436
444437 Argument_Obj Parser::parse_argument ()
445438 {
446- if (peek< alternatives< exactly<' ,' >, exactly< ' {' >, exactly<' ;' > > >()) {
447- css_error (" Invalid CSS" , " after " , " : expected \" )\" , was " );
448- }
449439 if (peek_css< sequence < exactly< hash_lbrace >, exactly< rbrace > > >()) {
450440 position += 2 ;
451441 css_error (" Invalid CSS" , " after " , " : expected expression (e.g. 1px, bold), was " );
0 commit comments