@@ -1058,8 +1058,13 @@ namespace Sass {
10581058 List_Obj map = SASS_MEMORY_NEW (List, pstate, 0 , SASS_HASH);
10591059
10601060 // it's not a map so return the lexed value as a list value
1061- if (!lex_css< exactly<' :' > >())
1062- { return key; }
1061+ if (!lex_css< exactly<' :' > >()) {
1062+ List_Obj list = SASS_MEMORY_CAST (List, key);
1063+ if (list && list->delimiter () == SASS_NO_DELIMITER) {
1064+ list->delimiter (SASS_PARENTHESIS);
1065+ }
1066+ return key;
1067+ }
10631068
10641069 Expression_Obj value = parse_space_list ();
10651070
@@ -1090,49 +1095,6 @@ namespace Sass {
10901095 return map;
10911096 }
10921097
1093- Expression_Obj Parser::parse_bracket_list ()
1094- {
1095- // check if we have an empty list
1096- // return the empty list as such
1097- if (peek_css< list_terminator >(position))
1098- {
1099- // return an empty list (nothing to delay)
1100- return SASS_MEMORY_NEW (List, pstate, 0 , SASS_SPACE, false , true );
1101- }
1102-
1103- bool has_paren = peek_css< exactly<' (' > >() != NULL ;
1104-
1105- // now try to parse a space list
1106- Expression_Obj list = parse_space_list ();
1107- // if it's a singleton, return it (don't wrap it)
1108- if (!peek_css< exactly<' ,' > >(position)) {
1109- List_Obj l = Cast<List>(list);
1110- if (!l || l->is_bracketed () || has_paren) {
1111- List_Obj bracketed_list = SASS_MEMORY_NEW (List, pstate, 1 , SASS_SPACE, false , true );
1112- bracketed_list->append (list);
1113- return bracketed_list;
1114- }
1115- l->is_bracketed (true );
1116- return l;
1117- }
1118-
1119- // if we got so far, we actually do have a comma list
1120- List_Obj bracketed_list = SASS_MEMORY_NEW (List, pstate, 2 , SASS_COMMA, false , true );
1121- // wrap the first expression
1122- bracketed_list->append (list);
1123-
1124- while (lex_css< exactly<' ,' > >())
1125- {
1126- // check for abort condition
1127- if (peek_css< list_terminator >(position)
1128- ) { break ; }
1129- // otherwise add another expression
1130- bracketed_list->append (parse_space_list ());
1131- }
1132- // return the list
1133- return bracketed_list;
1134- }
1135-
11361098 // parse list returns either a space separated list,
11371099 // a comma separated list or any bare expression found.
11381100 // so to speak: we unwrap items from lists if possible here!
@@ -1146,7 +1108,19 @@ namespace Sass {
11461108 {
11471109 // check if we have an empty list
11481110 // return the empty list as such
1149- if (peek_css< list_terminator >(position))
1111+ if (peek_css< alternatives <
1112+ // exactly<'!'>,
1113+ exactly<' ;' >,
1114+ exactly<' }' >,
1115+ exactly<' {' >,
1116+ exactly<' )' >,
1117+ exactly<' ]' >,
1118+ exactly<' :' >,
1119+ end_of_file,
1120+ exactly<ellipsis>,
1121+ default_flag,
1122+ global_flag
1123+ > >(position))
11501124 {
11511125 // return an empty list (nothing to delay)
11521126 return SASS_MEMORY_NEW (List, pstate, 0 );
@@ -1170,7 +1144,18 @@ namespace Sass {
11701144 while (lex_css< exactly<' ,' > >())
11711145 {
11721146 // check for abort condition
1173- if (peek_css< list_terminator >(position)
1147+ if (peek_css< alternatives <
1148+ exactly<' ;' >,
1149+ exactly<' }' >,
1150+ exactly<' {' >,
1151+ exactly<' )' >,
1152+ exactly<' ]' >,
1153+ exactly<' :' >,
1154+ end_of_file,
1155+ exactly<ellipsis>,
1156+ default_flag,
1157+ global_flag
1158+ > >(position)
11741159 ) { break ; }
11751160 // otherwise add another expression
11761161 comma_list->append (parse_space_list ());
@@ -1185,16 +1170,39 @@ namespace Sass {
11851170 {
11861171 Expression_Obj disj1 = parse_disjunction ();
11871172 // if it's a singleton, return it (don't wrap it)
1188- if (peek_css< space_list_terminator >(position)
1189- ) {
1190- return disj1; }
1173+ if (peek_css< alternatives <
1174+ // exactly<'!'>,
1175+ exactly<' ;' >,
1176+ exactly<' }' >,
1177+ exactly<' {' >,
1178+ exactly<' )' >,
1179+ exactly<' ]' >,
1180+ exactly<' ,' >,
1181+ exactly<' :' >,
1182+ end_of_file,
1183+ exactly<ellipsis>,
1184+ default_flag,
1185+ global_flag
1186+ > >(position)
1187+ ) { return disj1; }
11911188
11921189 List_Obj space_list = SASS_MEMORY_NEW (List, pstate, 2 , SASS_SPACE);
11931190 space_list->append (disj1);
11941191
1195- while (
1196- !(peek_css< space_list_terminator >(position)) &&
1197- peek_css< optional_css_whitespace >() != end
1192+ while (!(peek_css< alternatives <
1193+ // exactly<'!'>,
1194+ exactly<' ;' >,
1195+ exactly<' }' >,
1196+ exactly<' {' >,
1197+ exactly<' )' >,
1198+ exactly<' ]' >,
1199+ exactly<' ,' >,
1200+ exactly<' :' >,
1201+ end_of_file,
1202+ exactly<ellipsis>,
1203+ default_flag,
1204+ global_flag
1205+ > >(position)) && peek_css< optional_css_whitespace >() != end
11981206 ) {
11991207 // the space is parsed implicitly?
12001208 space_list->append (parse_disjunction ());
@@ -1388,9 +1396,20 @@ namespace Sass {
13881396 }
13891397 else if (lex_css< exactly<' [' > >()) {
13901398 // explicit bracketed
1391- Expression_Obj value = parse_bracket_list ();
1399+ Expression_Obj value = parse_list ();
13921400 // lex the expected closing square bracket
13931401 if (!lex_css< exactly<' ]' > >()) error (" unclosed squared bracket" , pstate);
1402+ <<<<<<< HEAD
1403+ =======
1404+ // fix delimiter
1405+ List_Obj list = SASS_MEMORY_CAST (List, value);
1406+ if (!list || list->delimiter () != SASS_NO_DELIMITER) {
1407+ List_Ptr outer_list = SASS_MEMORY_NEW (List, pstate, 1 , SASS_SPACE, false , SASS_BRACKETS);
1408+ outer_list->append (&value);
1409+ return outer_list;
1410+ }
1411+ list->delimiter (SASS_BRACKETS);
1412+ >>>>>>> parent of 9ab7daa... Merge pull request #2284 from xzyfer/remove-list-delimiter
13941413 return value;
13951414 }
13961415 // string may be interpolated
0 commit comments