3 * Lex filter to transform plain English into Cockney English.
4 * No racial or societal slurs are intended. For amusement only.
6 * Copyright 1986 by Daniel Klein.
8 * Reproduction permitted so long as this notice is retained.
22 if (yytext[yyleng-1] == '.')
25 unput(yytext[yyleng-1]);
29 unput(yytext[yyleng-1]);
33 <junk>. { srandom(time(0L)); unput(yytext[0]); BEGIN 0; }
34 {BW}[Tt]he{EW} { ECHO; bloody(); }
35 {BW}[Ss]teal{EW} { printf("%c%cick",yytext[0],yytext[1]-5);
38 {BW}[Ss]tole{EW} { printf("%c%cicked",yytext[0],yytext[1]-5);
43 {BW}was{EW} { printf("%cwuz",yytext[0]); eos(); }
44 [Hh]ello printf("'%cllo", caseify('u'));
45 {BW}[Hh] printf("%c'",yytext[0]);
46 {BW}[Yy]our{EW} { printf("%.2ser",yytext); eos(); }
47 {BW}it{EW} { printf("%.2s'",yytext); eos(); }
48 {BW}go{EW} { printf("%.2sow",yytext); eos(); }
49 {BW}and{EW} { printf("%c'n'",yytext[0]); eos(); }
50 {BW}my{EW} { printf("%.2se",yytext); eos(); }
51 {BW}th(is|at){EW} { printf("%.5s", yytext); eos(); }
52 {BW}[Ww]e{SP}went{EW} |
53 {BW}[Ww]e{SP}had{EW} |
54 {BW}[Ww]e{SP}did{EW} { printf("%.*s",yyleng-1,yytext);
60 {BW}I{SP}did{EW} { I();
65 {BW}I{EW} { I(); eos(); }
67 [Yy]ou{SP}[^aeiouy] { printf("%c'", yytext[0]); plastc(); }
68 [Ww]hat{SP}are{EW} { printf("%cotta", yytext[0]); eos(); }
71 [MmNnRr]other printf("%cuvver",yytext[0]);
72 [MmSs]outh printf("%cowf", yytext[0]);
73 [cYy]outh printf("%coof", yytext[0]);
74 [^o]uth printf("%.2sf",yytext);
76 [AaEeIiOo]th[^em] { printf("%cf",yytext[0]); plastc(); }
78 e[ei]the { printf("%c%cve", yytext[0], yytext[0]); }
80 eeth { printf("%c%cf", yytext[0], yytext[0]); }
81 [aei]the { printf("%cvv",yytext[0]); plastc(); }
83 a[km]e{EW} { printf("i%ce",yytext[1]); eos(); }
84 [^r][Oo]ld printf("%.2swld",yytext);
85 [^AaEeIiOoUu][uo]nd[a-z] printf("%cunn%c",yytext[0],yytext[yyleng-1]);
86 ing{EW} { printf("in'"); eos(); }
87 [^dg]get+[^h] printf("%cge'%c",yytext[0],yytext[yyleng-1]);
90 [rSs]ay{EW} { printf("%cigh",yytext[0]); eos(); }
92 [BbHh]it{EW} { printf("%ci'",yytext[0]); eos(); }
93 ait{EW} { printf("ite"); eos(); }
94 ime{EW} { printf("oime"); eos(); }
95 [^e]ize[^n] printf("%coize%c",yytext[0],yytext[yyleng-1]);
96 [^e]ight printf("%coit",*yytext);
97 [a-z]"?" { *(yytext+1) = ',';
98 printf("%s roit?",yytext);
101 [a-z]"." { printf("%c", yytext[0]); dintI(); }
109 if (yytext[0] <= 'Z')
118 /* extern long random(); */
120 if (random() % 100 < 20)
121 printf("%cOy",yytext[0]);
123 printf("%cI",yytext[0]);
126 static short b_count = 0;
127 static short b_which = 0;
131 if (b_count++ % 2 == 0) {
132 switch (b_which++ % 4) {
133 case 0: printf("bloody "); break;
134 case 1: printf("flinkin' "); break;
135 case 2: printf("bleedin' "); break;
136 case 3: printf("soddin' "); break;
141 static short did = 0;
155 /* extern long random(); */
157 if ((did == 1) && (random() % 100 < 50))
159 else if ((did == 2) && (random() % 100 < 50))
160 printf(", din't we?");
168 /* extern long random(); */
170 switch (random() % 3) {
172 printf("%cknackered", yytext[0]);
175 printf("%cshagged out", yytext[0]);
178 printf("%cdone in", yytext[0]);