shithub: scc

Download patch

ref: 4cf972513cefeba94d92337eed301e1f140582cf
parent: 34a81d796b32081310c4232f2955cd31fc84bc00
author: Roberto E. Vargas Caballero <[email protected]>
date: Wed Jul 3 10:51:48 EDT 2013

Move ahead call out of label

it is not clear calling to exp inside of label. It is more clear call to ahead
before of calling label, and in this case be sure it is a real label.

--- a/flow.c
+++ b/flow.c
@@ -153,14 +153,8 @@
 {
 	register struct symbol *sym = yyval.sym;
 
-	if (!ahead(':')) {
-		register struct node *np = expr(); /* it is an identifier */
-		expect(';');                       /* not a label */
-		return np;
-	}
-
 	sym = newlabel(sym, yytext);
-	next(), next();  /* skip IDEN and ':' */
+	next(), next();  	/* skip IDEN and ':' */
 	return node2(OLABEL, nodesym(sym), stmt());
 }
 
@@ -253,7 +247,7 @@
 	case GOTO:     return _goto();
 	case CASE:     return _case();
 	case DEFAULT:  return _default();
-	case IDEN:     return label();
+	case IDEN:     if (ahead(':')) 	return label();
 	}
 	np = expr();
 	expect(';');