-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdubya.l
225 lines (190 loc) · 7.07 KB
/
dubya.l
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/* GNU Talkfilters
Copyright (C) 1998-2003 Free Software Foundation, Inc.
This file is part of GNU Talkfilters
GNU Talkfilters is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This software is distributed in the hope that it will be amusing, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this software; see the file COPYING. If not, write to the
Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
%option prefix="dubya_yy"
%option outfile="lex.yy.c"
%option noyywrap
%option nowarn
%e 3000
%p 6000
%n 1000
%k 500
%a 4000
%o 2000
%{
#include "common.h"
#include "talkfilters.h"
#define YY_DECL int yylex(gtf_databuf_t *buf)
%}
WB [\n\t ]
WC [A-Za-z']
NW [^A-Za-z']
EOT \4
%s NIW INW
%%
<NIW,INITIAL>{
\<(\/)?[A-Za-z][^\>]*\> gtf_echo(); /* don't damage HTML tags */
[Tt]errorist |
[Oo]sama |
[Bb]in(-|{WB})[Ll]ad(e|i)n { switch(gtf_random(3))
{
case 0: gtf_puts_case("bad guy"); break;
case 1: gtf_puts_case("evildoer"); break;
case 2: gtf_puts_case("terrier"); break;
}
}
[Uu]njustified/{NW} gtf_puts_case("pre-emptive");
[Cc]ontra/{NW} gtf_puts_case("freedom-fighter");
[Un]nder gtf_puts_case("misunder"); BEGIN(INW);
[Mm]isunderstand gtf_puts_case("misunderestimate"); BEGIN(INW);
[Mm]isunderstood gtf_puts_case("misunderestimated"); BEGIN(INW);
[Kk]ill/{NW} gtf_puts_case("oblitifry");
[Kk]illed/{NW} gtf_puts_case("oblitifried");
[Dd]destroy/{NW} gtf_puts_case("destructifry");
[Dd]destroyed/{NW} gtf_puts_case("destructifried");
[Rr]esonat/{NW} gtf_puts_case("resignat");
[Ee]ven(-|{WB})[Hh]anded/{NW} gtf_puts_case("foreign-handed");
[Ee]mbitter gtf_puts_case("embetter"); BEGIN(INW);
[Ff]allability/{NW} gtf_puts_case("fallacy");
[An]tidote/{NW} gtf_puts_case("anecdote");
[Ss]ubliminal/{NW} gtf_puts_case("subliminabable");
[Pp]eacemaker gtf_puts_case("pacemaker"); BEGIN(INW);
[Ii]nvad gtf_puts_case("liberat"); BEGIN(INW);
[Hh]ostage/{NW} gtf_puts_case("hostile");
[Cc]ommensurate/{NW} gtf_puts_case("commiserate");
[Ss]addam/{NW} gtf_puts_case("soddam");
[Nn]uclear gtf_puts_case("nucular"); BEGIN(INW);
[Dd]iplomacy/{NW} gtf_puts_case("a preemptive military strike"); BEGIN(INW);
[Oo]verthrow/{NW} gtf_puts_case("change");
[Gg]overnment(ification)/{NW} gtf_puts_case("regime");
[Oo]il/{NW} |
[Bb]ig{WB}[Bb]usiness/{NW} { switch(gtf_random(3))
{
case 0: gtf_puts_case("freedom"); break;
case 1: gtf_puts_case("democracy"); break;
case 2: gtf_puts_case("liberty"); break;
}
}
[Ii]raq gtf_puts_case("Eyeraq"); BEGIN(INW);
[Ii]ran/{NW} |
[Nn]orth{WB}Korea/{NW} |
[Ss]yria/{NW} |
[Cc]uba/{NW} |
[Ss]udan/{NW} |
[Ll]ibya/{NW} { switch(gtf_random(5))
{
case 0: gtf_puts_case("a rogue state");
break;
case 1: gtf_puts_case("a failed nation");
break;
case 2: gtf_puts_case("a nation in the axis of evil");
break;
case 3: gtf_puts_case("an enemy of freedom");
break;
case 4: gtf_puts_case("a state sponsor of terrorism");
break;
}
}
[Bb]udget/{NW} gtf_puts_case("lot of numbers");
[Dd]emocrats/{NW} |
[Dd]emocratic{WB}[Pp]arty/{NW} gtf_puts_case("the Party o' Cut n' Run");
[Aa]re/{NW} gtf_puts_case("is");
[Rr]esort gtf_puts_case("retort"); BEGIN(INW);
[Rr]eveng gtf_puts_case("justic"); BEGIN(INW);
[Tt]hey{WB}were/{NW} gtf_puts_case("them were");
[Pp]olicy/{NW} gtf_puts_case("policy stuff");
[Aa]re{WB}our/{NW} gtf_puts_case("is our");
[Tt]he{WB}[Ii]nternet/{NW} gtf_puts_case("dark dungeons of the Innurnet");
[Oo]mnipresent/{NW} gtf_puts_case("hemispheric");
[Ss]atirist/{NW} gtf_puts_case("garbage man");
[Ee]ditor/{NW} gtf_puts_case("fucking son of a bitch");
"Dick Cheney" gtf_puts("Big Dick");
"George Bush Sr." |
"George H W Bush" gtf_puts("Daddy"); BEGIN(INW);
[Uu]pset |
[Aa]ggravate |
[Ii]nflame gtf_puts_case("vulcanize"); BEGIN(INW);
[Dd]issent/{NW} gtf_puts_case("Anti-Americanism");
[Dd]issenting/{NW} gtf_puts_case("Unpatriotic");
[Ff]iscal{WB}policy |
[Ee]conomic{WB}(stimulus|reform) gtf_puts_case("Tax cuts"); BEGIN(INW);
[Ee]conomics/{NW} gtf_puts_case("Reaganomics");
[Aa]nd{WB}the/{NW} gtf_puts_case("And -- but first things first. The -- These");
[Ll]eave\. gtf_puts_case("cut n' run.");
{WC} { BEGIN(INW); gtf_echo(); }
}
<INW>{
ic/{NW} gtf_puts_case("ically"); BEGIN(NIW);
al/{NW} gtf_puts_case("abable"); BEGIN(NIW);
ate/{NW} gtf_puts_case("atify"); BEGIN(NIW);
ation/{NW} gtf_puts_case("atification"); BEGIN(NIW);
ct/{NW} gtf_puts_case("ctify"); BEGIN(NIW);
ction/{NW} gtf_puts_case("ctification"); BEGIN(NIW);
ain/{NW} gtf_puts_case("ainify"); BEGIN(NIW);
ent/{NW} gtf_puts_case("entification");
ten/{NW} gtf_puts_case("tenify"); BEGIN(NIW);
ize/{NW} gtf_puts_case("izification"); BEGIN(NIW);
lysis/{NW} gtf_puts_case("lyzation"); BEGIN(NIW);
ing/{NW} gtf_puts_case("in'"); BEGIN(NIW);
"." { switch(gtf_random(10))
{
case 0: gtf_puts_case(". Yee haw!"); break;
case 1: gtf_puts_case(", by golly."); break;
case 2:
case 3: gtf_puts_case(". Stay the course!"); break;
case 4: gtf_puts_case(". I'm the decider!"); break;
default: gtf_echo();
}
BEGIN(NIW);
}
", " { switch(gtf_random(5))
{
case 0: gtf_puts(" -- I think -- "); break;
case 1: gtf_puts(" -- I mean -- "); break;
case 2: gtf_puts(", and uhh... umm..., "); break;
default: gtf_echo();
}
}
{NW} BEGIN(NIW); gtf_unput_last();
}
{EOT} /* ignore trailing EOT character */
. gtf_echo();
%%
#ifdef LIBRARY_MODE
int gtf_filter_dubya(const char *input, char *buf, size_t bufsz)
{
gtf_databuf_t buffer;
YY_BUFFER_STATE _yybuf;
gtf_strbuf_init(&buffer, buf, bufsz);
_yybuf = yy_scan_string(input);
yylex(&buffer);
yy_delete_buffer(_yybuf);
gtf_reset();
return(buffer.overflow);
}
int __gtf_filter_dubya(const char *input, char *buf, size_t bufsz)
{
return(gtf_filter_dubya(input, buf, bufsz));
}
#else /* LIBRARY_MODE */
int main(int argc, char **argv)
{
gtf_parse_args();
gtf_random_seed();
yylex(NULL);
return(EXIT_SUCCESS);
}
#endif /* LIBRARY_MODE */
/* end of source file */