1
0
mirror of https://github.com/golang/go synced 2024-11-22 06:44:40 -07:00
SVN=121620
This commit is contained in:
Ken Thompson 2008-06-08 18:26:23 -07:00
parent b6eca3534c
commit 9abf9e8a37
2 changed files with 11 additions and 15 deletions

View File

@ -387,7 +387,7 @@ void lexinit(void);
char* lexname(int);
long getr(void);
int getnsc(void);
int escchar(int, int*, vlong*);
int escchar(int, vlong*);
int getc(void);
void ungetc(int);
void mkpackage(char*);

View File

@ -175,7 +175,6 @@ yylex(void)
vlong v;
char *cp;
Rune rune;
int escflag;
Sym *s;
l0:
@ -225,19 +224,19 @@ l0:
caseq:
for(;;) {
if(escchar('"', &escflag, &v))
if(escchar('"', &v))
break;
if(escflag) {
cp = remal(cp, c1, 1);
cp[c1++] = v;
} else {
if(v >= Runeself) {
// botch - this limits size of runes
rune = v;
c = runelen(rune);
cp = remal(cp, c1, c);
runetochar(cp+c1, &rune);
c1 += c;
continue;
}
cp = remal(cp, c1, 1);
cp[c1++] = v;
}
goto catem;
@ -282,9 +281,9 @@ l0:
case '\'':
/* '.' */
if(escchar('\'', &escflag, &v))
if(escchar('\'', &v))
v = '\''; // allow '''
if(!escchar('\'', &escflag, &v)) {
if(!escchar('\'', &v)) {
yyerror("missing '");
ungetc(v);
}
@ -696,13 +695,12 @@ getnsc(void)
int
escchar(int e, int *escflg, vlong *val)
escchar(int e, vlong *val)
{
int i, c;
int i;
long c;
vlong l;
*escflg = 0;
loop:
c = getr();
if(c == '\n') {
@ -779,7 +777,6 @@ hex:
ungetc(c);
break;
}
*escflg = 1;
*val = l;
return 0;
@ -796,7 +793,6 @@ oct:
}
if(l > 255)
warn("oct escape value > 255: %d", l);
*escflg = 1;
*val = l;
return 0;
}