about summary refs log tree commit diff
path: root/Src/lex.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2012-10-05 21:35:05 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2012-10-05 21:35:05 +0000
commiteb562c9f2c8af43957b023325119d912fa3897b3 (patch)
tree04a3a3d86ceffe87ca678d2c361fd27263ba2e39 /Src/lex.c
parent8781aad44870da32b3c59f5faa8a5a3e01a7027d (diff)
downloadzsh-eb562c9f2c8af43957b023325119d912fa3897b3.tar.gz
zsh-eb562c9f2c8af43957b023325119d912fa3897b3.tar.xz
zsh-eb562c9f2c8af43957b023325119d912fa3897b3.zip
30715: use enum lextok for variables containing lexical tokens
Diffstat (limited to 'Src/lex.c')
-rw-r--r--Src/lex.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/Src/lex.c b/Src/lex.c
index 1cf3611c9..2c738c005 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -42,7 +42,7 @@ char *zshlextext;
 /**/
 mod_export char *tokstr;
 /**/
-mod_export int tok;
+mod_export enum lextok tok;
 /**/
 mod_export int tokfd;
 
@@ -207,7 +207,7 @@ struct lexstack {
     int hlinesz;
     char *hline;
     char *hptr;
-    int tok;
+    enum lextok tok;
     int isnewlin;
     char *tokstr;
     char *zshlextext;
@@ -470,6 +470,10 @@ ctxtlex(void)
     case DINBRACK:
 	incmdpos = 0;
 	break;
+
+    default:
+	/* nothing to do, keep compiler happy */
+	break;
     }
     if (tok != DINPAR)
 	infor = tok == FOR ? 2 : 0;
@@ -698,11 +702,12 @@ isnumglob(void)
 }
 
 /**/
-static int
+static enum lextok
 gettok(void)
 {
     int c, d;
-    int peekfd = -1, peek;
+    int peekfd = -1;
+    enum lextok peek;
 
   beginning:
     tokstr = NULL;
@@ -1007,12 +1012,13 @@ gettok(void)
  */
 
 /**/
-static int
+static enum lextok
 gettokstr(int c, int sub)
 {
     int bct = 0, pct = 0, brct = 0, fdpar = 0;
     int intpos = 1, in_brace_param = 0;
-    int peek, inquote, unmatched = 0;
+    int inquote, unmatched = 0;
+    enum lextok peek;
 #ifdef DEBUG
     int ocmdsp = cmdsp;
 #endif
@@ -1692,6 +1698,7 @@ parse_subst_string(char *s)
 {
     int c, l = strlen(s), err;
     char *ptr;
+    enum lextok ctok;
 
     if (!*s || !strcmp(s, nulstring))
 	return 0;
@@ -1703,14 +1710,14 @@ parse_subst_string(char *s)
     bptr = tokstr = s;
     bsiz = l + 1;
     c = hgetc();
-    c = gettokstr(c, 1);
+    ctok = gettokstr(c, 1);
     err = errflag;
     strinend();
     inpop();
     DPUTS(cmdsp, "BUG: parse_subst_string: cmdstack not empty.");
     lexrestore();
     errflag = err;
-    if (c == LEXERR) {
+    if (ctok == LEXERR) {
 	untokenize(s);
 	return 1;
     }
@@ -1720,9 +1727,9 @@ parse_subst_string(char *s)
      * before lexrestore()) == l, but that's not necessarily the case if
      * we stripped an RCQUOTE.
      */
-    if (c != STRING || (errflag && !noerrs)) {
+    if (ctok != STRING || (errflag && !noerrs)) {
 	fprintf(stderr, "Oops. Bug in parse_subst_string: %s\n",
-		errflag ? "errflag" : "c != STRING");
+		errflag ? "errflag" : "ctok != STRING");
 	fflush(stderr);
 	untokenize(s);
 	return 1;