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