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