8 Bprint(&fout,"typedef unsigned char Uchar;\n");
10 Bprint(&fout,"# include <u.h>\n");
11 Bprint(&fout,"# include <libc.h>\n");
13 Bprint(&fout,"# include <stdio.h>\n");
14 Bprint(&fout, "# define U(x) x\n");
15 Bprint(&fout, "# define NLSTATE yyprevious=YYNEWLINE\n");
16 Bprint(&fout,"# define BEGIN yybgin = yysvec + 1 +\n");
17 Bprint(&fout,"# define INITIAL 0\n");
18 Bprint(&fout,"# define YYLERR yysvec\n");
19 Bprint(&fout,"# define YYSTATE (yyestate-yysvec-1)\n");
20 Bprint(&fout,"# define YYOPTIM 1\n");
22 Bprint(&fout,"# define LEXDEBUG 1\n");
24 Bprint(&fout,"# define YYLMAX 200\n");
26 "# define unput(c) {yytchar= (c);if(yytchar=='\\n')yylineno--;*yysptr++=yytchar;}\n");
27 Bprint(&fout,"# define yymore() (yymorfg=1)\n");
28 Bprint(&fout,"# define ECHO fprintf(yyout, \"%%s\",yytext)\n");
29 Bprint(&fout,"# define REJECT { nstr = yyreject(); goto yyfussy;}\n");
30 Bprint(&fout,"int yyleng; extern char yytext[];\n");
31 Bprint(&fout,"int yymorfg;\n");
32 Bprint(&fout,"extern Uchar *yysptr, yysbuf[];\n");
33 Bprint(&fout,"int yytchar;\n");
34 Bprint(&fout,"FILE *yyin = {stdin}, *yyout = {stdout};\n");
35 Bprint(&fout,"extern int yylineno;\n");
36 Bprint(&fout,"struct yysvf { \n");
37 Bprint(&fout,"\tstruct yywork *yystoff;\n");
38 Bprint(&fout,"\tstruct yysvf *yyother;\n");
39 Bprint(&fout,"\tint *yystops;};\n");
40 Bprint(&fout,"struct yysvf *yyestate;\n");
41 Bprint(&fout,"extern struct yysvf yysvec[], *yybgin;\n");
42 Bprint(&fout,"int yylook(void), yywrap(void), yyback(int *, int);\n");
51 " if ((rv = write(outfd, &c, 1)) < 0)\n"
52 " sysfatal(\"output: %%r\");\n"
54 " sysfatal(\"output: EOF?\");\n"
60 " if(yysptr > yysbuf)\n"
61 " yytchar = U(*--yysptr);\n"
64 " if ((rv = read(infd, &yytchar, 1)) < 0)\n"
65 " sysfatal(\"input: %%r\");\n"
69 " if (yytchar == '\\n')\n"
75 Bprint(&fout,"# define output(c) putc(c,yyout)\n");
76 Bprint(&fout, "%s%d%s\n",
77 "# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==",
79 "?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)");
86 Bprint(&fout,"while((nstr = yylook()) >= 0)\n");
87 Bprint(&fout,"yyfussy: switch(nstr){\n");
88 Bprint(&fout,"case 0:\n");
89 Bprint(&fout,"if(yywrap()) return(0); break;\n");
96 Bprint(&fout,"case -1:\nbreak;\n"); /* for reject */
97 Bprint(&fout,"default:\n");
98 Bprint(&fout,"fprintf(yyout,\"bad switch yylook %%d\",nstr);\n");
99 Bprint(&fout,"} return(0); }\n");
100 Bprint(&fout,"/* end of yylex */\n");
108 fprint(errorf,"%d/%d nodes(%%e), %d/%d positions(%%p), %d/%d (%%n), %ld transitions\n",
109 tptr, treesize, (int)(nxtpos-positions), maxpos, stnum+1, nstates, rcount);
110 fprint(errorf, ", %d/%d packed char classes(%%k)", (int)(pcptr-pchar), pchlen);
111 fprint(errorf,", %d/%d packed transitions(%%a)",nptr, ntrans);
112 fprint(errorf, ", %d/%d output slots(%%o)", yytop, outsize);