]> Cypherpunks repositories - gostls13.git/commitdiff
gc: improve error message for x \= 0
authorRuss Cox <rsc@golang.org>
Fri, 24 Sep 2010 21:09:31 +0000 (17:09 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 24 Sep 2010 21:09:31 +0000 (17:09 -0400)
was
x.go:2: syntax error: unexpected $undefined

now
x.go:2: syntax error: unexpected \

R=ken2
CC=golang-dev
https://golang.org/cl/2267044

src/cmd/gc/lex.c

index 5d4230041cf15f854b98b4ba03318bbea2dd8831..7ddcdd21d229f57d5ba0c97996ac82833cb348d3 100644 (file)
@@ -538,7 +538,7 @@ isfrog(int c)
                        return 0;
                return 1;
        }
-       if(0x80 <= c && c <= 0xa0)      // unicode block including unbreakable space.
+       if(0x7f <= c && c <= 0xa0)      // DEL, unicode block including unbreakable space.
                return 1;
        return 0;
 }
@@ -947,6 +947,10 @@ lx:
                yyerror("illegal character 0x%ux", c);
                goto l0;
        }
+       if(importpkg == nil && (c == '#' || c == '$' || c == '?' || c == '@' || c == '\\')) {
+               yyerror("%s: unexpected %c", "syntax error", c);
+               goto l0;
+       }
        return c;
 
 asop: