This repository was archived by the owner on Oct 24, 2025. It is now read-only.
Commit 0d5277c
Change the parser to recognize bracketed lists.
This is the idea: in the same way the old parser looks for parenthesis
delimiters, let's add another case for brackets delimiters.
In case an open bracket is found, the parser will look for a list. There
are three possible results of parsing a list:
First, the parsed expression is not a list at all. libsass parser tends
to avoid wrapping if lists are only one item lists. But bracketed lists
prevent unwrapping so the item becomes the solely item for a new
bracketed list.
Example:
singleton-item --> [ singleton-item ]
Second, the list is indeed a list with some explicit delimiter. This
case is similar to the previous one. Brackets prevent unwrapping so this
time is the list as a whole which become the unique item of the
bracketed list.
Example:
(item1, item2, ...) --> [ (item1, item2, ...) ]
[item1, item2, ...] --> [ [item1, item2, ...] ]
Third, the list is a list with no delimiters. So its items actually
belong to the bracketed list. The parse will fix the delimiter of the
list for them to be brackets.
Example:
Suppose | ... | stands for a list with no delimiters.
|item1, item2, ...| --> [item1, item2, ...]1 parent c2e1e70 commit 0d5277c
1 file changed
+27
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
966 | 966 | | |
967 | 967 | | |
968 | 968 | | |
969 | | - | |
| 969 | + | |
970 | 970 | | |
971 | 971 | | |
972 | 972 | | |
| |||
1000 | 1000 | | |
1001 | 1001 | | |
1002 | 1002 | | |
1003 | | - | |
1004 | | - | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
1005 | 1010 | | |
1006 | 1011 | | |
1007 | 1012 | | |
| |||
1051 | 1056 | | |
1052 | 1057 | | |
1053 | 1058 | | |
| 1059 | + | |
1054 | 1060 | | |
1055 | 1061 | | |
1056 | 1062 | | |
| |||
1085 | 1091 | | |
1086 | 1092 | | |
1087 | 1093 | | |
| 1094 | + | |
1088 | 1095 | | |
1089 | 1096 | | |
1090 | 1097 | | |
| |||
1111 | 1118 | | |
1112 | 1119 | | |
1113 | 1120 | | |
| 1121 | + | |
1114 | 1122 | | |
1115 | 1123 | | |
1116 | 1124 | | |
| |||
1129 | 1137 | | |
1130 | 1138 | | |
1131 | 1139 | | |
| 1140 | + | |
1132 | 1141 | | |
1133 | 1142 | | |
1134 | 1143 | | |
| |||
1328 | 1337 | | |
1329 | 1338 | | |
1330 | 1339 | | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
1331 | 1355 | | |
1332 | 1356 | | |
1333 | 1357 | | |
| |||
0 commit comments