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.
19 <junk>. { srandom(time(0L)); unput(yytext[0]); BEGIN 0; }
20 {BW}[Tt]he{EW} { ECHO; bloody(); }
21 {BW}[Ss]teal{EW} { printf("%c%cick",yytext[0],yytext[1]-5);
24 {BW}[Ss]tole{EW} { printf("%c%cicked",yytext[0],yytext[1]-5);
29 {BW}was{EW} { printf("%cwuz",yytext[0]); eos(); }
30 [Hh]ello printf("'%cllo", caseify('u'));
31 {BW}[Hh] printf("%c'",yytext[0]);
32 {BW}[Yy]our{EW} { printf("%.2ser",yytext); eos(); }
33 {BW}it{EW} { printf("%.2s'",yytext); eos(); }
34 {BW}go{EW} { printf("%.2sow",yytext); eos(); }
35 {BW}and{EW} { printf("%c'n'",yytext[0]); eos(); }
36 {BW}my{EW} { printf("%.2se",yytext); eos(); }
37 {BW}th(is|at){EW} { printf("%.5s", yytext); eos(); }
38 {BW}[Ww]e{SP}went{EW} |
39 {BW}[Ww]e{SP}had{EW} |
40 {BW}[Ww]e{SP}did{EW} { printf("%.*s",yyleng-1,yytext);
46 {BW}I{SP}did{EW} { I();
51 {BW}I{EW} { I(); eos(); }
53 [Yy]ou{SP}[^aeiouy] { printf("%c'", yytext[0]); plastc(); }
54 [Ww]hat{SP}are{EW} { printf("%cotta", yytext[0]); eos(); }
57 [MmNnRr]other printf("%cuvver",yytext[0]);
58 [MmSs]outh printf("%cowf", yytext[0]);
59 [cYy]outh printf("%coof", yytext[0]);
60 [^o]uth printf("%.2sf",yytext);
62 [AaEeIiOo]th[^em] { printf("%cf",yytext[0]); plastc(); }
64 e[ei]the { printf("%c%cve", yytext[0], yytext[0]); }
66 eeth { printf("%c%cf", yytext[0], yytext[0]); }
67 [aei]the { printf("%cvv",yytext[0]); plastc(); }
69 a[km]e{EW} { printf("i%ce",yytext[1]); eos(); }
70 [^r][Oo]ld printf("%.2swld",yytext);
71 [^AaEeIiOoUu][uo]nd[a-z] printf("%cunn%c",yytext[0],yytext[yyleng-1]);
72 ing{EW} { printf("in'"); eos(); }
73 [^dg]get+[^h] printf("%cge'%c",yytext[0],yytext[yyleng-1]);
76 [rSs]ay{EW} { printf("%cigh",yytext[0]); eos(); }
78 [BbHh]it{EW} { printf("%ci'",yytext[0]); eos(); }
79 ait{EW} { printf("ite"); eos(); }
80 ime{EW} { printf("oime"); eos(); }
81 [^e]ize[^n] printf("%coize%c",yytext[0],yytext[yyleng-1]);
82 [^e]ight printf("%coit",*yytext);
83 [a-z]"?" { *(yytext+1) = ',';
84 printf("%s roit?",yytext);
87 [a-z]"." { printf("%c", yytext[0]); dintI(); }
94 if (yytext[yyleng-1] == '.')
97 unput(yytext[yyleng-1]);
102 unput(yytext[yyleng-1]);
108 if (yytext[0] <= 'Z')
117 /* extern long random(); */
119 if (random() % 100 < 20)
120 printf("%cOy",yytext[0]);
122 printf("%cI",yytext[0]);
125 static short b_count = 0;
126 static short b_which = 0;
130 if (b_count++ % 2 == 0) {
131 switch (b_which++ % 4) {
132 case 0: printf("bloody "); break;
133 case 1: printf("flinkin' "); break;
134 case 2: printf("bleedin' "); break;
135 case 3: printf("soddin' "); break;
140 static short did = 0;
154 /* extern long random(); */
156 if ((did == 1) && (random() % 100 < 50))
158 else if ((did == 2) && (random() % 100 < 50))
159 printf(", din't we?");
167 /* extern long random(); */
169 switch (random() % 3) {
171 printf("%cknackered", yytext[0]);
174 printf("%cshagged out", yytext[0]);
177 printf("%cdone in", yytext[0]);