@@ -1048,8 +1048,13 @@ namespace Sass {
10481048 List_Obj map = SASS_MEMORY_NEW (List, pstate, 0 , SASS_HASH);
10491049
10501050 // it's not a map so return the lexed value as a list value
1051- if (!lex_css< exactly<' :' > >())
1052- { return key; }
1051+ if (!lex_css< exactly<' :' > >()) {
1052+ List_Obj list = SASS_MEMORY_CAST (List, key);
1053+ if (list && list->delimiter () == SASS_NO_DELIMITER) {
1054+ list->delimiter (SASS_PARENTHESIS);
1055+ }
1056+ return key;
1057+ }
10531058
10541059 Expression_Obj value = parse_space_list ();
10551060
@@ -1080,49 +1085,6 @@ namespace Sass {
10801085 return map;
10811086 }
10821087
1083- Expression_Obj Parser::parse_bracket_list ()
1084- {
1085- // check if we have an empty list
1086- // return the empty list as such
1087- if (peek_css< list_terminator >(position))
1088- {
1089- // return an empty list (nothing to delay)
1090- return SASS_MEMORY_NEW (List, pstate, 0 , SASS_SPACE, false , true );
1091- }
1092-
1093- bool has_paren = peek_css< exactly<' (' > >() != NULL ;
1094-
1095- // now try to parse a space list
1096- Expression_Obj list = parse_space_list ();
1097- // if it's a singleton, return it (don't wrap it)
1098- if (!peek_css< exactly<' ,' > >(position)) {
1099- List_Obj l = Cast<List>(list);
1100- if (!l || l->is_bracketed () || has_paren) {
1101- List_Obj bracketed_list = SASS_MEMORY_NEW (List, pstate, 1 , SASS_SPACE, false , true );
1102- bracketed_list->append (list);
1103- return bracketed_list;
1104- }
1105- l->is_bracketed (true );
1106- return l;
1107- }
1108-
1109- // if we got so far, we actually do have a comma list
1110- List_Obj bracketed_list = SASS_MEMORY_NEW (List, pstate, 2 , SASS_COMMA, false , true );
1111- // wrap the first expression
1112- bracketed_list->append (list);
1113-
1114- while (lex_css< exactly<' ,' > >())
1115- {
1116- // check for abort condition
1117- if (peek_css< list_terminator >(position)
1118- ) { break ; }
1119- // otherwise add another expression
1120- bracketed_list->append (parse_space_list ());
1121- }
1122- // return the list
1123- return bracketed_list;
1124- }
1125-
11261088 // parse list returns either a space separated list,
11271089 // a comma separated list or any bare expression found.
11281090 // so to speak: we unwrap items from lists if possible here!
@@ -1136,7 +1098,19 @@ namespace Sass {
11361098 {
11371099 // check if we have an empty list
11381100 // return the empty list as such
1139- if (peek_css< list_terminator >(position))
1101+ if (peek_css< alternatives <
1102+ // exactly<'!'>,
1103+ exactly<' ;' >,
1104+ exactly<' }' >,
1105+ exactly<' {' >,
1106+ exactly<' )' >,
1107+ exactly<' ]' >,
1108+ exactly<' :' >,
1109+ end_of_file,
1110+ exactly<ellipsis>,
1111+ default_flag,
1112+ global_flag
1113+ > >(position))
11401114 {
11411115 // return an empty list (nothing to delay)
11421116 return SASS_MEMORY_NEW (List, pstate, 0 );
@@ -1160,7 +1134,18 @@ namespace Sass {
11601134 while (lex_css< exactly<' ,' > >())
11611135 {
11621136 // check for abort condition
1163- if (peek_css< list_terminator >(position)
1137+ if (peek_css< alternatives <
1138+ exactly<' ;' >,
1139+ exactly<' }' >,
1140+ exactly<' {' >,
1141+ exactly<' )' >,
1142+ exactly<' ]' >,
1143+ exactly<' :' >,
1144+ end_of_file,
1145+ exactly<ellipsis>,
1146+ default_flag,
1147+ global_flag
1148+ > >(position)
11641149 ) { break ; }
11651150 // otherwise add another expression
11661151 comma_list->append (parse_space_list ());
@@ -1175,16 +1160,39 @@ namespace Sass {
11751160 {
11761161 Expression_Obj disj1 = parse_disjunction ();
11771162 // if it's a singleton, return it (don't wrap it)
1178- if (peek_css< space_list_terminator >(position)
1179- ) {
1180- return disj1; }
1163+ if (peek_css< alternatives <
1164+ // exactly<'!'>,
1165+ exactly<' ;' >,
1166+ exactly<' }' >,
1167+ exactly<' {' >,
1168+ exactly<' )' >,
1169+ exactly<' ]' >,
1170+ exactly<' ,' >,
1171+ exactly<' :' >,
1172+ end_of_file,
1173+ exactly<ellipsis>,
1174+ default_flag,
1175+ global_flag
1176+ > >(position)
1177+ ) { return disj1; }
11811178
11821179 List_Obj space_list = SASS_MEMORY_NEW (List, pstate, 2 , SASS_SPACE);
11831180 space_list->append (disj1);
11841181
1185- while (
1186- !(peek_css< space_list_terminator >(position)) &&
1187- peek_css< optional_css_whitespace >() != end
1182+ while (!(peek_css< alternatives <
1183+ // exactly<'!'>,
1184+ exactly<' ;' >,
1185+ exactly<' }' >,
1186+ exactly<' {' >,
1187+ exactly<' )' >,
1188+ exactly<' ]' >,
1189+ exactly<' ,' >,
1190+ exactly<' :' >,
1191+ end_of_file,
1192+ exactly<ellipsis>,
1193+ default_flag,
1194+ global_flag
1195+ > >(position)) && peek_css< optional_css_whitespace >() != end
11881196 ) {
11891197 // the space is parsed implicitly?
11901198 space_list->append (parse_disjunction ());
@@ -1378,9 +1386,20 @@ namespace Sass {
13781386 }
13791387 else if (lex_css< exactly<' [' > >()) {
13801388 // explicit bracketed
1381- Expression_Obj value = parse_bracket_list ();
1389+ Expression_Obj value = parse_list ();
13821390 // lex the expected closing square bracket
13831391 if (!lex_css< exactly<' ]' > >()) error (" unclosed squared bracket" , pstate);
1392+ <<<<<<< HEAD
1393+ =======
1394+ // fix delimiter
1395+ List_Obj list = SASS_MEMORY_CAST (List, value);
1396+ if (!list || list->delimiter () != SASS_NO_DELIMITER) {
1397+ List_Ptr outer_list = SASS_MEMORY_NEW (List, pstate, 1 , SASS_SPACE, false , SASS_BRACKETS);
1398+ outer_list->append (&value);
1399+ return outer_list;
1400+ }
1401+ list->delimiter (SASS_BRACKETS);
1402+ >>>>>>> parent of 9ab7daa... Merge pull request #2284 from xzyfer/remove-list-delimiter
13841403 return value;
13851404 }
13861405 // string may be interpolated
0 commit comments