-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcockney.l
554 lines (515 loc) · 17 KB
/
cockney.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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
/* 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="cockney_yy"
%option outfile="lex.yy.c"
%option noyywrap
%option nowarn
/*
* ken:
* will turn English into Cockney, featuring (dubious) rhyming slang for a lot
* of computer terminology.
*
* Written by Stephen K Mulrine <smulrine%[email protected]>
* Make copies if you want etc.etc.
*
* Contacted author in June 2001, asked him to clarify the license, he replied
* with some improvements and placed the program in the public domain.
* -- Edward Betts <[email protected]> Mon, 11 Jun 2001 12:04:29 +0100
*
* ken is named after Ken the Chirpy Cockney Character from the Viz Comic (tm),
* who speaks somewhat like that.
*/
%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'0-9]
NW [^A-Za-z'0-9]
EOT \4
%s NIW INW
%%
<NIW,INITIAL>{
\<(\/)?[A-Za-z][^\>]*\> gtf_echo(); /* don't damage HTML tags */
[Tt]alk/{NW} gtf_puts_case("go on");
[Tt]alked/{NW} gtf_puts_case("went on");
[Tt]alking/{NW} gtf_puts_case("goin' on");
[Aa]s{WB}soon/{NW} gtf_puts_case("soon");
[Gg]oing{WB}to/{NW} gtf_puts_case("gonna");
[Aa]{WB}try/{NW} gtf_puts_case("a go");
[Oo][Kk]"." |
[Ff]ine/{NW} gtf_puts_case("not so bad");
Take/{NW} gtf_puts_case("'Ave");
take/{NW} gtf_puts_case("'ave");
Take{WB}a{WB}look/{NW} |
Look/{NW} gtf_puts_case("'Ave a look");
take{WB}a{WB}look/{NW} |
look/{NW} gtf_puts_case("'ave a look");
[Hh]onestly/{NW} |
[Ss]eriously/{NW} gtf_puts_case("straight up");
seam/{NW} gtf_puts_case("join");
[Gg]ood/{NW} { if(gtf_random(3) == 0)
gtf_puts_case("right good");
else
gtf_echo();
}
[Ll]end{WB}me/{NW} gtf_puts_case("borrow us");
[Ll]end/{NW} gtf_puts_case("borrow");
[Gg]ive{WB}me/{NW} gtf_puts_case("give us");
[Gg]ive{WB}up/{NW} gtf_puts_case("give over");
[Pp]ut{WB}it/{NW} gtf_puts_case("stick it");
[Pp]ut{WB}those/{NW} gtf_puts_case("stick those");
[Pp]ut{WB}them/{NW} gtf_puts_case("stick 'em");
[Dd]iscussion gtf_puts_case("chat"); BEGIN(INW);
[Tt]ry({WB}it)?/{NW} gtf_puts_case("give it a go");
[Oo]ur/{NW} gtf_puts_case("us");
[Ss]aw/{NW} gtf_puts_case("seen");
[Ss]ee/{NW} gtf_puts_case("spot");
[Ss]ees/{NW} gtf_puts_case("spots");
[Aa]{WB}lot/{NW} gtf_puts_case("a bit");
[Ll]ots{WB}of/{NW} gtf_puts_case("a bit a'");
[Aa]nyway/{NW} gtf_puts_case("any road, so");
[Aa]nyhow/{NW} gtf_puts_case("any road");
Around/{NW} gtf_puts_case("'Round");
around/{NW} gtf_puts_case("'round");
[Pp]ants/{NW} gtf_puts_case("kegs");
[Cc]lothes/{NW} gtf_puts_case("kit");
[Ss]occer/{NW} |
[Ff]ootball/{NW} gtf_puts_case("footie");
[Yy](ou{WB}|')all/{NW} gtf_puts_case("you lot");
[Nn]ude/{NW} gtf_puts_case("buff");
[Nn]aked/{NW} gtf_puts_case("stark bloody naked");
[Pp]laying({WB}around)?/{NW} |
[Hh]aving{WB}fun/{NW} gtf_puts_case("messing");
[Cc]lassy/{NW} gtf_puts_case("posh");
[Gg]et/{NW} gtf_puts_case("cop");
[Gg]etting/{NW} gtf_puts_case("copping");
[Gg]et{WB}me/{NW} gtf_puts_case("get us");
[Dd]own/{NW} gtf_puts_case("dahn");
[Dd]ownstairs/{NW} gtf_puts_case("down the apples and pears");
[Ee]yes/{NW} gtf_puts_case("mince pies");
[Pp]erhaps/{NW} gtf_puts_case("peraps");
[Ss]tairs/{NW} gtf_puts_case("apples and pears");
[Tt]own/{NW} gtf_puts_case("tahn");
[Uu]pstairs/{NW} gtf_puts_case("up the apples and pears");
[Pp]olice/{NW} |
[Cc]ops/{NW} |
[Pp]olice(wo)?men/{NW} gtf_puts_case("bobbies");
[Cc]op/{NW} |
[Pp]olice(wo)?man/{NW} gtf_puts_case("bobby");
[Ss]uit/{NW} gtf_puts_case("whistle and flute");
[Pp]rofessional |
[Ee]xpert gtf_puts_case("ace"); BEGIN(INW);
[Ll]ove gtf_puts_case("luv"); BEGIN(INW);
[Cc]lean gtf_puts_case("tidy"); BEGIN(INW);
[Mm]outh/{NW} gtf_puts_case("North and South");
[Ff]ace/{NW} gtf_puts_case("boat race");
[Tt]rouble/{NW} gtf_puts_case("Barney Rubble");
[Ww]ife/{NW} { switch(gtf_random(2))
{
case 0: gtf_puts_case("trouble and strife"); break;
case 1: gtf_puts_case("ole lady"); break;
}
}
[Rr]oad/{NW} gtf_puts_case("frog and toad");
[Pp]ub/{NW} gtf_puts_case("rub-a-dub");
[Pp]ubs/{NW} gtf_puts_case("rub-a-dubs");
[Bb]ar/{NW} gtf_puts_case("boozer");
[Bb]ars/{NW} gtf_puts_case("boozers");
[Hh]usband/{NW} gtf_puts_case("ole man");
[Pp]arty gtf_puts_case("knees-up");
[Pp]arties/{NW} gtf_puts_case("knees-ups");
[Mm]y/{NW} gtf_puts_case("me");
[Yy]ou/{NW} gtf_puts_case("yer");
[Yy]ou({WB}are|r)? gtf_puts_case("yor");
[Yy]ou({WB}a|')re/{NW} gtf_puts_case("yor");
[Tt]hose/{NW} gtf_puts_case("them");
[Tt]he/{NW} { switch(gtf_random(5))
{
case 0: gtf_puts_case("the bleedin'"); break;
case 1: gtf_puts_case("the bloody"); break;
case 2: gtf_puts_case("the bloomin'"); break;
case 3: gtf_puts_case("the chuffin'"); break;
default: gtf_echo();
}
}
[Tt]his gtf_echo(); BEGIN(INW);
[Tt]hat gtf_echo(); BEGIN(INW);
[Tt]hus/{NW} |
[Hh]ence/{NW} gtf_puts_case("so");
[Tt]han gtf_echo(); BEGIN(INW);
[Ww]ho gtf_echo(); BEGIN(INW);
old/{NW} gtf_puts_case("ole");
to/{NW} gtf_puts("ter");
[Ww]hat gtf_puts_case("wot"); BEGIN(INW);
[Ww]as/{NW} gtf_puts_case("were");
[Aa]ren't{WB}you/{NW} gtf_puts_case("Aintcha ");
[Aa]ren't/{NW} |
[Aa]re{WB}not/{NW} |
[Ii]s({WB}no|n')t/{NW} gtf_puts_case("Ain't");
[Ww]hat({WB}i|')s{WB}that/{NW} gtf_puts_case("wossat");
[Ww]hat({WB}i|')s/{NW} gtf_puts_case("woss");
[Ww]hat({WB}a|')re{WB}you(r)?/{NW} |
[Ww]hat{WB}you({WB}a|')re/{NW} |
[Ww]hat{WB}do{WB}you(r)?/{NW} gtf_puts_case("wotcher");
[Ww]atch{WB}it/{NW} gtf_puts_case("wotchit");
[Ii]({WB}a|')m/{NW} { switch(gtf_random(2))
{ case 0: gtf_puts_case("I'm bloody well"); break;
default: gtf_echo();
}
}
[Ww]hat{WB}is{WB}th gtf_puts_case("Woss"); BEGIN(INW);
[Ww]hat{WB}you({WB}a|')re/{NW} gtf_puts_case("wotcher");
[Ww]hat{WB}(are|do){WB}you(r)? gtf_puts_case("wotcher");
H[aeu]llo/{NW} gtf_puts_case("'Allo");
h[aeu]llo/{NW} gtf_puts_case("'allo");
[Ww]hat gtf_puts_case("wot"); BEGIN(INW);
[Ww]ere/{NW} gtf_puts_case("was");
[Bb]other gtf_puts_case("ars"); BEGIN(INW);
[Bb]oys/{NW} gtf_puts_case("fellas");
[Mm]other gtf_puts_case("Muvver"); BEGIN(INW);
[Mm]om gtf_puts_case("mum"); BEGIN(INW);
[Aa]rrest |
[Ss]teal |
[Bb]ust gtf_puts_case("nick"); BEGIN(INW);
[Ss]tole(n)?/{NW} |
[Hh]andcuffed/{NW} gtf_puts_case("nicked");
[Hh]ell/{NW} gtf_puts_case("hell fire");
[Uu]neployed/{NW} gtf_puts_case("on dole");
[Rr]ude/{NW} |
[Ss]assy/{NW} |
[Ii]mpudent/{NW} gtf_puts_case("cheeky");
[Tt]elephone/{NW} |
[Pp]hone/{NW} gtf_puts_case("dog and bone");
[Pp]erson gtf_puts_case("bloke"); BEGIN(INW);
[Pp]eople gtf_puts_case("blokes"); BEGIN(INW);
([Aa]n{WB})?[Aa]merican/{NW} |
[Yy]ank(ee)?/{NW} gtf_puts_case("a septic tank"); BEGIN(INW);
[Oo]ld{WB}man/{NW} |
[Gg]entleman/{NW} gtf_puts_case("geezer"); BEGIN(INW);
[Oo]ld{WB}men/{NW} |
[Gg]entlemen/{NW} gtf_puts_case("geezers"); BEGIN(INW);
[Gg]uy gtf_puts_case("lad"); BEGIN(INW);
[Ss]omeone/{NW} gtf_puts_case("some bloke");
[Ss]omebody/{NW} gtf_puts_case("some geezer");
[Oo]ther gtf_puts_case("uvver"); BEGIN(INW);
[Aa]nother gtf_puts_case("aunuvver"); BEGIN(INW);
[Hh]i/{NW} gtf_puts_case("oi");
[Ww]ow/{NW} |
[Yy]ay/{NW} |
[Yy]ahoo/{NW} gtf_puts_case("cor");
[Hh]oora(y|h)/{NW} |
[Yy]eehaw/{NW} |
[Gg]eez/{NW} |
[Gg]osh/{NW} |
[Gg]olly/{NW} gtf_puts_case("blimey");
[Hh]ey/{NW} { switch(gtf_random(2))
{ case 0: gtf_puts_case("eh, up"); break;
case 1: gtf_puts_case("oi"); break;
}
}
[Cc]ow/{NW} gtf_puts_case("cah");
[Ss]tate{WB}of{WB}the{WB}art/{NW} gtf_puts_case("top o' the range");
[Ff]ather gtf_puts_case("favver"); BEGIN(INW);
[Rr]ather/{NW} gtf_puts_case("ravver");
[Ww]eather gtf_puts_case("wevver"); BEGIN(INW);
[Ll]eather/{NW} gtf_puts_case("Levver");
[Ww]ither/{NW} gtf_puts_case("wivver");
[Ee]ither/{NW} gtf_puts_case("eever");
[Ss]mart gtf_puts_case("keen"); BEGIN(INW);
[Ww]ith gtf_puts_case("wiv"); BEGIN(INW);
[Aa]nything/{NW} gtf_puts_case("anyfink");
[Ss]omething/{NW} gtf_puts_case("sumfink");
[Nn]othing/{NW} gtf_puts_case("nuffink");
[Ee]verything/{NW} gtf_puts_case("evryfink");
[Vv]ery/{NW} |
[Rr]eally/{NW} gtf_puts_case("right");
[Bb]other/{NW} gtf_puts_case("bovver");
[Dd]umb gtf_puts_case("daft"); BEGIN(INW);
[Cc]ool{WB}it/{NW} |
[Cc]hill{WB}out/{NW} gtf_puts_case("don't get a benny on");
[Ii]mmoral |
[Cc]rude gtf_puts_case("naughty"); BEGIN(INW);
[Pp]rofanity/{NW} gtf_puts_case("naughty language");
[Ss]wear{WB}word gtf_puts_case("naughty word"); BEGIN(INW);
[Gg]et{WB}over/{NW} gtf_puts_case("grow out");
[Gg]ot{WB}over/{NW} gtf_puts_case("grew out");
[Gg]otten{WB}over/{NW} gtf_puts_case("grown out");
[Ss]uppose/{NW} gtf_puts_case("s'pose");
[Kk]ind{WB}of/{NW} gtf_puts_case("sort of");
[Dd]oesn't/{NW} gtf_puts_case("don't");
[Gg]uitar(s)?/{NW} |
[Dd]rum(s)?/{NW} |
[Tt]rumpet(s)?/{NW} |
[Vv]iolin(s)?/{NW} |
[Cc]larinet(s)?/{NW} |
[Tt]rombone(s)?/{NW} |
[Oo]boe(s)?/{NW} |
[Ff]lute(s)?/{NW} |
[Tt]uba(s)?/{NW} gtf_puts_case("spoons");
[Pp]iano/{NW} gtf_puts_case("joanna");
[Dd]ata gtf_puts_case("Info"); BEGIN(INW);
[Dd]irectory/{NW} gtf_puts_case("Lockup");
[Dd]irectories/{NW} gtf_puts_case("Lockups");
[Pp]rocess { switch(gtf_random(2))
{
case 0: gtf_puts_case("Queen Bess"); break;
case 1: gtf_puts_case("Rudolf 'Ess"); break;
}
}
[Cc]omputer gtf_puts_case("French Tutor"); BEGIN(INW);
[Bb]yte gtf_puts_case("Jimmy White"); BEGIN(INW);
[Ff]iles gtf_puts_case("Nobby Stiles"); BEGIN(INW);
[Ff]ile gtf_puts_case("Royal Mile"); BEGIN(INW);
[Ll]anguage gtf_puts_case("'Am Sandwich"); BEGIN(INW);
[Zz]ero gtf_puts_case("Emperor Nero"); BEGIN(INW);
[Jj]ob gtf_puts_case("Uncle Bob"); BEGIN(INW);
[Ss]hell gtf_puts_case("Bow Bell"); BEGIN(INW);
[Ss]ave gtf_puts_case("Chas'n'Dave"); BEGIN(INW);
[Ll]oad gtf_puts_case("Old Kent Road"); BEGIN(INW);
[Mm]ouse gtf_puts_case("Doll's 'Ouse"); BEGIN(INW);
[Bb]uffer gtf_puts_case("Sausage Stuffer"); BEGIN(INW);
[Kk]eyboard gtf_puts_case("Henry Ford"); BEGIN(INW);
[Mm]anual gtf_puts_case("Cocker Spaniel"); BEGIN(INW);
[Ss]creen gtf_puts_case("James Dean"); BEGIN(INW);
[Pp]rinter gtf_puts_case("'Arold Pinter"); BEGIN(INW);
[Pp]lotter gtf_puts_case("Pansy Potter"); BEGIN(INW);
[Cc]ompiler gtf_puts_case("Martin Tyler"); BEGIN(INW);
[Ss]tring gtf_puts_case("Emperor Ming"); BEGIN(INW);
[Bb]rain gtf_puts_case("Michael Caine"); BEGIN(INW);
[Pp][Aa][Ss][Cc][Aa][Ll]/{NW} { switch(gtf_random(2))
{
case 0: gtf_puts_case("Pall Mall"); break;
case 1: gtf_puts_case("Roald Dahl"); break;
}
}
[Aa][Ll][Gg][Oo][Ll]/{NW} gtf_puts_case("Johnny Ball");
[Ff][Oo][Rr][Tt][Rr][Aa][Nn]/{NW} gtf_puts_case("Manfred Mann");
[Cc][Oo][Bb][Oo][Ll]/{NW} gtf_puts_case("Albert Hall");
C/{NW} { switch(gtf_random(4))
{
case 0: gtf_puts_case("Bruce Lee"); break;
case 1: gtf_puts_case("Circus Flea"); break;
case 2: gtf_puts_case("Bumble Bee"); break;
case 3: gtf_puts_case("Door Key"); break;
}
}
[Jj]ava/{NW} gtf_puts_case("Wot a palavah");
[Ww][aA][pP]/{NW} gtf_puts_case("Pony and trap");
[Ll]oon(e)?y |
[Ff]ruitcake |
[Nn]utcase gtf_puts_case("nutter"); BEGIN(INW);
[Bb]ook gtf_puts_case("butcher's hook"); BEGIN(INW);
[Ss]topped/{NW} gtf_puts_case("'Ad the mockers put on");
[Ss]topping/{NW} gtf_puts_case("Putting the mockers on");
stops/{NW} gtf_puts_case("puts the mockers on");
[Ss]top/{NW} gtf_puts_case("put the mockers on");
[Ll]ondoner gtf_puts_case("Cockney"); BEGIN(INW);
[Hh] gtf_puts_case("'"); BEGIN(INW);
[Mm]ini(ature)? |
[Tt]iny |
[Ll]ittle |
[Ss]mall gtf_puts_case("wee"); BEGIN(INW);
[Mm]oney/{NW} gtf_puts_case("brass");
[Pp]al/{NW} |
[Bb]uddy/{NW} gtf_puts_case("mate");
[Pp]als/{NW} gtf_puts_case("mates");
[Ff]riend { switch(gtf_random(3))
{
case 0: gtf_puts_case("mucker"); break;
case 1: gtf_puts_case("mate"); break;
case 2: gtf_puts_case("china"); break;
}
BEGIN(INW);
}
[Ww]oman/{NW} { switch(gtf_random(4))
{ case 0: gtf_puts_case("bint"); break;
case 1: gtf_puts_case("cow"); break;
case 2: gtf_puts_case("lass"); break;
case 3: gtf_puts_case("tart"); break;
}
}
[Ww]omen/{NW} { switch(gtf_random(4))
{ case 0: gtf_puts_case("bints"); break;
case 1: gtf_puts_case("cows"); break;
case 2: gtf_puts_case("ruddy ladies"); break;
case 3: gtf_puts_case("tarts"); break;
}
}
[Tt]hing { switch(gtf_random(2))
{ case 0: gtf_puts_case("fink");
case 1: gtf_puts_case("bugger");
}
BEGIN(INW);
}
[Dd]evil |
[Rr]ascal |
[Aa]sshole |
[Dd]ork |
[Dd]olt |
[Nn]erd |
[Ii]diot { switch(gtf_random(6))
{ case 0: gtf_puts_case("bog eyes"); break;
case 1: gtf_puts_case("poof"); break;
case 2: gtf_puts_case("git"); break;
case 3: gtf_puts_case("fairy"); break;
case 4: gtf_puts_case("tosser"); break;
case 5: gtf_puts_case("divvy"); break;
}
BEGIN(INW);
}
[Bb]e{WB}quiet/{NW} |
[Ss]hut{WB}up/{NW} { switch(gtf_random(2))
{ case 0: gtf_puts_case("shut it"); break;
default: gtf_puts_case("Button it"); break;
}
}
[Aa]l(l{WB})?right/{NW} { switch(gtf_random(3))
{ case 0: gtf_puts_case("arright"); break;
case 1: gtf_puts_case("awright"); break;
case 2: gtf_puts_case("right"); break;
}
}
[Cc]igarette gtf_puts_case("fag"); BEGIN(INW);
[Gg]oing/{NW} gtf_puts_case("gahn");
[Bb]ring |
[Ss]ting |
[Ss]wing |
[CcFfSs]ling |
[BbKkMmPpRrSsWw]ing gtf_echo(); BEGIN(INW);
[Tt]here |
[Tt]hey |
[Tt]his |
[Tt]hat gtf_echo(); BEGIN(INW);
Th gtf_puts("F"); BEGIN(INW);
[Mm]r"."/{NW} gtf_puts("Guvnor");
[Ww]hy |
[Ww]here | gtf_echo(); BEGIN(INW);
[Ww]h gtf_puts_case("W"); BEGIN(INW);
[Oo]f/{NW} gtf_puts_case("o'");
{WC} { BEGIN(INW); gtf_echo(); }
}
<INW>{
[Aa]{WB}h gtf_puts_case("an '");
aw gtf_puts_case("or");
ing/{NW} gtf_puts_case("in'"); BEGIN(NIW);
"." { switch(gtf_random(32))
{
case 0:
gtf_puts_case(". I'll get out me spoons.");
break;
case 1:
gtf_puts_case(". Yer can't 'ave a knees-up wivout a joanna.");
break;
case 2:
gtf_puts_case(". Cor blimey guv, would I lie to you.");
break;
case 3:
gtf_puts_case(". I'll make us all a nice cup a' tea.");
break;
case 4:
gtf_puts_case(", do wot Guvnor!");
break;
case 5:
gtf_puts_case(", right?");
break;
case 6:
gtf_puts_case(". Right.");
break;
case 7:
case 8:
gtf_puts_case(", i'n it?");
break;
default:
gtf_echo();
}
BEGIN(NIW);
}
"?" { if(gtf_random(3) == 0)
gtf_puts(", isit?");
else
{
switch(gtf_random(4))
{
case 0: gtf_puts(", then"); break;
case 1: gtf_puts(", eh"); break;
case 2: gtf_puts(", then, eh"); break;
}
switch(gtf_random(6))
{
case 0: gtf_puts(", mate?"); break;
case 1: gtf_puts(", guv?"); break;
case 2: gtf_puts(", squire?"); break;
case 3: gtf_puts(", luv?"); break;
default: gtf_echo();
}
}
}
, { if(gtf_random(3) == 0)
gtf_puts(", right,");
else
gtf_echo();
}
! { switch(gtf_random(7))
{
case 0: gtf_puts_case("! Blimey!"); break;
case 1: gtf_puts_case("! Struth!"); break;
case 2: gtf_puts_case("! Right!"); break;
case 3: gtf_puts_case(", guv!"); break;
case 4: gtf_puts_case("! Honest, guv!"); break;
case 5: gtf_puts_case("! Oi!"); break;
case 6: gtf_puts_case(", mate!"); break;
default: gtf_echo();
}
}
{NW} BEGIN(NIW); unput(yytext[0]);
}
{EOT} /* ignore trailing EOT character */
. gtf_echo();
%%
#ifdef LIBRARY_MODE
int gtf_filter_cockney(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_cockney(const char *input, char *buf, size_t bufsz)
{
return(gtf_filter_cockney(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 */