1 /* GNU Talkfilters
2    Copyright (C) 1998-2003 Free Software Foundation, Inc.
3 
4    This file is part of GNU Talkfilters
5 
6    GNU Talkfilters is free software; you can redistribute it and/or
7    modify it under the terms of the GNU General Public License as
8    published by the Free Software Foundation; either version 2, or (at
9    your option) any later version.
10 
11    This software is distributed in the hope that it will be amusing, but
12    WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14    General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with this software; see the file COPYING.  If not, write to the
18    Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20 
21 %option prefix="fudd_yy"
22 %option outfile="lex.yy.c"
23 %option noyywrap
24 
25 %e 2000
26 %p 5000
27 %n 1000
28 %k 500
29 %a 4000
30 %o 2000
31 
32 BW [      ]
33 EW [      .,;!?]
34 EOT	\4
35 
36 %{
37 
38 #include "common.h"
39 #include "talkfilters.h"
40 
41 #define YY_DECL int yylex(gtf_databuf_t *buf)
42 
43 %}
44 
45 %%
46 
47 \<(\/)?[A-Za-z][^\>]*\>      gtf_echo(); // don't damage HTML tags
48 
49 "r"         gtf_printf("w");
50 "l"         gtf_printf("w");
51 "qu"        gtf_printf("qw");
52 "th "       gtf_printf("f ");
53 "th"        gtf_printf("d");
54 "n."        gtf_printf("n, uh-hah-hah-hah. ");
55 "R"         gtf_printf("W");
56 "L"         gtf_printf("W");
57 "Qu"        gtf_printf("Qw");
58 "QU"        gtf_printf("QW");
59 "TH "       gtf_printf("F ");
60 "TH"        gtf_printf("D");
61 "Th"        gtf_printf("D");
62 "N."        gtf_printf("N, uh-hah-hah-hah. ");
63 
64 {EOT}	    /* ignore trailing EOT character */
65 .	    gtf_echo();
66 
67 %%
68 
69 #ifdef LIBRARY_MODE
70 
71 int gtf_filter_fudd(const char *input, char *buf, size_t bufsz)
72   {
73   gtf_databuf_t buffer;
74   YY_BUFFER_STATE _yybuf;
75 
76   gtf_strbuf_init(&buffer, buf, bufsz);
77   _yybuf = yy_scan_string(input);
78   yylex(&buffer);
79   yy_delete_buffer(_yybuf);
80   gtf_reset();
81 
82   return(buffer.overflow);
83   }
84 
__gtf_filter_fudd(const char * input,char * buf,size_t bufsz)85 int __gtf_filter_fudd(const char *input, char *buf, size_t bufsz)
86 {
87   return(gtf_filter_fudd(input, buf, bufsz));
88 }
89 
90 #else /* LIBRARY_MODE */
91 
92 int main(int argc, char **argv)
93   {
94   gtf_parse_args();
95 
96   yylex(NULL);
97 
98   return(EXIT_SUCCESS);
99   }
100 
101 #endif /* LIBRARY_MODE */
102 
103 /* end of source file */
104