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.
36 <junk>. { srandom(time(0L)); unput(yytext[0]); BEGIN 0; }
37 {BW}[Tt]he{EW} { ECHO; bloody(); }
38 {BW}[Ss]teal{EW} { printf("%c%cick",yytext[0],yytext[1]-5);
41 {BW}[Ss]tole{EW} { printf("%c%cicked",yytext[0],yytext[1]-5);
46 {BW}was{EW} { printf("%cwuz",yytext[0]); eos(); }
47 [Hh]ello printf("'%cllo", caseify('u'));
48 {BW}[Hh] printf("%c'",yytext[0]);
49 {BW}[Yy]our{EW} { printf("%.2ser",yytext); eos(); }
50 {BW}it{EW} { printf("%.2s'",yytext); eos(); }
51 {BW}go{EW} { printf("%.2sow",yytext); eos(); }
52 {BW}and{EW} { printf("%c'n'",yytext[0]); eos(); }
53 {BW}my{EW} { printf("%.2se",yytext); eos(); }
54 {BW}th(is|at){EW} { printf("%.5s", yytext); eos(); }
55 {BW}[Ww]e{SP}went{EW} |
56 {BW}[Ww]e{SP}had{EW} |
57 {BW}[Ww]e{SP}did{EW} { printf("%.*s",yyleng-1,yytext);
63 {BW}I{SP}did{EW} { I();
68 {BW}I{EW} { I(); eos(); }
70 [Yy]ou{SP}[^aeiouy] { printf("%c'", yytext[0]); plastc(); }
71 [Ww]hat{SP}are{EW} { printf("%cotta", yytext[0]); eos(); }
74 [MmNnRr]other printf("%cuvver",yytext[0]);
75 [MmSs]outh printf("%cowf", yytext[0]);
76 [cYy]outh printf("%coof", yytext[0]);
77 [^o]uth printf("%.2sf",yytext);
79 [AaEeIiOo]th[^em] { printf("%cf",yytext[0]); plastc(); }
81 e[ei]the { printf("%c%cve", yytext[0], yytext[0]); }
83 eeth { printf("%c%cf", yytext[0], yytext[0]); }
84 [aei]the { printf("%cvv",yytext[0]); plastc(); }
86 a[km]e{EW} { printf("i%ce",yytext[1]); eos(); }
87 [^r][Oo]ld printf("%.2swld",yytext);
88 [^AaEeIiOoUu][uo]nd[a-z] printf("%cunn%c",yytext[0],yytext[yyleng-1]);
89 ing{EW} { printf("in'"); eos(); }
90 [^dg]get+[^h] printf("%cge'%c",yytext[0],yytext[yyleng-1]);
93 [rSs]ay{EW} { printf("%cigh",yytext[0]); eos(); }
95 [BbHh]it{EW} { printf("%ci'",yytext[0]); eos(); }
96 ait{EW} { printf("ite"); eos(); }
97 ime{EW} { printf("oime"); eos(); }
98 [^e]ize[^n] printf("%coize%c",yytext[0],yytext[yyleng-1]);
99 [^e]ight printf("%coit",*yytext);
100 [a-z]"?" { *(yytext+1) = ',';
101 printf("%s roit?",yytext);
104 [a-z]"." { printf("%c", yytext[0]); dintI(); }
111 if (yytext[yyleng-1] == '.')
114 unput(yytext[yyleng-1]);
119 unput(yytext[yyleng-1]);
125 if (yytext[0] <= 'Z')
134 /* extern long random(); */
136 if (random() % 100 < 20)
137 printf("%cOy",yytext[0]);
139 printf("%cI",yytext[0]);
142 static short b_count = 0;
143 static short b_which = 0;
147 if (b_count++ % 2 == 0) {
148 switch (b_which++ % 4) {
149 case 0: printf("bloody "); break;
150 case 1: printf("flinkin' "); break;
151 case 2: printf("bleedin' "); break;
152 case 3: printf("soddin' "); break;
157 static short did = 0;
172 /* extern long random(); */
174 if ((did == 1) && (random() % 100 < 50))
176 else if ((did == 2) && (random() % 100 < 50))
177 printf(", din't we?");
185 /* extern long random(); */
187 switch (random() % 3) {
189 printf("%cknackered", yytext[0]);
192 printf("%cshagged out", yytext[0]);
195 printf("%cdone in", yytext[0]);