Pass tests2.dat, test 57:
<!DOCTYPE html><!--x--
| <!DOCTYPE html>
| <!-- x -->
| <html>
|   <head>
|   <body>
Also pass test 58:
<!DOCTYPE html><table><tr><td></p></table>
R=nigeltao
CC=golang-dev
https://golang.org/cl/
5436048
 
        }{
                // TODO(nigeltao): Process all the test cases from all the .dat files.
                {"tests1.dat", -1},
-               {"tests2.dat", 57},
+               {"tests2.dat", 59},
                {"tests3.dat", 0},
        }
        for _, tf := range testFiles {
 
        for dashCount := 2; ; {
                c := z.readByte()
                if z.err != nil {
-                       z.data.end = z.raw.end
+                       // Ignore up to two dashes at EOF.
+                       if dashCount > 2 {
+                               dashCount = 2
+                       }
+                       z.data.end = z.raw.end - dashCount
                        return
                }
                switch c {
 
        },
        {
                "comment9",
+               "a<!--z-",
+               "a$<!--z-->",
+       },
+       {
+               "comment10",
+               "a<!--z--",
+               "a$<!--z-->",
+       },
+       {
+               "comment11",
+               "a<!--z---",
+               "a$<!--z--->",
+       },
+       {
+               "comment12",
+               "a<!--z----",
+               "a$<!--z---->",
+       },
+       {
+               "comment13",
                "a<!--x--!>z",
                "a$<!--x-->$z",
        },