Disallow labels named q, qq, qw, qx, s, y, and tr
authorChip Salzenberg <chip@atlantic.net>
Thu, 19 Dec 1996 04:11:04 +0000 (16:11 +1200)
committerChip Salzenberg <chip@atlantic.net>
Thu, 19 Dec 1996 23:14:00 +0000 (11:14 +1200)
toke.c

diff --git a/toke.c b/toke.c
index 2ebb0c2..4c79d7b 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -2344,10 +2344,17 @@ yylex()
 
        /* Is this a label? */
        if (expect == XSTATE && d < bufend && *d == ':' && *(d + 1) != ':') {
-           s = d + 1;
-           yylval.pval = savepv(tokenbuf);
-           CLINE;
-           TOKEN(LABEL);
+           if (len == 1 && strchr("syq", tokenbuf[0]) ||
+               len == 2 && ((tokenbuf[0] == 't' && tokenbuf[1] == 'r') ||
+                            (tokenbuf[0] == 'q' &&
+                             strchr("qwx", tokenbuf[1]))))
+               ; /* no */
+           else {
+               s = d + 1;
+               yylval.pval = savepv(tokenbuf);
+               CLINE;
+               TOKEN(LABEL);
+           }
        }
 
        /* Check for keywords */