@@ -1362,6 +1362,14 @@ public function parse() {
1362
1362
));
1363
1363
$ this ->token ['data ' ] .= '- ' ;
1364
1364
1365
+ } elseif ($ char === "\t" || $ char === "\n" || $ char === "\x0a" || $ char === ' ' ) {
1366
+ $ this ->emitToken (array (
1367
+ 'type ' => self ::PARSEERROR ,
1368
+ 'data ' => 'unexpected-space-after-double-dash-in-comment '
1369
+ ));
1370
+ $ this ->token ['data ' ] .= '-- ' . $ char ;
1371
+ $ state = 'comment end space ' ;
1372
+
1365
1373
} elseif ($ char === '! ' ) {
1366
1374
$ this ->emitToken (array (
1367
1375
'type ' => self ::PARSEERROR ,
@@ -1421,6 +1429,33 @@ public function parse() {
1421
1429
}
1422
1430
break ;
1423
1431
1432
+ case 'comment end space ' :
1433
+ $ char = $ this ->stream ->char ();
1434
+ if ($ char === '> ' ) {
1435
+ $ this ->emitToken ($ this ->token );
1436
+ $ state = 'data ' ;
1437
+ } elseif ($ char === '- ' ) {
1438
+ $ state = 'comment end dash ' ;
1439
+ } elseif ($ char === "\t" || $ char === "\n" || $ char === "\x0c" || $ char === ' ' ) {
1440
+ $ this ->emitToken (array (
1441
+ 'type ' => self ::PARSEERROR ,
1442
+ 'data ' => 'unexpected-space-in-comment-end-space ' ,
1443
+ ));
1444
+ $ this ->token ['data ' ] .= $ char ;
1445
+ } elseif ($ char === false ) {
1446
+ $ this ->emitToken (array (
1447
+ 'type ' => self ::PARSEERROR ,
1448
+
8000
'data ' => 'unexpected-eof-in-comment-end-space ' ,
1449
+ ));
1450
+ $ this ->emitToken ($ this ->token );
1451
+ $ this ->stream ->unget ();
1452
+ $ state = 'data ' ;
1453
+ } else {
1454
+ $ this ->token ['data ' ] .= $ char ;
1455
+ $ state = 'comment ' ;
1456
+ }
1457
+ break ;
1458
+
1424
1459
case 'DOCTYPE ' :
1425
1460
/* Consume the next input character: */
1426
1461
$ char = $ this ->stream ->char ();
0 commit comments