commit eb43e9ba97471912f3338750198951ca4f5eec82 from: wkj date: Sun May 16 07:59:27 2004 UTC Make lex more pedant friendly. commit - a87f4771c76a15ef4dd422b1eb83fc9e1ffde036 commit + eb43e9ba97471912f3338750198951ca4f5eec82 blob - 8fa63d62565bdab9396e2f36577b85ae412ed022 blob + 53345beb1e2faee4934ef2fc6e693e9727482638 --- src/cmd/lex/header.c +++ src/cmd/lex/header.c @@ -85,7 +85,7 @@ void phead2(void) { Bprint(&fout,"while((nstr = yylook()) >= 0)\n"); - Bprint(&fout,"yyfussy: switch(nstr){\n"); + Bprint(&fout,"goto yyfussy;\nyyfussy: switch(nstr){\n"); Bprint(&fout,"case 0:\n"); Bprint(&fout,"if(yywrap()) return(0); break;\n"); } blob - dd7a1ea6791abd248c52814ffd70475fb5f514d0 blob + 6571735b4ce14ea2ae4ed3d5aee6eda81f69174d --- src/cmd/lex/ncform +++ src/cmd/lex/ncform @@ -11,6 +11,7 @@ int yyprevious = YYNEWLINE; # ifdef LEXDEBUG extern void allprint(char); # endif +int yylook(void){ struct yysvf *yystate, **lsp; struct yywork *yyt; @@ -158,6 +159,7 @@ yylook(void){ } return(0); /* shut up the compiler; i have no idea what should be returned */ } +int yyback(int *p, int m) { if (p==0) return(0); @@ -169,6 +171,7 @@ while (*p) return(0); } /* the following are only used in the lex library */ +int yyinput(void){ if(yyin == ((void*)0)) yyin = stdin; blob - 5ac33a2858648a397b46ae9f26ca0b9db6af0a79 blob + 8e7285d0432f5e15d57a9fbc27c7842639341516 --- src/cmd/lex/parser.y +++ src/cmd/lex/parser.y @@ -240,7 +240,7 @@ yylex(void) case '%': lgate(); Bprint(&fout,"#define YYNEWLINE %d\n",'\n'); - Bprint(&fout,"yylex(void){\nint nstr; extern int yyprevious;\n"); + Bprint(&fout,"int\nyylex(void){\nint nstr; extern int yyprevious;\nif(yyprevious){}\n"); sectbegin = TRUE; i = treesize*(sizeof(*name)+sizeof(*left)+ sizeof(*right)+sizeof(*nullstr)+sizeof(*parent))+ALITTLEEXTRA;