]> Cypherpunks repositories - gostls13.git/commitdiff
gc: make 'invalid rune in string' a little less cryptic
authorRuss Cox <rsc@golang.org>
Thu, 3 Dec 2009 07:23:11 +0000 (23:23 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 3 Dec 2009 07:23:11 +0000 (23:23 -0800)
Fixes #371.

R=ken2
https://golang.org/cl/164091

src/cmd/gc/lex.c

index f858aa95ec9559727761800c9db2ff916dca5507..c202f3ecdca3453150f5b9d125ac63e64d5a4bfa 100644 (file)
@@ -1065,7 +1065,9 @@ loop:
                goto loop;
        c = chartorune(&rune, str);
        if(rune == Runeerror && c == 1) {
-               yyerror("illegal rune in string");
+               lineno = lexlineno;
+               yyerror("illegal UTF-8 sequence in comment or string");
+               flusherrors();
                for(c=0; c<i; c++)
                        print(" %.2x", *(uchar*)(str+c));
                print("\n");