@@ -1577,25 +1577,14 @@ _[COMMENT_START_STATE] = function commentStartState(cp) {
1577
1577
if ( cp === $ . HYPHEN_MINUS )
1578
1578
this . state = COMMENT_START_DASH_STATE ;
1579
1579
1580
- else if ( cp === $ . NULL ) {
1581
- this . currentToken . data += UNICODE . REPLACEMENT_CHARACTER ;
1582
- this . state = COMMENT_STATE ;
1583
- }
1584
-
1585
1580
else if ( cp === $ . GREATER_THAN_SIGN ) {
1581
+ this . _err ( ERR . abruptComment ) ;
1586
1582
this . state = DATA_STATE ;
1587
1583
this . _emitCurrentToken ( ) ;
1588
1584
}
1589
1585
1590
- else if ( cp === $ . EOF ) {
1591
- this . _emitCurrentToken ( ) ;
1592
- this . _emitEOFToken ( ) ;
1593
- }
1594
-
1595
- else {
1596
- this . currentToken . data += toChar ( cp ) ;
1597
- this . state = COMMENT_STATE ;
1598
- }
1586
+ else
1587
+ this . _reconsumeInState ( COMMENT_STATE ) ;
1599
1588
} ;
1600
1589
1601
1590
@@ -1605,12 +1594,6 @@ _[COMMENT_START_DASH_STATE] = function commentStartDashState(cp) {
1605
1594
if ( cp === $ . HYPHEN_MINUS )
1606
1595
this . state = COMMENT_END_STATE ;
1607
1596
1608
- else if ( cp === $ . NULL ) {
1609
- this . currentToken . data += '-' ;
1610
- this . currentToken . data += UNICODE . REPLACEMENT_CHARACTER ;
1611
- this . state = COMMENT_STATE ;
1612
- }
1613
-
1614
1597
else if ( cp === $ . GREATER_THAN_SIGN ) {
1615
1598
this . state = DATA_STATE ;
1616
1599
this . _emitCurrentToken ( ) ;
@@ -1623,8 +1606,7 @@ _[COMMENT_START_DASH_STATE] = function commentStartDashState(cp) {
1623
1606
1624
1607
else {
1625
1608
this . currentToken . data += '-' ;
1626
- this . currentToken . data += toChar ( cp ) ;
1627
- this . state = COMMENT_STATE ;
1609
+ this . _reconsumeInState ( COMMENT_STATE ) ;
1628
1610
}
1629
1611
} ;
1630
1612
@@ -1707,21 +1689,14 @@ _[COMMENT_END_DASH_STATE] = function commentEndDashState(cp) {
1707
1689
if ( cp === $ . HYPHEN_MINUS )
1708
1690
this . state = COMMENT_END_STATE ;
1709
1691
1710
- else if ( cp === $ . NULL ) {
1711
- this . currentToken . data += '-' ;
1712
- this . currentToken . data += UNICODE . REPLACEMENT_CHARACTER ;
1713
- this . state = COMMENT_STATE ;
1714
- }
1715
-
1716
1692
else if ( cp === $ . EOF ) {
1717
1693
this . _emitCurrentToken ( ) ;
1718
1694
this . _emitEOFToken ( ) ;
1719
1695
}
1720
1696
1721
1697
else {
1722
1698
this . currentToken . data += '-' ;
1723
- this . currentToken . data += toChar ( cp ) ;
1724
- this . state = COMMENT_STATE ;
1699
+ this . _reconsumeInState ( COMMENT_STATE ) ;
1725
1700
}
1726
1701
} ;
1727
1702
@@ -1740,21 +1715,14 @@ _[COMMENT_END_STATE] = function commentEndState(cp) {
1740
1715
else if ( cp === $ . HYPHEN_MINUS )
1741
1716
this . currentToken . data += '-' ;
1742
1717
1743
- else if ( cp === $ . NULL ) {
1744
- this . currentToken . data += '--' ;
1745
- this . currentToken . data += UNICODE . REPLACEMENT_CHARACTER ;
1746
- this . state = COMMENT_STATE ;
1747
- }
1748
-
1749
1718
else if ( cp === $ . EOF ) {
1750
1719
this . _emitCurrentToken ( ) ;
1751
1720
this . _emitEOFToken ( ) ;
1752
1721
}
1753
1722
1754
1723
else {
1755
1724
this . currentToken . data += '--' ;
1756
- this . currentToken . data += toChar ( cp ) ;
1757
- this . state = COMMENT_STATE ;
1725
+ this . _reconsumeInState ( COMMENT_STATE ) ;
1758
1726
}
1759
1727
} ;
1760
1728
@@ -1772,21 +1740,14 @@ _[COMMENT_END_BANG_STATE] = function commentEndBangState(cp) {
1772
1740
this . _emitCurrentToken ( ) ;
1773
1741
}
1774
1742
1775
- else if ( cp === $ . NULL ) {
1776
- this . currentToken . data += '--!' ;
1777
- this . currentToken . data += UNICODE . REPLACEMENT_CHARACTER ;
1778
- this . state = COMMENT_STATE ;
1779
- }
1780
-
1781
1743
else if ( cp === $ . EOF ) {
1782
1744
this . _emitCurrentToken ( ) ;
1783
1745
this . _emitEOFToken ( ) ;
1784
1746
}
1785
1747
1786
1748
else {
1787
1749
this . currentToken . data += '--!' ;
1788
- this . currentToken . data += toChar ( cp ) ;
1789
- this . state = COMMENT_STATE ;
1750
+ this . _reconsumeInState ( COMMENT_STATE ) ;
1790
1751
}
1791
1752
} ;
1792
1753
0 commit comments