Initial revision
[filters.git] / chef.l
CommitLineData
7e3afbba 1%{
2/* chef.x - convert English on stdin to Mock Swedish on stdout
3 *
4 * The WC definition matches any word character, and the NW definition matches
5 * any non-word character. Two start conditions are maintained: INW (in word)
6 * and NIW (not in word). The first rule passes TeX commands without change.
7 *
8 * HISTORY
9 *
10 * Apr 26, 1993; John Hagerman: Added ! and ? to the Bork Bork Bork rule.
11 *
12 * Apr 15, 1992; John Hagerman: Created.
13 */
14
15static int i_seen = 0;
16%}
17
18WC [A-Za-z']
19NW [^A-Za-z']
20
21%start INW NIW
22
23%%
24
25\\[^ \n]+ ECHO;
26
27{NW} { BEGIN NIW; i_seen = 0; ECHO; }
28[.!?]$ { BEGIN NIW; i_seen = 0;
29 printf("%c\nBork Bork Bork!",yytext[0]); }
30
31<NIW>"bork"/{NW} ECHO;
32<NIW>"Bork"/{NW} ECHO;
33
34"an" { BEGIN INW; printf("un"); }
35"An" { BEGIN INW; printf("Un"); }
36"au" { BEGIN INW; printf("oo"); }
37"Au" { BEGIN INW; printf("Oo"); }
38"a"/{WC} { BEGIN INW; printf("e"); }
39"A"/{WC} { BEGIN INW; printf("E"); }
40"en"/{NW} { BEGIN INW; printf("ee"); }
41<INW>"ew" { BEGIN INW; printf("oo"); }
42<INW>"e"/{NW} { BEGIN INW; printf("e-a"); }
43<NIW>"e" { BEGIN INW; printf("i"); }
44<NIW>"E" { BEGIN INW; printf("I"); }
45<INW>"f" { BEGIN INW; printf("ff"); }
46<INW>"ir" { BEGIN INW; printf("ur"); }
47<INW>"i" { BEGIN INW; printf(i_seen++ ? "i" : "ee"); }
48<INW>"ow" { BEGIN INW; printf("oo"); }
49<NIW>"o" { BEGIN INW; printf("oo"); }
50<NIW>"O" { BEGIN INW; printf("Oo"); }
51<INW>"o" { BEGIN INW; printf("u"); }
52"the" { BEGIN INW; printf("zee"); }
53"The" { BEGIN INW; printf("Zee"); }
54"th"/{NW} { BEGIN INW; printf("t"); }
55<INW>"tion" { BEGIN INW; printf("shun"); }
56<INW>"u" { BEGIN INW; printf("oo"); }
57<INW>"U" { BEGIN INW; printf("Oo"); }
58"v" { BEGIN INW; printf("f"); }
59"V" { BEGIN INW; printf("F"); }
60"w" { BEGIN INW; printf("v"); }
61"W" { BEGIN INW; printf("V"); }
62
63. { BEGIN INW; ECHO; }
This page took 0.014214 seconds and 4 git commands to generate.