7e3afbba |
1 | %e 2000 |
2 | %p 5000 |
3 | %n 1000 |
4 | %k 500 |
5 | %a 4000 |
6 | %o 2000 |
7 | |
8 | %{ |
9 | /* |
10 | ** |
11 | ** The buckwheat filter |
12 | ** by Benjamin Elijah Griffin 29 March 1995 |
13 | ** |
14 | ** A lex utility written as a favor for a friend. (He provided the |
15 | ** rules, I showed him how to make a lex filter out of them.) |
16 | ** |
17 | ** compile like this: |
18 | ** lex buck.l |
19 | ** cc -o buck lex.yy.c -ll |
20 | ** rm lex.yy.c |
21 | ** |
22 | ** use like this: |
23 | ** buck < infile > outfile |
24 | ** or |
25 | ** cat infile | <whatever> | buck | <whatever> > outfile |
26 | ** |
27 | */ |
28 | |
29 | char WhAt[]="@(#)Benjamin Elijah Griffin's buck filter for buckwheat (c) 1995\n@(#)$Header:$" |
30 | ; |
31 | |
32 | %} |
33 | |
34 | %% |
35 | |
36 | okay printf("otay"); |
37 | Okay printf("Otay"); |
38 | the printf("da"); |
39 | The printf("Da"); |
40 | ing[ .,;!?] printf("in'%s",yytext+3); |
41 | " for " printf(" po' "); |
42 | " in " printf(" bin "); |
43 | love printf("nub"); |
44 | Love printf("Nub"); |
45 | " ll" printf(" d"); |
46 | Ll printf("D"); |
47 | " l" printf(" w"); |
48 | L printf("W"); |
49 | ll { printf("ww"); /* hmm, do we really want that? */ } |
50 | l { 1+1; /* cutesy null statement */ } |
51 | " ch" printf(" t"); |
52 | Ch printf("T"); |
53 | " h" printf(" n"); |
54 | H printf("H"); |
55 | " r"[aeiou] printf("%s",yytext+2); |
56 | R[aeiou] printf("R%s",toupper(*(yytext+1))); |
57 | r[^ .,;!?] printf("%s",yytext+1); |
58 | " t" printf(" d"); |
59 | T printf("D"); |
60 | " g" printf(" b"); |
61 | G printf("B"); |
62 | th printf("d"); |
63 | n[a-z][ .,;!?] printf("n%s",yytext+2); |
64 | wi printf("bi"); |
65 | Wi printf("Bi"); |
66 | " sh" printf(" t"); |
67 | Sh printf("T"); |
68 | " "s[aeiou] printf(" t%s",yytext+2); |
69 | S[aeiou] printf("T%s",yytext+1); |
70 | " "s[qwrtypsdfghjklzxcvbnm] printf(" %s",yytext+2); |
71 | S[qwrtypsdfghjklzxcvbnm] printf("%s",yytext+1); |
72 | " "c[aou] printf(" %s",yytext+2); |
73 | C[aou] printf("C%c",toupper(*(yytext+1))); |
74 | " "r[aeiou] printf(" %s",yytext+2); |
75 | R[aeiou] printf("R%c",toupper(*(yytext+1))); |
76 | |
77 | . printf("%s",yytext); |
78 | |
79 | %% |
80 | |
81 | main() |
82 | { |
83 | yylex(); |
84 | } |
85 | |