tMake lex more pedant friendly. - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit eb43e9ba97471912f3338750198951ca4f5eec82
 (DIR) parent a87f4771c76a15ef4dd422b1eb83fc9e1ffde036
 (HTM) Author: wkj <devnull@localhost>
       Date:   Sun, 16 May 2004 07:59:27 +0000
       
       Make lex more pedant friendly.
       
       Diffstat:
         M src/cmd/lex/header.c                |       2 +-
         M src/cmd/lex/ncform                  |       3 +++
         M src/cmd/lex/parser.y                |       2 +-
       
       3 files changed, 5 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/src/cmd/lex/header.c b/src/cmd/lex/header.c
       t@@ -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");
        }
 (DIR) diff --git a/src/cmd/lex/ncform b/src/cmd/lex/ncform
       t@@ -11,6 +11,7 @@ int yyprevious = YYNEWLINE;
        # ifdef LEXDEBUG
        extern void allprint(char);
        # endif
       +int
        yylook(void){
                struct yysvf *yystate, **lsp;
                struct yywork *yyt;
       t@@ -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);
       t@@ -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;
 (DIR) diff --git a/src/cmd/lex/parser.y b/src/cmd/lex/parser.y
       t@@ -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;