* censor: corrected spelling of pyvgbevf, Closes: #172976
[filters.git] / nyc.l
CommitLineData
dc17484a 1%{
2/*
3 * Lex filter to transform plain English into Brooklyn English.
4 * No racial or societal slurs are intended. For amusement only.
5 *
6 * Copyright 1986 by Daniel Klein.
7 *
8 * Reproduction permitted so long as this notice is retained.
9 */
10%}
11BW [ \t]
12SP [ \t]
13EW [ \t.,;!\?$]
14%%
15".so ".*$ printf("%s", yytext);
16[ao]ther printf("%cdder", yytext[0]=='a'?'a':'u');
17[Nn]othing printf("%cuttin'", yytext[0]);
18[Tt]hin printf("%cin", yytext[0]);
19[Tt]hir printf("%coi", yytext[0]);
20[Tt]h[ei] printf("%c%c", caseify('d'), yytext[yyleng-1]);
21[Tt]hat printf("%cat", caseify('d'));
22I'm{SP}going{SP}to printf("I'manna");
23going{SP}to printf("gonna");
24want{SP}to printf("wanna");
25t{SP}you printf("tcha");
26[Dd]id{SP}you{SP}[eaiou] printf("%c'j%c", yytext[0], yytext[yyleng-1]);
27[Dd]id{SP}you printf("%c'ja", yytext[0]);
28[Yy]ou printf("%cuh", yytext[0]);
29[Hh]ow{SP}are{SP}you printf("%cowahrya", yytext[0]);
30[Ww]ith printf("%cit'", yytext[0]);
31[Dd]on't printf("%coan", yytext[0]);
32ldn't |
33dn't printf("n't");
34isn't printf("ain't");
35er{EW} { printf("uh"); plastc(); }
36ing{EW} { printf("in'"); plastc(); }
37[Ww]ord |
38[Hh]eard |
39[BbGgLlPpSs]urg |
40[CcHh][eu]r[ntv] printf("%coi%c", yytext[0], yytext[yyleng-1]);
41[^Mm]mer[^aeiouhrs] printf("%cmoi%c", yytext[0], yytext[yyleng-1]);
42[Oo]re{EW} { printf("%cwh", caseify('a')); plastc(); }
43[Oo]r printf("%cwh", caseify('a'));
44[Oo]f printf("%chv", caseify('u'));
45tion printf("shun");
46alk |
47our[st] |
48or[st] printf("awh%c", yytext[yyleng-1]);
49ause printf("awze");
50[Oo]ff printf("%cwhf", caseify('a'));
51[Ss]tupid printf("%ctoopid", yytext[0]);
52{BW}under printf(" unner");
53{BW}to{EW} { printf(" tuh"); plastc(); }
54[Aa]ctual printf("%cckshul", yytext[0]);
55negro printf("spade");
56[Pp]uerto{SP}[Rr]ican printf("%cpic", caseify('s'));
57[Ii]talian printf("%creaser", caseify('g'));
58[Jj]ewish printf("%cew boy", yytext[0]);
59[Jj]ew printf("%cebe", caseify('h'));
60[a-z]":" { *(yytext+1) = ',';
61 printf("%s like, uhh:",yytext);
62 }
63[a-z]"?" { *(yytext+1) = ',';
64 printf("%s or what?",yytext);
65 }
66! printf("! Okay?");
67[a-z]"." { printf("%s", yytext);expletive();}
68%%
69plastc()
70{
71 unput(yytext[yyleng-1]);
72}
73
74caseify(c)
75char c;
76{
77 if (yytext[0] <= 'Z')
78 return (c - ' ');
79 else
80 return (c);
81}
82
83short count = 0;
84short which = 0;
85
86expletive()
87{
88 if (count++ % 4 == 0) {
89 switch (which++ % 5) {
90 case 0: printf(" Okay?"); break;
91 case 1: printf(" Right?"); break;
92 case 2: printf(" Yuh got me so fahr?"); break;
93 case 3: printf(" Ya' dig?"); break;
94 case 4: printf(" Yuh with me?"); break;
95 }
96 }
97}
This page took 0.015176 seconds and 4 git commands to generate.