]>
Commit | Line | Data |
---|---|---|
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 | %} | |
11 | BW [ \t] | |
12 | SP [ \t] | |
13 | EW [ \t.,;!\?$] | |
ff7b4674 | 14 | |
fb5da53f | 15 | %{ |
1d0bdb96 MG |
16 | void plastc(void); |
17 | char caseify(char); | |
18 | void expletive(void); | |
fb5da53f | 19 | %} |
1d0bdb96 MG |
20 | |
21 | %% | |
dc17484a | 22 | ".so ".*$ printf("%s", yytext); |
23 | [ao]ther printf("%cdder", yytext[0]=='a'?'a':'u'); | |
24 | [Nn]othing printf("%cuttin'", yytext[0]); | |
25 | [Tt]hin printf("%cin", yytext[0]); | |
26 | [Tt]hir printf("%coi", yytext[0]); | |
27 | [Tt]h[ei] printf("%c%c", caseify('d'), yytext[yyleng-1]); | |
28 | [Tt]hat printf("%cat", caseify('d')); | |
29 | I'm{SP}going{SP}to printf("I'manna"); | |
30 | going{SP}to printf("gonna"); | |
31 | want{SP}to printf("wanna"); | |
32 | t{SP}you printf("tcha"); | |
33 | [Dd]id{SP}you{SP}[eaiou] printf("%c'j%c", yytext[0], yytext[yyleng-1]); | |
34 | [Dd]id{SP}you printf("%c'ja", yytext[0]); | |
35 | [Yy]ou printf("%cuh", yytext[0]); | |
36 | [Hh]ow{SP}are{SP}you printf("%cowahrya", yytext[0]); | |
37 | [Ww]ith printf("%cit'", yytext[0]); | |
38 | [Dd]on't printf("%coan", yytext[0]); | |
39 | ldn't | | |
40 | dn't printf("n't"); | |
41 | isn't printf("ain't"); | |
42 | er{EW} { printf("uh"); plastc(); } | |
43 | ing{EW} { printf("in'"); plastc(); } | |
44 | [Ww]ord | | |
45 | [Hh]eard | | |
46 | [BbGgLlPpSs]urg | | |
47 | [CcHh][eu]r[ntv] printf("%coi%c", yytext[0], yytext[yyleng-1]); | |
48 | [^Mm]mer[^aeiouhrs] printf("%cmoi%c", yytext[0], yytext[yyleng-1]); | |
49 | [Oo]re{EW} { printf("%cwh", caseify('a')); plastc(); } | |
50 | [Oo]r printf("%cwh", caseify('a')); | |
51 | [Oo]f printf("%chv", caseify('u')); | |
52 | tion printf("shun"); | |
53 | alk | | |
54 | our[st] | | |
55 | or[st] printf("awh%c", yytext[yyleng-1]); | |
56 | ause printf("awze"); | |
57 | [Oo]ff printf("%cwhf", caseify('a')); | |
58 | [Ss]tupid printf("%ctoopid", yytext[0]); | |
59 | {BW}under printf(" unner"); | |
60 | {BW}to{EW} { printf(" tuh"); plastc(); } | |
61 | [Aa]ctual printf("%cckshul", yytext[0]); | |
62 | negro printf("spade"); | |
63 | [Pp]uerto{SP}[Rr]ican printf("%cpic", caseify('s')); | |
64 | [Ii]talian printf("%creaser", caseify('g')); | |
65 | [Jj]ewish printf("%cew boy", yytext[0]); | |
66 | [Jj]ew printf("%cebe", caseify('h')); | |
67 | [a-z]":" { *(yytext+1) = ','; | |
68 | printf("%s like, uhh:",yytext); | |
69 | } | |
70 | [a-z]"?" { *(yytext+1) = ','; | |
71 | printf("%s or what?",yytext); | |
72 | } | |
73 | ! printf("! Okay?"); | |
74 | [a-z]"." { printf("%s", yytext);expletive();} | |
75 | %% | |
dc17484a | 76 | |
ff7b4674 JH |
77 | void plastc() |
78 | { | |
79 | yyunput(yytext[yyleng-1], yytext); | |
80 | } | |
81 | ||
1d0bdb96 | 82 | char caseify(c) |
dc17484a | 83 | char c; |
84 | { | |
85 | if (yytext[0] <= 'Z') | |
86 | return (c - ' '); | |
87 | else | |
88 | return (c); | |
89 | } | |
90 | ||
91 | short count = 0; | |
92 | short which = 0; | |
93 | ||
1d0bdb96 | 94 | void expletive() |
dc17484a | 95 | { |
96 | if (count++ % 4 == 0) { | |
97 | switch (which++ % 5) { | |
98 | case 0: printf(" Okay?"); break; | |
99 | case 1: printf(" Right?"); break; | |
100 | case 2: printf(" Yuh got me so fahr?"); break; | |
101 | case 3: printf(" Ya' dig?"); break; | |
102 | case 4: printf(" Yuh with me?"); break; | |
103 | } | |
104 | } | |
105 | } | |
7f4e9d5e | 106 | |
7f4e9d5e | 107 | int yywrap() |
108 | { | |
109 | return 1; | |
110 | } |