Initial revision
[filters.git] / buck.l
CommitLineData
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
29char WhAt[]="@(#)Benjamin Elijah Griffin's buck filter for buckwheat (c) 1995\n@(#)$Header:$"
30;
31
32%}
33
34%%
35
36okay printf("otay");
37Okay printf("Otay");
38the printf("da");
39The printf("Da");
40ing[ .,;!?] printf("in'%s",yytext+3);
41" for " printf(" po' ");
42" in " printf(" bin ");
43love printf("nub");
44Love printf("Nub");
45" ll" printf(" d");
46Ll printf("D");
47" l" printf(" w");
48L printf("W");
49ll { printf("ww"); /* hmm, do we really want that? */ }
50l { 1+1; /* cutesy null statement */ }
51" ch" printf(" t");
52Ch printf("T");
53" h" printf(" n");
54H printf("H");
55" r"[aeiou] printf("%s",yytext+2);
56R[aeiou] printf("R%s",toupper(*(yytext+1)));
57r[^ .,;!?] printf("%s",yytext+1);
58" t" printf(" d");
59T printf("D");
60" g" printf(" b");
61G printf("B");
62th printf("d");
63n[a-z][ .,;!?] printf("n%s",yytext+2);
64wi printf("bi");
65Wi printf("Bi");
66" sh" printf(" t");
67Sh printf("T");
68" "s[aeiou] printf(" t%s",yytext+2);
69S[aeiou] printf("T%s",yytext+1);
70" "s[qwrtypsdfghjklzxcvbnm] printf(" %s",yytext+2);
71S[qwrtypsdfghjklzxcvbnm] printf("%s",yytext+1);
72" "c[aou] printf(" %s",yytext+2);
73C[aou] printf("C%c",toupper(*(yytext+1)));
74" "r[aeiou] printf(" %s",yytext+2);
75R[aeiou] printf("R%c",toupper(*(yytext+1)));
76
77. printf("%s",yytext);
78
79%%
80
81main()
82{
83 yylex();
84}
85
This page took 0.014139 seconds and 4 git commands to generate.