// Parse line, obeying quoted strings.
        var words []string
        line = line[len("//go:generate ") : len(line)-1] // Drop preamble and final newline.
+       // There may still be a carriage return.
+       if len(line) > 0 && line[len(line)-1] == '\r' {
+               line = line[:len(line)-1]
+       }
        // One (possibly quoted) word per iteration.
 Words:
        for {
 
        }
        g.setShorthand([]string{"-command", "yacc", "go", "tool", "yacc"})
        for _, test := range splitTests {
+               // First with newlines.
                got := g.split("//go:generate " + test.in + "\n")
                if !reflect.DeepEqual(got, test.out) {
                        t.Errorf("split(%q): got %q expected %q", test.in, got, test.out)
                }
+               // Then with CRLFs, thank you Windows.
+               got = g.split("//go:generate " + test.in + "\r\n")
+               if !reflect.DeepEqual(got, test.out) {
+                       t.Errorf("split(%q): got %q expected %q", test.in, got, test.out)
+               }
        }
 }