1
0
mirror of https://github.com/golang/go synced 2024-11-25 05:47:57 -07:00

gc: improve error message for x \= 0

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
This commit is contained in:
Russ Cox 2010-09-24 17:09:31 -04:00
parent ac771a8a47
commit b1f44a120f

View File

@ -538,7 +538,7 @@ isfrog(int c)
return 0; return 0;
return 1; 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 1;
return 0; return 0;
} }
@ -947,6 +947,10 @@ lx:
yyerror("illegal character 0x%ux", c); yyerror("illegal character 0x%ux", c);
goto l0; goto l0;
} }
if(importpkg == nil && (c == '#' || c == '$' || c == '?' || c == '@' || c == '\\')) {
yyerror("%s: unexpected %c", "syntax error", c);
goto l0;
}
return c; return c;
asop: asop: