Commit 0dd0e1ad authored by Miquel Sabaté Solà's avatar Miquel Sabaté Solà Committed by Russ Cox

cmd/gc: merge casep and casee labels

The code inside the casee and casep labels can perfectly be merged since
they essentially do the same. The character to be stored where cp points is
just the character contained by the c variable.

R=golang-dev, dave, rsc
CC=golang-dev
https://golang.org/cl/6845112
parent 3c6c8831
...@@ -1296,13 +1296,13 @@ tnum: ...@@ -1296,13 +1296,13 @@ tnum:
if(cp == lexbuf+2) if(cp == lexbuf+2)
yyerror("malformed hex constant"); yyerror("malformed hex constant");
if(c == 'p') if(c == 'p')
goto casep; goto caseep;
goto ncu; goto ncu;
} }
} }
if(c == 'p') // 0p begins floating point zero if(c == 'p') // 0p begins floating point zero
goto casep; goto caseep;
c1 = 0; c1 = 0;
for(;;) { for(;;) {
...@@ -1320,7 +1320,7 @@ tnum: ...@@ -1320,7 +1320,7 @@ tnum:
if(c == '.') if(c == '.')
goto casedot; goto casedot;
if(c == 'e' || c == 'E') if(c == 'e' || c == 'E')
goto casee; goto caseep;
if(c == 'i') if(c == 'i')
goto casei; goto casei;
if(c1) if(c1)
...@@ -1330,10 +1330,8 @@ tnum: ...@@ -1330,10 +1330,8 @@ tnum:
dc: dc:
if(c == '.') if(c == '.')
goto casedot; goto casedot;
if(c == 'e' || c == 'E') if(c == 'e' || c == 'E' || c == 'p' || c == 'P')
goto casee; goto caseep;
if(c == 'p' || c == 'P')
goto casep;
if(c == 'i') if(c == 'i')
goto casei; goto casei;
...@@ -1369,29 +1367,8 @@ casedot: ...@@ -1369,29 +1367,8 @@ casedot:
if(c != 'e' && c != 'E') if(c != 'e' && c != 'E')
goto caseout; goto caseout;
casee: caseep:
*cp++ = 'e'; *cp++ = c;
c = getc();
if(c == '+' || c == '-') {
*cp++ = c;
c = getc();
}
if(!yy_isdigit(c))
yyerror("malformed fp constant exponent");
while(yy_isdigit(c)) {
if(cp+10 >= ep) {
yyerror("identifier too long");
errorexit();
}
*cp++ = c;
c = getc();
}
if(c == 'i')
goto casei;
goto caseout;
casep:
*cp++ = 'p';
c = getc(); c = getc();
if(c == '+' || c == '-') { if(c == '+' || c == '-') {
*cp++ = c; *cp++ = c;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment