Also close bug
[filters.git] / jive.l
1 %{
2 /*
3 * Lex filter to transform plain English into Jive English.
4 * No racial or societal slurs are intended. For amusement only.
5 *
6 * Copyright 1986 by Daniel Klein and Clement Cole.
7 *
8 * Reproduction permitted so long as this notice is retained.
9 */
10
11 %}
12 %e 1700
13 %p 4000
14 %n 700
15 %k 450
16 %a 1700
17 %o 1500
18 BW [ \t\(]
19 EW [ \t.,;!\?$\)]
20 %option noyywrap
21
22 %{
23 void plastc(void);
24 char caseify(char);
25 void expletive(void);
26 void thing(char);
27 %}
28
29 %%
30
31 @[Bb]egin(.*) |
32 ".so ".*$ printf("%s", yytext);
33 {BW}send printf("%ct'row",yytext[0]);
34 program+ printf("honky code");
35 [Uu]nix printf("slow mo-fo");
36 UNIX printf("dat slow mo-fo");
37 actual printf("ak'shul");
38 {BW}take printf("%csnatch",yytext[0]);
39 {BW}took |
40 {BW}take[ns] printf("%csnatch'd",yytext[0]);
41 [Mm]exican printf("%cet-back", caseify('w'));
42 [Ii]talian printf("%creaser", caseify('g'));
43 {BW}big{EW} { printf("%cbig ass",yytext[0]);plastc();}
44 fool printf("honkyfool");
45 modem printf("doodad");
46 {BW}he{EW} { printf("%cmah' man he",yytext[0]);plastc();}
47 "e the"{EW} |
48 "a the"{EW} |
49 "t the"{EW} |
50 "d the"{EW} { printf("%c da damn", yytext[0]);plastc();}
51 wife |
52 woman printf("mama");
53 girl printf("goat");
54 something printf("sump'n");
55 {BW}lie printf("%chonky jive",yytext[0]);
56 -o- printf("-on rebound-");
57 [a-z]"." { printf("%s", yytext);expletive();}
58 ! printf(". Right On!");
59 [Ss]ure printf("%cho'", yytext[0]);
60 get printf("git");
61 "will have"{EW} |
62 "will"{EW} |
63 "got to"{EW} { printf("gots'ta");plastc();}
64 "I am" printf("I's gots'ta be");
65 "aren't" |
66 "am not" |
67 "have not" |
68 "is not" |
69 "are not" printf("ain't");
70 {BW}see{EW} { printf("%csee's",yytext[0]);plastc();}
71 {BW}are{EW} { printf("%cis",yytext[0]);plastc();}
72 {BW}hat{EW} { printf("%cfedora",yytext[0]);plastc();}
73 {BW}shoe printf("%ckicker",yytext[0]);
74 {BW}"have to"{EW} |
75 {BW}has{EW} { printf("%cgots'ta",yytext[0]);plastc();}
76 have printf("gots'");
77 {BW}go{EW} |
78 {BW}"come over"{EW} |
79 {BW}come{EW} { printf("%cmosey on down",yytext[0]);plastc();}
80 buy printf("steal");
81 {BW}car{EW} { printf("%cwheels",yytext[0]);plastc();}
82 drive printf("roll");
83 {BW}food printf("%ccatfish an' colluhd greens",yytext[0]);
84 {BW}eat{EW} { printf("%cfeed da bud",yytext[0]);plastc();}
85 drink printf("guzzle");
86 black |
87 negro printf("brother");
88 white printf("honky");
89 nigger printf("gentleman");
90 nice printf("supa' fine");
91 {BW}person printf("%csucka'",yytext[0]);
92 [Pp]eople printf("%cucka's", caseify('s'));
93 {BW}thing thing(yytext[0]);
94 house{EW} { printf("crib");plastc();}
95 home printf("plantation");
96 name printf("dojigger");
97 {BW}path printf("%calley",yytext[0]);
98 [Cc]omputer printf("%clunker", yytext[0]);
99 or printf("o'");
100 president printf("super-dude");
101 "prime minister" printf("prahm mistah");
102 government printf("guv'ment");
103 knew printf("knowed");
104 [Bb]ecause printf("'%cuz", caseify('c'));
105 [Yy]our printf("%co'", yytext[0]);
106 [Ff]our printf("%coe", yytext[0]);
107 got printf("gots");
108 young printf("yung");
109 you printf("ya'");
110 You printf("You's");
111 first printf("fust");
112 police printf("honky pigs");
113 {BW}string printf("%cchittlin'",yytext[0]);
114 {BW}read printf("%ceyeball",yytext[0]);
115 write printf("scribble");
116 think{EW} { printf("thin'");plastc();}
117 with printf("wif");
118 other printf("uthu'");
119 [Tt]hr printf("%c'r", yytext[0]);
120 [Tt]h printf("%c", caseify('d'));
121 ing printf("in'");
122 {BW}a{EW} { printf("%csome",yytext[0]);plastc();}
123 {BW}to{EW} { printf("%ct'",yytext[0]);
124 if(yytext[yyleng-1]!=' ')
125 plastc();
126 }
127 tion printf("shun");
128 [Aa]lmost printf("%cos'", caseify('m'));
129 from printf("fum");
130 [Yy]"ou're" printf("%couse", yytext[0]);
131 alright |
132 okay printf("coo'");
133 [Aa]nd printf("%cn'", yytext[0]);
134 known printf("knode");
135 want printf("wants'");
136 beat printf("whup'ed");
137 ile printf("ah'l");
138 er{EW} { printf("uh");plastc();}
139 [a-z]sti printf("%cs'i", yytext[0]);
140 tute printf("toot");
141 exp printf("'sp");
142 exs |
143 exc printf("'s");
144 {BW}ex printf("%c'es",yytext[0]);
145 [ae]ct{EW} { printf("%cc'", yytext[0]); plastc(); }
146 like printf("likes");
147 done |
148 did printf("dun did");
149 "kind of" printf("kind'a");
150 women printf("honky chicks");
151 {BW}man{EW} { printf("%cdude",yytext[0]);plastc();}
152 {BW}men{EW} |
153 {BW}mens{EW} { printf("%cdudes",yytext[0]);plastc();}
154 injured printf("hosed");
155 killed |
156 dead printf("wasted");
157 good printf("baaaad");
158 open{EW} { printf("jimmey");plastc();}
159 opened{EW} { printf("jimmey'd");plastc();}
160 {BW}very printf("%creal",yytext[0]);
161 per printf("puh'");
162 oar printf("o'");
163 {BW}can printf("%ckin",yytext[0]);
164 {BW}just{EW} { printf("%cplum",yytext[0]);plastc();}
165 [Dd]etroit printf("Mo-town");
166 [Ww]"estern "[Ee]"lectric" printf("da' cave");
167 {BW}believe printf("%crecon'",yytext[0]);
168 [Ii]"ndianapolis" printf("Nap-town");
169 Daniel |
170 Dan printf("Liva' Lips");
171 Reagan printf("Kingfish");
172 Ronald{EW} |
173 Ron{EW} { printf("Rolo");plastc();}
174 John printf("Rastus");
175 Jim printf("Bo-Jangles");
176 pontiff |
177 pope printf("wiz'");
178 [Pp]ravda printf("dat commie rag");
179 broken printf("bugger'd");
180 strange{EW} { printf("funky");plastc();}
181 dance{EW} { printf("boogy");plastc();}
182 ask printf("ax'");
183 {BW}so{EW} { printf("%cso's",yytext[0]);plastc();}
184 heard printf("'hoid");
185 head printf("'haid");
186 boss printf("main man");
187 money printf("bre'd");
188 [a-z]":" { *(yytext+1) = ',';
189 printf("%s dig dis:",yytext);
190 }
191 amateur printf("begina'");
192 radio printf("transista'");
193 {BW}of{EW} { printf("%cuh",yytext[0]);plastc();}
194 which |
195 what printf("whut");
196 "don't" printf("doan'");
197 does printf("duz");
198 {BW}was{EW} |
199 {BW}were{EW} { printf("%cwuz",yytext[0]);plastc();}
200 {BW}understand printf("%cdig",yytext[0]);
201 {BW}my printf("%cmah'",yytext[0]);
202 again |
203 against printf("agin'");
204 {BW}[Ii]{EW} { printf("%cah'",yytext[0]);plastc();}
205 meta printf("meta-fuckin'");
206 cally printf("c'l");
207 %%
208
209 void plastc()
210 {
211 unput(yytext[yyleng-1]);
212 }
213
214 char caseify(c)
215 char c;
216 {
217 if (yytext[0] <= 'Z')
218 return (c - ' ');
219 else
220 return (c);
221 }
222
223 void thing(c)
224 char c;
225 {
226 static short count = 0;
227
228 putchar(c);
229 switch (count++ % 4) {
230 case 0: case 2:
231 printf("thang");
232 break;
233 case 1:
234 printf("doohickey");
235 break;
236 case 3:
237 printf("wahtahmellun");
238 break;
239 }
240 }
241
242 void expletive()
243 {
244 static short count = 0;
245 static short which = 0;
246
247 if (count++ % 4 == 0) {
248 switch (which++ % 5) {
249 case 0: printf(" What it is, Mama!"); break;
250 case 1: printf(" Ya' know?"); break;
251 case 2: printf(" Sheeeiit."); break;
252 case 3: printf(" Ya' dig?"); break;
253 case 4: printf(" Git down!"); break;
254 }
255 }
256 }
257
258 /*
259 * Bugs:
260 *
261 * If a sentence starts with a keyword it doan' get converted, or:
262 * it do, but gets a leading space
263 */
This page took 0.028995 seconds and 4 git commands to generate.