allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (06/04/89)
Posting-number: Volume 7, Issue 5 Submitted-by: sparks@corpane.uucp Archive-name: repunsel [Now *this* one's more my style! Even if it *is* a bit mindless. ++bsa] - Repunsel v0.9 - English: Howdy Partner! Welcome to repunsel. You knew it had to happen, and it did. Leave it up to me! But, don't worry, there is nothing to be afraid of. Just groan and bear it. It may seem way out at first, but you will soon take a liking to repunsel. Of course, it is in poor taste, but that is the NATURE of puns. You know you wouldn't have it any other way. Be a fun guy and download repunsel today. Well I must be going. Let us part paths for now. So long! ---- RePUNsel: Howdy POD'ner! Welcome to rePUNsel. You knew it had to happen, ANT it did. LEAF it up to me! But, DEWn't worry, there is KNOThing to be A FRAYED of. Just groan ANT bear it. It may seem WHEY out at first, but you will soon take a LICHEN to rePUNsel. Of course, it is in SPORE taste, but that is the NATURE of PUNs. You know you WOODEN have it any other WHEY. Be a FUNGI ANT DEWwnload rePUNsel today. Well I MOSS be going. LETTUCE part paths for now. SOIL LOG! -John Sparks uunet!ukma!corpane!sparks ----------- This is a unix shar file Cut out everything above and including the line '----8<---cut me ---' and rename the remaining portion 'repunsel.shar' Run repunsel.shar thru the unix shell: $sh repunsel.shar ----------------8<-------cut me---------------8<---------------------------- echo x - destructions sed 's/^X//' >destructions <<'*-*-END-of-destructions-*-*' X Repunsel X +++++++++++++++++ XCompiling Repunsel: X XYou should have the files: repunsel.c and repunsel.l and lex.yy.c X X Xrepunsel.l must be run thru the unix 'lex' utility to produce the file lex.yy.c XThen compile repunsel.c and lex.yy.c to produce repunsel X X $lex repunsel.l X $cc repunsel.c lex.yy.c -o repunsel X (You may get a list of warnings from the compiler. Ignore them.) X XNote: lex.yy.c is included in this package. You only need to use lex if you Xwish to make changes to repunsel. X XUsing Repunsel: X XRepunsel uses standard input and output. X XExamples: X XTo translate a file called 'note' and output repunsel to a file called 'knote': X X $ cat note | repunsel > knote X XTo translate a file called 'note' and just print it to the screen: X X $ cat note | repunsel X XTo have repunsel wait to translate what you type at the keyboard and return it Xin repunsel on your screen: X X $ repunsel X X--- *-*-END-of-destructions-*-* echo x - repunsel.c sed 's/^X//' >repunsel.c <<'*-*-END-of-repunsel.c-*-*' X#include <stdio.h> X/* Repunsel v0.9 */ X/* by */ X/* John Sparks */ X/* uunet!ukma!corpane!sparks */ X/* 5/8/89 */ X/* This is in the Public Domain, do with it what you will */ X X Xmain() X{ Xchar *line; X X while(line = (char *) yylex()){ X printf("%s", line); X } X} X Xyywrap () X{ X return (1); X} *-*-END-of-repunsel.c-*-* echo x - lex.yy.c sed 's/^X//' >lex.yy.c <<'*-*-END-of-lex.yy.c-*-*' X# include "stdio.h" X# define U(x) x X# define NLSTATE yyprevious=YYNEWLINE X# define BEGIN yybgin = yysvec + 1 + X# define INITIAL 0 X# define YYLERR yysvec X# define YYSTATE (yyestate-yysvec-1) X# define YYOPTIM 1 X# define YYLMAX 200 X# define output(c) putc(c,yyout) X# define input() (((yytchar=yysptr>yysbuf?U(*--yysptr):getc(yyin))==10?(yylineno++,yytchar):yytchar)==EOF?0:yytchar) X# define unput(c) {yytchar= (c);if(yytchar=='\n')yylineno--;*yysptr++=yytchar;} X# define yymore() (yymorfg=1) X# define ECHO fprintf(yyout, "%s",yytext) X# define REJECT { nstr = yyreject(); goto yyfussy;} Xint yyleng; extern char yytext[]; Xint yymorfg; Xextern char *yysptr, yysbuf[]; Xint yytchar; XFILE *yyin = {stdin}, *yyout = {stdout}; Xextern int yylineno; Xstruct yysvf { X struct yywork *yystoff; X struct yysvf *yyother; X int *yystops;}; Xstruct yysvf *yyestate; Xextern struct yysvf yysvec[], *yybgin; X char buf[128]; X X# define YYNEWLINE 10 Xyylex(){ Xint nstr; extern int yyprevious; Xwhile((nstr = yylook()) >= 0) Xyyfussy: switch(nstr){ Xcase 0: Xif(yywrap()) return(0); break; Xcase 1: X return("ANT"); Xbreak; Xcase 2: X return("ANT"); Xbreak; Xcase 3: X return("WOODEN"); Xbreak; Xcase 4: X return("WOOD"); Xbreak; Xcase 5: X return("ROOT"); Xbreak; Xcase 6: X return("STUMP"); Xbreak; Xcase 7: X return("TWIG"); Xbreak; Xcase 8: X return("TWIG"); Xbreak; Xcase 9: X return("BRANCH"); Xbreak; Xcase 10: X return("BARK"); Xbreak; Xcase 11: X return("LETTUCE"); Xbreak; Xcase 12: X return("'EAR "); Xbreak; Xcase 13: X return(" 'EAR "); Xbreak; Xcase 14: X return("'EAR "); Xbreak; Xcase 15: X return(" 'EAR "); Xbreak; Xcase 16: X return("LOG"); Xbreak; Xcase 17: X return("LOG"); Xbreak; Xcase 18: X return("LEAF"); Xbreak; Xcase 19: X return("LEAF"); Xbreak; Xcase 20: X return("TREE"); Xbreak; Xcase 21: X return("SAP"); Xbreak; Xcase 22: X return("BUSH"); Xbreak; Xcase 23: X return("HEDGE"); Xbreak; Xcase 24: X return("FLOWER"); Xbreak; Xcase 25: X return("FLOWER"); Xbreak; Xcase 26: X return("POD'n"); Xbreak; Xcase 27: X return("POD'ner"); Xbreak; Xcase 28: X return("POD"); Xbreak; Xcase 29: X return("SOIL "); Xbreak; Xcase 30: X return("SOIL"); Xbreak; Xcase 31: X return("CARROT"); Xbreak; Xcase 32: X return("CARROT"); Xbreak; Xcase 33: X return("PUN"); Xbreak; Xcase 34: X return("A FRAYED"); Xbreak; Xcase 35: X return("FUNGI"); Xbreak; Xcase 36: X return("FUNGI"); Xbreak; Xcase 37: X return("FUNGI"); Xbreak; Xcase 38: X return("WHEY"); Xbreak; Xcase 39: X return("SPORE"); Xbreak; Xcase 40: X return("LICHEN"); Xbreak; Xcase 41: X return("NATURE"); Xbreak; Xcase 42: X return("MOSS"); Xbreak; Xcase 43: X return("MOLD"); Xbreak; Xcase 44: X return("PUN"); Xbreak; Xcase 45: X return("SLAW"); Xbreak; Xcase 46: X return("KNOT"); Xbreak; Xcase 47: X return("GRAIN"); Xbreak; Xcase 48: X return("DEW"); Xbreak; Xcase 49: X return("PINE"); Xbreak; Xcase 50: X return("WALNUT"); Xbreak; Xcase 51: X return("HAY"); Xbreak; Xcase 52: X return("ORANGE"); Xbreak; Xcase 53: X return("PEAS"); Xbreak; Xcase 54: X return("PEAS"); Xbreak; Xcase 55: X return("PEAS"); Xbreak; Xcase 56: X return("BEAN"); Xbreak; Xcase 57: X return("CLOVER"); Xbreak; Xcase 58: X return("PEEL"); Xbreak; Xcase -1: Xbreak; Xdefault: Xfprintf(yyout,"bad switch yylook %d",nstr); X} return(0); } X/* end of yylex */ X X Xint yyvstop[] = { X0, X X1, X0, X X48, X0, X X2, X0, X X44, X0, X X51, X0, X X16, X0, X X46, X0, X X28, X0, X X33, X0, X X21, X0, X X29, X0, X X38, X0, X X44, X0, X X49, X0, X X10, X0, X X56, X0, X X22, X0, X X31, X0, X X19, X0, X X17, X0, X X43, X0, X X42, X0, X X58, X0, X X39, X0, X X5, X0, X X45, X0, X X30, X0, X X20, X0, X X7, X0, X X8, X0, X X24, X0, X X47, X0, X X23, X0, X X18, X0, X X53, X0, X X54, X0, X X6, X0, X X4, X0, X X13, X0, X X15, X0, X X57, X0, X X34, X0, X X52, X0, X X9, X0, X X32, X0, X X25, X0, X X12, X0, X X14, X0, X X11, X0, X X40, X0, X X41, X0, X X26, X0, X X55, X0, X X37, X0, X X36, X0, X X27, X0, X X50, X0, X X35, X0, X X3, X0, X0}; X# define YYTYPE int Xstruct yywork { YYTYPE verify, advance; } yycrank[] = { X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 1,3, 0,0, 0,0, X0,0, 0,0, 0,0, 1,4, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 1,5, 1,6, X1,7, 1,8, 0,0, 1,9, X1,10, 1,11, 0,0, 0,0, X0,0, 1,12, 1,13, 1,14, X0,0, 1,15, 0,0, 1,16, X1,17, 1,18, 0,0, 0,0, X1,19, 0,0, 0,0, 0,0, X0,0, 0,0, 0,0, 0,0, X0,0, 0,0, 1,5, 1,6, X1,7, 1,8, 6,30, 1,20, X1,10, 1,21, 6,31, 3,25, X7,34, 1,12, 1,13, 1,14, X8,35, 1,22, 3,26, 1,23, X1,17, 1,24, 5,27, 6,32, X1,19, 10,38, 6,33, 9,36, X11,39, 12,40, 5,28, 13,43, X14,45, 12,41, 5,29, 16,53, X9,37, 13,44, 17,54, 12,42, X15,47, 20,63, 18,58, 21,64, X15,48, 22,65, 14,46, 18,59, X15,49, 17,55, 23,53, 15,50, X17,56, 23,66, 15,51, 19,60, X24,67, 17,57, 25,68, 26,69, X15,52, 27,70, 19,61, 28,71, X29,72, 30,73, 31,74, 32,75, X33,76, 19,62, 34,77, 36,78, X37,79, 38,80, 39,81, 40,85, X41,87, 39,82, 42,88, 43,90, X44,91, 45,92, 46,93, 47,94, X48,95, 42,89, 49,96, 50,97, X51,98, 52,100, 53,101, 39,83, X54,102, 55,103, 40,86, 56,104, X57,106, 58,107, 39,84, 51,99, X59,109, 58,108, 60,110, 61,111, X62,112, 63,113, 64,82, 65,96, X66,108, 67,107, 69,117, 68,115, X70,118, 72,119, 73,120, 74,121, X65,114, 75,122, 76,123, 77,124, X78,126, 79,128, 78,127, 80,129, X81,130, 82,131, 83,132, 64,84, X68,116, 85,133, 86,135, 87,136, X77,125, 89,137, 90,138, 91,139, X92,140, 94,141, 95,143, 96,145, X97,146, 99,147, 101,148, 103,149, X105,150, 85,134, 106,151, 95,144, X107,152, 108,153, 109,154, 111,155, X112,156, 94,142, 113,157, 115,158, X116,159, 117,160, 118,161, 119,162, X122,163, 125,164, 126,165, 127,166, X128,167, 129,169, 130,170, 131,171, X56,105, 132,172, 134,173, 135,174, X136,175, 140,176, 141,177, 142,178, X143,179, 145,180, 146,181, 151,182, X155,183, 156,184, 157,185, 158,186, X159,187, 160,188, 161,189, 162,190, X163,191, 164,192, 166,193, 167,194, X168,195, 170,196, 172,197, 174,198, X128,168, 175,199, 176,200, 177,201, X178,202, 181,203, 183,204, 184,205, X185,206, 194,207, 195,208, 202,209, X204,210, 205,211, 206,212, 211,213, X0,0}; Xstruct yysvf yysvec[] = { X0, 0, 0, Xyycrank+1, 0, 0, Xyycrank+0, yysvec+1, 0, Xyycrank+3, 0, 0, Xyycrank+0, 0, yyvstop+1, Xyycrank+16, 0, 0, Xyycrank+5, 0, 0, Xyycrank+11, 0, 0, Xyycrank+1, 0, 0, Xyycrank+15, 0, 0, Xyycrank+7, 0, 0, Xyycrank+23, 0, 0, Xyycrank+24, 0, 0, Xyycrank+16, 0, 0, Xyycrank+31, 0, 0, Xyycrank+39, 0, 0, Xyycrank+20, 0, 0, Xyycrank+37, 0, 0, Xyycrank+24, 0, 0, Xyycrank+54, 0, 0, Xyycrank+20, yysvec+9, 0, Xyycrank+38, 0, 0, Xyycrank+36, yysvec+15, 0, Xyycrank+35, 0, 0, Xyycrank+38, yysvec+18, 0, Xyycrank+53, 0, 0, Xyycrank+37, 0, 0, Xyycrank+43, 0, 0, Xyycrank+59, 0, 0, Xyycrank+59, 0, 0, Xyycrank+47, 0, 0, Xyycrank+61, 0, 0, Xyycrank+66, 0, 0, Xyycrank+49, 0, 0, Xyycrank+52, 0, 0, Xyycrank+0, 0, yyvstop+3, Xyycrank+56, 0, 0, Xyycrank+58, 0, 0, Xyycrank+72, 0, 0, Xyycrank+73, 0, 0, Xyycrank+74, 0, 0, Xyycrank+65, 0, 0, Xyycrank+71, 0, 0, Xyycrank+67, 0, 0, Xyycrank+61, 0, 0, Xyycrank+61, 0, 0, Xyycrank+62, 0, 0, Xyycrank+65, 0, 0, Xyycrank+83, 0, 0, Xyycrank+81, 0, 0, Xyycrank+82, 0, 0, Xyycrank+84, 0, 0, Xyycrank+75, 0, 0, Xyycrank+75, 0, 0, Xyycrank+76, 0, 0, Xyycrank+78, 0, 0, Xyycrank+159, 0, 0, Xyycrank+75, 0, 0, Xyycrank+92, 0, 0, Xyycrank+91, 0, 0, Xyycrank+77, 0, 0, Xyycrank+78, 0, 0, Xyycrank+83, 0, 0, Xyycrank+91, 0, 0, Xyycrank+102, 0, 0, Xyycrank+102, 0, 0, Xyycrank+99, 0, 0, Xyycrank+104, 0, 0, Xyycrank+110, 0, 0, Xyycrank+105, 0, 0, Xyycrank+111, 0, 0, Xyycrank+0, 0, yyvstop+5, Xyycrank+99, 0, 0, Xyycrank+103, 0, 0, Xyycrank+101, 0, 0, Xyycrank+103, 0, 0, Xyycrank+110, 0, 0, Xyycrank+114, 0, 0, Xyycrank+99, 0, 0, Xyycrank+185, 0, yyvstop+7, Xyycrank+114, 0, 0, Xyycrank+106, 0, 0, Xyycrank+118, 0, 0, Xyycrank+121, 0, 0, Xyycrank+0, 0, yyvstop+9, Xyycrank+123, 0, 0, Xyycrank+194, 0, 0, Xyycrank+122, 0, 0, Xyycrank+0, 0, yyvstop+11, Xyycrank+126, 0, 0, Xyycrank+130, 0, 0, Xyycrank+115, 0, 0, Xyycrank+115, 0, 0, Xyycrank+0, 0, yyvstop+13, Xyycrank+133, 0, 0, Xyycrank+135, 0, 0, Xyycrank+136, 0, 0, Xyycrank+139, 0, 0, Xyycrank+0, 0, yyvstop+15, Xyycrank+123, 0, 0, Xyycrank+0, 0, yyvstop+17, Xyycrank+122, 0, 0, Xyycrank+0, 0, yyvstop+19, Xyycrank+120, 0, 0, Xyycrank+0, 0, yyvstop+21, Xyycrank+132, 0, 0, Xyycrank+133, 0, 0, Xyycrank+143, 0, 0, Xyycrank+142, 0, 0, Xyycrank+143, 0, 0, Xyycrank+0, 0, yyvstop+23, Xyycrank+215, 0, 0, Xyycrank+140, 0, 0, Xyycrank+218, 0, yyvstop+25, Xyycrank+0, 0, yyvstop+27, Xyycrank+137, 0, 0, Xyycrank+151, 0, 0, Xyycrank+139, 0, 0, Xyycrank+149, 0, 0, Xyycrank+216, 0, 0, Xyycrank+0, 0, yyvstop+29, Xyycrank+0, 0, yyvstop+31, Xyycrank+157, 0, 0, Xyycrank+0, 0, yyvstop+33, Xyycrank+0, 0, yyvstop+35, Xyycrank+146, 0, 0, Xyycrank+144, 0, 0, Xyycrank+158, 0, 0, Xyycrank+189, 0, 0, Xyycrank+151, 0, 0, Xyycrank+230, 0, 0, Xyycrank+162, 0, 0, Xyycrank+233, 0, 0, Xyycrank+0, 0, yyvstop+37, Xyycrank+165, 0, 0, Xyycrank+150, 0, 0, Xyycrank+158, 0, 0, Xyycrank+0, 0, yyvstop+39, Xyycrank+0, 0, yyvstop+41, Xyycrank+0, 0, yyvstop+43, Xyycrank+155, 0, 0, Xyycrank+159, 0, 0, Xyycrank+161, 0, 0, Xyycrank+171, 0, 0, Xyycrank+0, 0, yyvstop+45, Xyycrank+172, 0, 0, Xyycrank+159, 0, 0, Xyycrank+0, 0, yyvstop+47, Xyycrank+0, 0, yyvstop+49, Xyycrank+0, 0, yyvstop+51, Xyycrank+0, 0, yyvstop+53, Xyycrank+163, 0, 0, Xyycrank+0, 0, yyvstop+55, Xyycrank+0, 0, yyvstop+57, Xyycrank+0, 0, yyvstop+59, Xyycrank+166, 0, 0, Xyycrank+177, 0, 0, Xyycrank+175, 0, 0, Xyycrank+247, 0, 0, Xyycrank+248, 0, 0, Xyycrank+249, 0, 0, Xyycrank+182, 0, 0, Xyycrank+167, 0, 0, Xyycrank+180, 0, 0, Xyycrank+169, 0, 0, Xyycrank+0, 0, yyvstop+61, Xyycrank+172, 0, 0, Xyycrank+170, 0, 0, Xyycrank+171, 0, 0, Xyycrank+0, 0, yyvstop+63, Xyycrank+257, 0, 0, Xyycrank+0, 0, yyvstop+65, Xyycrank+258, 0, 0, Xyycrank+0, 0, yyvstop+67, Xyycrank+176, 0, 0, Xyycrank+190, 0, 0, Xyycrank+193, 0, 0, Xyycrank+185, 0, 0, Xyycrank+195, 0, 0, Xyycrank+0, 0, yyvstop+69, Xyycrank+0, 0, yyvstop+71, Xyycrank+196, 0, 0, Xyycrank+0, 0, yyvstop+73, Xyycrank+187, 0, 0, Xyycrank+189, 0, yyvstop+75, Xyycrank+183, 0, 0, Xyycrank+0, 0, yyvstop+77, Xyycrank+0, 0, yyvstop+79, Xyycrank+0, 0, yyvstop+81, Xyycrank+0, 0, yyvstop+83, Xyycrank+0, 0, yyvstop+85, Xyycrank+0, 0, yyvstop+87, Xyycrank+0, 0, yyvstop+89, Xyycrank+0, 0, yyvstop+91, Xyycrank+180, 0, 0, Xyycrank+181, 0, 0, Xyycrank+0, 0, yyvstop+93, Xyycrank+0, 0, yyvstop+95, Xyycrank+0, 0, yyvstop+97, Xyycrank+0, 0, yyvstop+99, Xyycrank+0, 0, yyvstop+101, Xyycrank+0, 0, yyvstop+103, Xyycrank+189, 0, 0, Xyycrank+0, 0, yyvstop+105, Xyycrank+188, 0, 0, Xyycrank+266, 0, 0, Xyycrank+185, 0, 0, Xyycrank+0, 0, yyvstop+107, Xyycrank+0, 0, yyvstop+109, Xyycrank+0, 0, yyvstop+111, Xyycrank+0, 0, yyvstop+113, Xyycrank+191, 0, 0, Xyycrank+0, 0, yyvstop+115, Xyycrank+0, 0, yyvstop+117, X0, 0, 0}; Xstruct yywork *yytop = yycrank+307; Xstruct yysvf *yybgin = yysvec+1; Xchar yymatch[] = { X00 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , X01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , X01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , X01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , X01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , X01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , X01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , X01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , X01 ,'A' ,'B' ,'C' ,'D' ,01 ,'F' ,'G' , X'H' ,01 ,01 ,01 ,'L' ,'M' ,'N' ,01 , X'P' ,01 ,'R' ,'S' ,'T' ,01 ,01 ,'W' , X01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , X01 ,'A' ,'B' ,'C' ,'D' ,01 ,'F' ,'G' , X'H' ,01 ,01 ,01 ,'L' ,'M' ,'N' ,01 , X'P' ,01 ,'r' ,'S' ,'t' ,01 ,01 ,'W' , X01 ,01 ,01 ,01 ,01 ,01 ,01 ,01 , X0}; Xchar yyextra[] = { X0,0,0,0,0,0,0,0, X0,0,0,0,0,0,0,0, X0,0,0,0,0,0,0,0, X0,0,0,0,0,0,0,0, X0,0,0,0,0,0,0,0, X0,0,0,0,0,0,0,0, X0,0,0,0,0,0,0,0, X0,0,0,0,0,0,0,0, X0}; X#ident "@(#)libl:lib/ncform 1.3" Xint yylineno =1; X# define YYU(x) x X# define NLSTATE yyprevious=YYNEWLINE Xchar yytext[YYLMAX]; Xstruct yysvf *yylstate [YYLMAX], **yylsp, **yyolsp; Xchar yysbuf[YYLMAX]; Xchar *yysptr = yysbuf; Xint *yyfnd; Xextern struct yysvf *yyestate; Xint yyprevious = YYNEWLINE; Xyylook(){ X register struct yysvf *yystate, **lsp; X register struct yywork *yyt; X struct yysvf *yyz; X int yych, yyfirst; X struct yywork *yyr; X# ifdef LEXDEBUG X int debug; X# endif X char *yylastch; X /* start off machines */ X# ifdef LEXDEBUG X debug = 0; X# endif X yyfirst=1; X if (!yymorfg) X yylastch = yytext; X else { X yymorfg=0; X yylastch = yytext+yyleng; X } X for(;;){ X lsp = yylstate; X yyestate = yystate = yybgin; X if (yyprevious==YYNEWLINE) yystate++; X for (;;){ X# ifdef LEXDEBUG X if(debug)fprintf(yyout,"state %d\n",yystate-yysvec-1); X# endif X yyt = yystate->yystoff; X if(yyt == yycrank && !yyfirst){ /* may not be any transitions */ X yyz = yystate->yyother; X if(yyz == 0)break; X if(yyz->yystoff == yycrank)break; X } X *yylastch++ = yych = input(); X yyfirst=0; X tryagain: X# ifdef LEXDEBUG X if(debug){ X fprintf(yyout,"char "); X allprint(yych); X putchar('\n'); X } X# endif X yyr = yyt; X if ( (int)yyt > (int)yycrank){ X yyt = yyr + yych; X if (yyt <= yytop && yyt->verify+yysvec == yystate){ X if(yyt->advance+yysvec == YYLERR) /* error transitions */ X {unput(*--yylastch);break;} X *lsp++ = yystate = yyt->advance+yysvec; X goto contin; X } X } X# ifdef YYOPTIM X else if((int)yyt < (int)yycrank) { /* r < yycrank */ X yyt = yyr = yycrank+(yycrank-yyt); X# ifdef LEXDEBUG X if(debug)fprintf(yyout,"compressed state\n"); X# endif X yyt = yyt + yych; X if(yyt <= yytop && yyt->verify+yysvec == yystate){ X if(yyt->advance+yysvec == YYLERR) /* error transitions */ X {unput(*--yylastch);break;} X *lsp++ = yystate = yyt->advance+yysvec; X goto contin; X } X yyt = yyr + YYU(yymatch[yych]); X# ifdef LEXDEBUG X if(debug){ X fprintf(yyout,"try fall back character "); X allprint(YYU(yymatch[yych])); X putchar('\n'); X } X# endif X if(yyt <= yytop && yyt->verify+yysvec == yystate){ X if(yyt->advance+yysvec == YYLERR) /* error transition */ X {unput(*--yylastch);break;} X *lsp++ = yystate = yyt->advance+yysvec; X goto contin; X } X } X if ((yystate = yystate->yyother) && (yyt= yystate->yystoff) != yycrank){ X# ifdef LEXDEBUG X if(debug)fprintf(yyout,"fall back to state %d\n",yystate-yysvec-1); X# endif X goto tryagain; X } X# endif X else X {unput(*--yylastch);break;} X contin: X# ifdef LEXDEBUG X if(debug){ X fprintf(yyout,"state %d char ",yystate-yysvec-1); X allprint(yych); X putchar('\n'); X } X# endif X ; X } X# ifdef LEXDEBUG X if(debug){ X fprintf(yyout,"stopped at %d with ",*(lsp-1)-yysvec-1); X allprint(yych); X putchar('\n'); X } X# endif X while (lsp-- > yylstate){ X *yylastch-- = 0; X if (*lsp != 0 && (yyfnd= (*lsp)->yystops) && *yyfnd > 0){ X yyolsp = lsp; X if(yyextra[*yyfnd]){ /* must backup */ X while(yyback((*lsp)->yystops,-*yyfnd) != 1 && lsp > yylstate){ X lsp--; X unput(*yylastch--); X } X } X yyprevious = YYU(*yylastch); X yylsp = lsp; X yyleng = yylastch-yytext+1; X yytext[yyleng] = 0; X# ifdef LEXDEBUG X if(debug){ X fprintf(yyout,"\nmatch "); X sprint(yytext); X fprintf(yyout," action %d\n",*yyfnd); X } X# endif X return(*yyfnd++); X } X unput(*yylastch); X } X if (yytext[0] == 0 /* && feof(yyin) */) X { X yysptr=yysbuf; X return(0); X } X yyprevious = yytext[0] = input(); X if (yyprevious>0) X output(yyprevious); X yylastch=yytext; X# ifdef LEXDEBUG X if(debug)putchar('\n'); X# endif X } X } Xyyback(p, m) X int *p; X{ Xif (p==0) return(0); Xwhile (*p) X { X if (*p++ == m) X return(1); X } Xreturn(0); X} X /* the following are only used in the lex library */ Xyyinput(){ X return(input()); X } Xyyoutput(c) X int c; { X output(c); X } Xyyunput(c) X int c; { X unput(c); X } *-*-END-of-lex.yy.c-*-* echo x - repunsel.l sed 's/^X//' >repunsel.l <<'*-*-END-of-repunsel.l-*-*' X%e 2000 X%p 5000 X%n 1000 X%k 500 X%a 4000 X%o 2000 XBW [ ] XEW [ .,;!?] X X%{ X char buf[128]; X X%} X X%% X"&" return("ANT"); X[Aa]nd return("ANT"); X[Ww]"ouldn't" return("WOODEN"); X[Ww]ould return("WOOD"); X[Rr]oot return("ROOT"); X[Ss]tump return("STUMP"); X[Tr]rig return("TWIG"); X[Tt]wig return("TWIG"); X[Bb]ranch return("BRANCH"); X[Bb]ark return("BARK"); X[Ll]"et us" return("LETTUCE"); X"Hear " return("'EAR "); X" hear " return(" 'EAR "); X"Here " return("'EAR "); X" here " return(" 'EAR "); X[Ll]og return("LOG"); X[Ll]ong return("LOG"); X[Ll]eave return("LEAF"); X[Ll]eaf return("LEAF"); X[Tt]ree return("TREE"); X[Ss]ap return("SAP"); X[Bb]ush return("BUSH"); X[Hh]edge return("HEDGE"); X[Ff]lour return("FLOWER"); X[Ff]lower return("FLOWER"); X[Pp]ardon return("POD'n"); X[Pp]artner return("POD'ner"); X[Pp]od return("POD"); X[Ss]"o " return("SOIL "); X[Ss]oil return("SOIL"); X[Cc]are return("CARROT"); X[Cc]arrot return("CARROT"); X[Pp]un return("PUN"); X[Aa]fraid return("A FRAYED"); X"fun guy" return("FUNGI"); X"Fun guy" return("FUNGI"); X"Fun Guy" return("FUNGI"); X[Ww]ay return("WHEY"); X[Pp]oor return("SPORE"); X[Ll]iking return("LICHEN"); X[Nn]ature return("NATURE"); X[Mm]ust return("MOSS"); X[Mm]old return("MOLD"); X[Ff]un return("PUN"); X[Ss]low return("SLAW"); X[Nn]ot return("KNOT"); X[Gg]rain return("GRAIN"); X[Dd]o return("DEW"); Xpin return("PINE"); X[Ww]"hy not" return("WALNUT"); X[Hh]ey return("HAY"); X[Aa]"ren't" return("ORANGE"); X[Pp]eace return("PEAS"); X[Pp]iece return("PEAS"); X[Pp]lease return("PEAS"); X[Bb]een return("BEAN"); X" over " return("CLOVER"); X[Pp]eal return("PEEL"); X X%% X X *-*-END-of-repunsel.l-*-* exit