This is lex.yy.c in view mode; [Download] [Up]
# include "stdio.h" # define U(x) x # define NLSTATE yyprevious=YYNEWLINE # define BEGIN yybgin = yysvec + 1 + # define INITIAL 0 # define YYLERR yysvec # define YYSTATE (yyestate-yysvec-1) # define YYOPTIM 1 # define YYLMAX 200 # define output(c) putc(c,yyout) # define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) # define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;} # define yymore() (yymorfg=1) # define ECHO fprintf(yyout, "%s",yytext) # define REJECT { nstr = yyreject(); goto yyfussy;} int yyleng; extern char yytext[]; int yymorfg; extern char *yysptr, yysbuf[]; int yytchar; FILE *yyin ={stdin}, *yyout ={stdout}; extern int yylineno; struct yysvf { struct yywork *yystoff; struct yysvf *yyother; int *yystops;}; struct yysvf *yyestate; extern struct yysvf yysvec[], *yybgin; # define INIT 2 # define COM 4 #include "y.tab.h" int comments=0; # define YYNEWLINE 10 yylex(){ int nstr; extern int yyprevious; while((nstr = yylook()) >= 0) yyfussy: switch(nstr){ case 0: if(yywrap()) return(0); break; case 1: {BEGIN COM;comments++;} break; case 2: {comments++;} break; case 3: ; break; case 4: {comments--;if (comments==0){BEGIN INIT;}} break; case 5: return(NUM); break; case 6: return(NUM); break; case 7: return (UNEQU); break; case 8: return (LESSEQU); break; case 9: return (GTREQU); break; case 10: return (T_EQU); break; case 11: return (T_POW); break; case 12: return (STRING); break; case 13: return (FOR); break; case 14: return (IF); break; case 15: return (ELSE); break; case 16: return (WHILE); break; case 17: return (T_AND); break; case 18: return (T_AND); break; case 19: return (T_NOT); break; case 20: return (T_NOT); break; case 21: return (T_OR); break; case 22: return (T_OR); break; case 23: return (T_TRUE); break; case 24: return (T_FALSE); break; case 25: return (FLT); break; case 26: return (*yytext); break; case 27: return (*yytext); break; case 28: return (*yytext); break; case 29: ; break; case 30: ; break; case 31: return (ID); break; case 32: yyerror("illegal character"); break; case 33: {BEGIN INIT;unput(yytext[0]);} break; case -1: break; default: fprintf(yyout,"bad switch yylook %d",nstr); } return(0); } /* end of yylex */ int yyvstop[] ={ 0, 33, 0, 32, 33, 0, 30, 32, 33, 0, 29, 33, 0, 20, 32, 33, 0, 32, 33, 0, 32, 33, 0, 28, 32, 33, 0, 26, 32, 33, 0, 26, 32, 33, 0, 32, 33, 0, 27, 32, 33, 0, 5, 32, 33, 0, 26, 32, 33, 0, 26, 32, 33, 0, 26, 32, 33, 0, 31, 32, 33, 0, 31, 32, 33, 0, 31, 32, 33, 0, 31, 32, 33, 0, 31, 32, 33, 0, 31, 32, 33, 0, 31, 32, 33, 0, 31, 32, 33, 0, 31, 32, 33, 0, 27, 32, 33, 0, 11, 32, 33, 0, 32, 33, 0, 20, 32, 33, 0, 3, 33, 0, 3, 33, 0, 3, 33, 0, 7, 0, 12, 0, 18, 0, 11, 0, 6, 0, 1, 0, 5, 0, 5, 0, 8, 0, 10, 0, 9, 0, 31, 0, 31, 0, 31, 0, 31, 0, 31, 0, 31, 0, 14, 31, 0, 31, 0, 21, 31, 0, 31, 0, 31, 0, 22, 0, 4, 0, 2, 0, 17, 31, 0, 31, 0, 31, 0, 31, 0, 13, 31, 0, 19, 31, 0, 31, 0, 31, 0, 6, 0, 5, 0, 15, 31, 0, 31, 0, 31, 0, 23, 31, 0, 31, 0, 24, 31, 0, 25, 31, 0, 16, 31, 0, 0}; # define YYTYPE char struct yywork { YYTYPE verify, advance; } yycrank[] ={ 0,0, 0,0, 1,7, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1,7, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 1,7, 0,0, 0,0, 0,0, 0,0, 13,42, 0,0, 0,0, 1,7, 15,43, 18,45, 38,64, 0,0, 0,0, 1,7, 17,44, 17,44, 17,44, 17,44, 17,44, 17,44, 17,44, 17,44, 17,44, 17,44, 37,63, 0,0, 0,0, 11,39, 20,48, 20,39, 1,7, 1,7, 21,49, 1,7, 1,7, 1,7, 22,50, 1,7, 1,7, 44,65, 0,0, 1,7, 0,0, 1,7, 1,7, 3,8, 0,0, 1,7, 1,7, 1,7, 1,7, 24,51, 1,7, 3,9, 3,10, 19,46, 0,0, 19,47, 19,47, 19,47, 19,47, 19,47, 19,47, 19,47, 19,47, 19,47, 19,47, 25,53, 51,51, 25,51, 0,0, 44,65, 0,0, 0,0, 0,0, 0,0, 3,9, 3,11, 3,12, 57,51, 0,0, 0,0, 3,13, 24,51, 3,14, 3,14, 3,15, 3,16, 3,16, 3,16, 3,17, 3,18, 3,19, 34,62, 0,0, 0,0, 0,0, 0,0, 0,0, 25,53, 51,51, 25,51, 31,61, 3,16, 3,20, 3,21, 3,22, 27,57, 31,51, 3,23, 3,24, 57,51, 3,24, 3,25, 3,26, 27,51, 3,24, 3,27, 0,0, 26,54, 3,24, 4,9, 3,28, 3,29, 0,0, 0,0, 3,24, 3,24, 3,30, 3,24, 26,55, 3,31, 26,51, 26,56, 31,61, 3,32, 0,0, 3,32, 3,33, 27,57, 31,51, 0,0, 0,0, 0,0, 4,9, 4,11, 0,0, 27,51, 59,51, 0,0, 4,13, 26,54, 4,14, 4,14, 0,0, 4,16, 4,16, 4,16, 4,17, 4,18, 0,0, 0,0, 26,55, 67,51, 26,51, 26,56, 0,0, 3,16, 3,34, 3,16, 3,35, 4,16, 4,20, 4,21, 4,22, 6,36, 6,36, 6,36, 52,67, 6,38, 59,51, 5,36, 0,0, 28,51, 28,58, 29,51, 55,51, 55,70, 52,51, 29,59, 5,36, 6,36, 6,36, 6,36, 6,36, 67,51, 0,0, 30,51, 54,69, 70,81, 54,51, 30,60, 68,79, 4,32, 0,0, 4,32, 4,33, 0,0, 0,0, 0,0, 52,67, 68,51, 70,51, 0,0, 5,36, 28,51, 28,58, 29,51, 55,51, 55,70, 52,51, 29,59, 5,37, 5,36, 5,36, 5,36, 0,0, 5,38, 5,36, 30,51, 54,69, 70,81, 54,51, 30,60, 68,79, 4,16, 4,34, 4,16, 4,35, 5,36, 5,36, 5,36, 5,36, 68,51, 70,51, 5,36, 5,36, 60,51, 5,36, 5,36, 5,36, 12,40, 5,36, 5,36, 60,73, 6,36, 5,36, 6,36, 5,36, 5,36, 12,40, 71,51, 5,36, 5,36, 5,36, 5,36, 0,0, 5,36, 46,46, 46,46, 46,46, 46,46, 46,46, 46,46, 46,46, 46,46, 46,46, 46,46, 56,51, 60,51, 53,51, 72,51, 56,71, 0,0, 12,41, 53,68, 60,73, 0,0, 0,0, 46,66, 0,0, 0,0, 12,40, 71,51, 0,0, 79,51, 0,0, 0,0, 12,40, 82,51, 0,0, 0,0, 0,0, 5,36, 0,0, 5,36, 0,0, 0,0, 0,0, 0,0, 56,51, 0,0, 53,51, 72,51, 56,71, 12,40, 12,40, 53,68, 12,40, 12,40, 12,40, 46,66, 12,40, 12,40, 0,0, 23,51, 12,40, 79,51, 12,40, 12,40, 0,0, 82,51, 12,40, 12,40, 12,40, 12,40, 23,51, 12,40, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 0,0, 61,74, 74,83, 84,51, 74,51, 0,0, 61,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,52, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 61,74, 74,83, 84,51, 74,51, 23,51, 61,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,52, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 23,51, 58,51, 0,0, 65,75, 0,0, 65,75, 85,51, 58,72, 65,76, 65,76, 65,76, 65,76, 65,76, 65,76, 65,76, 65,76, 65,76, 65,76, 66,77, 0,0, 66,77, 0,0, 0,0, 66,78, 66,78, 66,78, 66,78, 66,78, 66,78, 66,78, 66,78, 66,78, 66,78, 58,51, 73,82, 69,51, 81,51, 0,0, 85,51, 58,72, 69,80, 0,0, 81,85, 73,51, 75,76, 75,76, 75,76, 75,76, 75,76, 75,76, 75,76, 75,76, 75,76, 75,76, 77,78, 77,78, 77,78, 77,78, 77,78, 77,78, 77,78, 77,78, 77,78, 77,78, 80,84, 86,51, 73,82, 69,51, 81,51, 83,86, 0,0, 0,0, 69,80, 80,51, 81,85, 73,51, 0,0, 0,0, 83,51, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 0,0, 80,84, 86,51, 0,0, 0,0, 0,0, 83,86, 0,0, 0,0, 0,0, 80,51, 0,0, 0,0, 0,0, 0,0, 83,51, 0,0, 0,0}; struct yysvf yysvec[] ={ 0, 0, 0, yycrank+-1, 0, 0, yycrank+0, yysvec+1, 0, yycrank+-80, 0, 0, yycrank+-148, yysvec+3, 0, yycrank+-216, 0, 0, yycrank+-168, yysvec+5, 0, yycrank+0, 0, yyvstop+1, yycrank+0, 0, yyvstop+3, yycrank+0, 0, yyvstop+6, yycrank+0, 0, yyvstop+10, yycrank+2, 0, yyvstop+13, yycrank+-286, 0, yyvstop+17, yycrank+2, 0, yyvstop+20, yycrank+0, 0, yyvstop+23, yycrank+2, 0, yyvstop+27, yycrank+0, 0, yyvstop+31, yycrank+2, 0, yyvstop+35, yycrank+3, 0, yyvstop+38, yycrank+45, 0, yyvstop+42, yycrank+3, 0, yyvstop+46, yycrank+7, 0, yyvstop+50, yycrank+11, 0, yyvstop+54, yycrank+326, 0, yyvstop+58, yycrank+9, yysvec+23, yyvstop+62, yycrank+27, yysvec+23, yyvstop+66, yycrank+90, yysvec+23, yyvstop+70, yycrank+73, yysvec+23, yyvstop+74, yycrank+141, yysvec+23, yyvstop+78, yycrank+143, yysvec+23, yyvstop+82, yycrank+155, yysvec+23, yyvstop+86, yycrank+66, yysvec+23, yyvstop+90, yycrank+0, 0, yyvstop+94, yycrank+0, 0, yyvstop+98, yycrank+5, 0, yyvstop+102, yycrank+0, 0, yyvstop+105, yycrank+0, 0, yyvstop+109, yycrank+13, 0, yyvstop+112, yycrank+4, 0, yyvstop+115, yycrank+0, 0, yyvstop+118, yycrank+0, yysvec+12, 0, yycrank+0, 0, yyvstop+120, yycrank+0, 0, yyvstop+122, yycrank+0, 0, yyvstop+124, yycrank+6, yysvec+17, yyvstop+126, yycrank+0, 0, yyvstop+128, yycrank+256, 0, yyvstop+130, yycrank+0, yysvec+19, yyvstop+132, yycrank+0, 0, yyvstop+134, yycrank+0, 0, yyvstop+136, yycrank+0, 0, yyvstop+138, yycrank+26, yysvec+23, yyvstop+140, yycrank+146, yysvec+23, yyvstop+142, yycrank+238, yysvec+23, yyvstop+144, yycrank+158, yysvec+23, yyvstop+146, yycrank+144, yysvec+23, yyvstop+148, yycrank+236, yysvec+23, yyvstop+150, yycrank+37, yysvec+23, yyvstop+152, yycrank+371, yysvec+23, yyvstop+155, yycrank+106, yysvec+23, yyvstop+157, yycrank+205, yysvec+23, yyvstop+160, yycrank+312, yysvec+23, yyvstop+162, yycrank+0, 0, yyvstop+164, yycrank+0, 0, yyvstop+166, yycrank+0, 0, yyvstop+168, yycrank+408, 0, 0, yycrank+423, 0, 0, yycrank+121, yysvec+23, yyvstop+170, yycrank+169, yysvec+23, yyvstop+173, yycrank+405, yysvec+23, yyvstop+175, yycrank+170, yysvec+23, yyvstop+177, yycrank+219, yysvec+23, yyvstop+179, yycrank+239, yysvec+23, yyvstop+182, yycrank+413, yysvec+23, yyvstop+185, yycrank+310, yysvec+23, yyvstop+187, yycrank+444, 0, 0, yycrank+0, yysvec+75, yyvstop+189, yycrank+454, 0, 0, yycrank+0, yysvec+77, yyvstop+191, yycrank+253, yysvec+23, yyvstop+193, yycrank+443, yysvec+23, yyvstop+196, yycrank+406, yysvec+23, yyvstop+198, yycrank+257, yysvec+23, yyvstop+200, yycrank+448, yysvec+23, yyvstop+203, yycrank+309, yysvec+23, yyvstop+205, yycrank+376, yysvec+23, yyvstop+208, yycrank+435, yysvec+23, yyvstop+211, 0, 0, 0}; struct yywork *yytop = yycrank+558; struct yysvf *yybgin = yysvec+1; char yymatch[] ={ 00 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,012 ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,'"' ,01 ,01 ,01 ,01 ,01 , 01 ,01 ,'*' ,'*' ,'*' ,'*' ,01 ,01 , '0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' ,'0' , '0' ,'0' ,01 ,'*' ,'*' ,'*' ,'*' ,01 , 01 ,'A' ,'B' ,'B' ,'D' ,'E' ,'F' ,'B' , 'H' ,'I' ,'B' ,'B' ,'L' ,'B' ,'N' ,'O' , 'B' ,'B' ,'R' ,'S' ,'T' ,'U' ,'B' ,'W' , 'B' ,'B' ,'B' ,01 ,01 ,01 ,01 ,01 , 01 ,'A' ,'B' ,'B' ,'D' ,'E' ,'F' ,'B' , 'H' ,'I' ,'B' ,'B' ,'L' ,'B' ,'N' ,'O' , 'B' ,'B' ,'R' ,'S' ,'T' ,'U' ,'B' ,'W' , 'B' ,'B' ,'B' ,'*' ,01 ,'*' ,01 ,01 , 0}; char yyextra[] ={ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0}; /* ncform 4.1 83/08/11 */ int yylineno =1; # define YYU(x) x # define NLSTATE yyprevious=YYNEWLINE char yytext[YYLMAX]; struct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; char yysbuf[YYLMAX]; char *yysptr = yysbuf; int *yyfnd; extern struct yysvf *yyestate; int yyprevious = YYNEWLINE; yylook(){ register struct yysvf *yystate, **lsp; register struct yywork *yyt; struct yysvf *yyz; int yych; struct yywork *yyr; # ifdef LEXDEBUG int debug; # endif char *yylastch; /* start off machines */ # ifdef LEXDEBUG debug = 0; # endif if (!yymorfg) yylastch = yytext; else { yymorfg=0; yylastch = yytext+yyleng; } for(;;){ lsp = yylstate; yyestate = yystate = yybgin; if (yyprevious==YYNEWLINE) yystate++; for (;;){ # ifdef LEXDEBUG if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); # endif yyt = yystate->yystoff; if(yyt == yycrank){ /* may not be any transitions */ yyz = yystate->yyother; if(yyz == 0)break; if(yyz->yystoff == yycrank)break; } *yylastch++ = yych = input(); tryagain: # ifdef LEXDEBUG if(debug){ fprintf(yyout,"char "); allprint(yych); putchar('\n'); } # endif yyr = yyt; if ( (int)yyt > (int)yycrank){ yyt = yyr + yych; if (yyt <= yytop && yyt->verify+yysvec == yystate){ if(yyt->advance+yysvec == YYLERR) /* error transitions */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; goto contin; } } # ifdef YYOPTIM else if((int)yyt < (int)yycrank) { /* r < yycrank */ yyt = yyr = yycrank+(yycrank-yyt); # ifdef LEXDEBUG if(debug)fprintf(yyout,"compressed state\n"); # endif yyt = yyt + yych; if(yyt <= yytop && yyt->verify+yysvec == yystate){ if(yyt->advance+yysvec == YYLERR) /* error transitions */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; goto contin; } yyt = yyr + YYU(yymatch[yych]); # ifdef LEXDEBUG if(debug){ fprintf(yyout,"try fall back character "); allprint(YYU(yymatch[yych])); putchar('\n'); } # endif if(yyt <= yytop && yyt->verify+yysvec == yystate){ if(yyt->advance+yysvec == YYLERR) /* error transition */ {unput(*--yylastch);break;} *lsp++ = yystate = yyt->advance+yysvec; goto contin; } } if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){ # ifdef LEXDEBUG if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1); # endif goto tryagain; } # endif else {unput(*--yylastch);break;} contin: # ifdef LEXDEBUG if(debug){ fprintf(yyout,"state %d char ",yystate-yysvec-1); allprint(yych); putchar('\n'); } # endif ; } # ifdef LEXDEBUG if(debug){ fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1); allprint(yych); putchar('\n'); } # endif while (lsp-- > yylstate){ *yylastch-- = 0; if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){ yyolsp = lsp; if(yyextra[*yyfnd]){ /* must backup */ while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){ lsp--; unput(*yylastch--); } } yyprevious = YYU(*yylastch); yylsp = lsp; yyleng = yylastch-yytext+1; yytext[yyleng] = 0; # ifdef LEXDEBUG if(debug){ fprintf(yyout,"\nmatch "); sprint(yytext); fprintf(yyout," action %d\n",*yyfnd); } # endif return(*yyfnd++); } unput(*yylastch); } if (yytext[0] == 0 /* && feof(yyin) */) { yysptr=yysbuf; return(0); } yyprevious = yytext[0] = input(); if (yyprevious>0) output(yyprevious); yylastch=yytext; # ifdef LEXDEBUG if(debug)putchar('\n'); # endif } } yyback(p, m) int *p; { if (p==0) return(0); while (*p) { if (*p++ == m) return(1); } return(0); } /* the following are only used in the lex library */ yyinput(){ return(input()); } yyoutput(c) int c; { output(c); } yyunput(c) int c; { unput(c); }
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.