BSD 4_3_Tahoe release
[unix-history] / usr / src / usr.bin / lex / parser.y
index 81df2d0..4a0b0b2 100644 (file)
@@ -8,6 +8,10 @@
 %left '*' '+' '?'
 
 %{
 %left '*' '+' '?'
 
 %{
+#ifndef lint
+static char sccsid[] = "@(#)parser.y   4.2 (Berkeley) 1/12/88";
+#endif
+
 # include "ldefs.c"
 %}
 %%
 # include "ldefs.c"
 %}
 %%
@@ -89,7 +93,7 @@ r:    CHAR
        ={      $$ = mn0($1); }
        | STR
        ={
        ={      $$ = mn0($1); }
        | STR
        ={
-               p = $1;
+               p = (char *)$1;
                i = mn0(*p++);
                while(*p)
                        i = mn2(RSTR,i,*p++);
                i = mn0(*p++);
                while(*p)
                        i = mn2(RSTR,i,*p++);
@@ -237,16 +241,15 @@ yylex(){
                                                sectbegin = TRUE;
                                                i = treesize*(sizeof(*name)+sizeof(*left)+
                                                        sizeof(*right)+sizeof(*nullstr)+sizeof(*parent))+ALITTLEEXTRA;
                                                sectbegin = TRUE;
                                                i = treesize*(sizeof(*name)+sizeof(*left)+
                                                        sizeof(*right)+sizeof(*nullstr)+sizeof(*parent))+ALITTLEEXTRA;
-                                               c = myalloc(i,1);
+                                               p = myalloc(i,1);
                                                if(c == 0)
                                                        error("Too little core for parse tree");
                                                if(c == 0)
                                                        error("Too little core for parse tree");
-                                               p = c;
                                                cfree(p,i,1);
                                                cfree(p,i,1);
-                                               name = myalloc(treesize,sizeof(*name));
-                                               left = myalloc(treesize,sizeof(*left));
-                                               right = myalloc(treesize,sizeof(*right));
-                                               nullstr = myalloc(treesize,sizeof(*nullstr));
-                                               parent = myalloc(treesize,sizeof(*parent));
+                                               name = (int *)myalloc(treesize,sizeof(*name));
+                                               left = (int *)myalloc(treesize,sizeof(*left));
+                                               right = (int *)myalloc(treesize,sizeof(*right));
+                                               nullstr = (char *)myalloc(treesize,sizeof(*nullstr));
+                                               parent = (int *)myalloc(treesize,sizeof(*parent));
                                                if(name == 0 || left == 0 || right == 0 || parent == 0 || nullstr == 0)
                                                        error("Too little core for parse tree");
                                                return(freturn(DELIM));
                                                if(name == 0 || left == 0 || right == 0 || parent == 0 || nullstr == 0)
                                                        error("Too little core for parse tree");
                                                return(freturn(DELIM));
@@ -394,7 +397,7 @@ yylex(){
                                        prev = *p;
                                        *p = 0;
                                        bptr = p+1;
                                        prev = *p;
                                        *p = 0;
                                        bptr = p+1;
-                                       yylval = buf;
+                                       yylval = (int)buf;
                                        if(digit(buf[0]))
                                                warning("Substitution strings may not begin with digits");
                                        return(freturn(STR));
                                        if(digit(buf[0]))
                                                warning("Substitution strings may not begin with digits");
                                        return(freturn(STR));
@@ -407,7 +410,7 @@ yylex(){
                                if(*p == 0)
                                        warning("No translation given - null string assumed");
                                scopy(p,token);
                                if(*p == 0)
                                        warning("No translation given - null string assumed");
                                scopy(p,token);
-                               yylval = token;
+                               yylval = (int)token;
                                prev = '\n';
                                return(freturn(STR));
                                }
                                prev = '\n';
                                return(freturn(STR));
                                }
@@ -558,7 +561,7 @@ yylex(){
                                        }
                                if(slptr > slist+STARTSIZE)             /* note not packed ! */
                                        error("Too many start conditions used");
                                        }
                                if(slptr > slist+STARTSIZE)             /* note not packed ! */
                                        error("Too many start conditions used");
-                               yylval = t;
+                               yylval = (int)t;
                                x = SCON;
                                break;
                        case '"':
                                x = SCON;
                                break;
                        case '"':
@@ -584,7 +587,7 @@ yylex(){
                                        x = CHAR;
                                        }
                                else {
                                        x = CHAR;
                                        }
                                else {
-                                       yylval = token;
+                                       yylval = (int)token;
                                        x = STR;
                                        }
                                break;
                                        x = STR;
                                        }
                                break;
@@ -628,9 +631,9 @@ yylex(){
                                        while(p <ccptr && scomp(token,p) != 0)p++;
                                        }
                                if(p < ccptr)   /* found it */
                                        while(p <ccptr && scomp(token,p) != 0)p++;
                                        }
                                if(p < ccptr)   /* found it */
-                                       yylval = p;
+                                       yylval = (int)p;
                                else {
                                else {
-                                       yylval = ccptr;
+                                       yylval = (int)ccptr;
                                        scopy(token,ccptr);
                                        ccptr += slength(token) + 1;
                                        if(ccptr >= ccl+CCLSIZE)
                                        scopy(token,ccptr);
                                        ccptr += slength(token) + 1;
                                        if(ccptr >= ccl+CCLSIZE)
@@ -649,7 +652,7 @@ yylex(){
                                        }
                                if(alpha(peek)){
                                        i = 0;
                                        }
                                if(alpha(peek)){
                                        i = 0;
-                                       yylval = token;
+                                       yylval = (int)token;
                                        token[i++] = c;
                                        while(alpha(peek))
                                                token[i++] = gch();
                                        token[i++] = c;
                                        while(alpha(peek))
                                                token[i++] = gch();