Commit a419e50
committed
fix: parse "/*/" as an unclosed comment
The comment branch searches for the closing "*/" with
value.indexOf("*/", pos), starting at the same index as the opening
"/*". For the input "/*/" that search matches the "*" of the opening
delimiter plus the following "/", so the parser reports a closed empty
comment and never sets the unclosed flag. On stringify it then emits
"/**/", so the round trip is not lossless.
"/*/" is an unterminated comment, which postcss core also reports as an
unclosed comment. The parser already handles this for other inputs such
as "/*x"; only the slash right after the opener slipped through. Start
the closing search at pos + 2 so the opening "/*" cannot be matched as
its own terminator.1 parent 898fdfe commit a419e50
2 files changed
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1553 | 1553 | | |
1554 | 1554 | | |
1555 | 1555 | | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
1556 | 1569 | | |
1557 | 1570 | | |
1558 | 1571 | | |
| |||
0 commit comments