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="cockney_yy" 22 %option outfile="lex.yy.c" 23 %option noyywrap 24 %option nowarn 25 26 /* 27 * ken: 28 * will turn English into Cockney, featuring (dubious) rhyming slang for a lot 29 * of computer terminology. 30 * 31 * Written by Stephen K Mulrine <smulrine%cs.strath.ac.uk@nsfnet-relay.ac.uk> 32 * Make copies if you want etc.etc. 33 * 34 * Contacted author in June 2001, asked him to clarify the license, he replied 35 * with some improvements and placed the program in the public domain. 36 * -- Edward Betts <edward@debian.org> Mon, 11 Jun 2001 12:04:29 +0100 37 * 38 * ken is named after Ken the Chirpy Cockney Character from the Viz Comic (tm), 39 * who speaks somewhat like that. 40 */ 41 42 43 %e 3000 44 %p 6000 45 %n 1000 46 %k 500 47 %a 4000 48 %o 2000 49 50 %{ 51 52 #include "common.h" 53 #include "talkfilters.h" 54 55 #define YY_DECL int yylex(gtf_databuf_t *buf) 56 57 %} 58 59 WB [\n\t ] 60 WC [A-Za-z'0-9] 61 NW [^A-Za-z'0-9] 62 EOT \4 63 64 %s NIW INW 65 66 %% 67 68 <NIW,INITIAL>{ 69 70 \<(\/)?[A-Za-z][^\>]*\> gtf_echo(); // don't damage HTML tags 71 72 [Tt]alk/{NW} gtf_puts_case("go on"); 73 [Tt]alked/{NW} gtf_puts_case("went on"); 74 [Tt]alking/{NW} gtf_puts_case("goin' on"); 75 [Aa]s{WB}soon/{NW} gtf_puts_case("soon"); 76 [Gg]oing{WB}to/{NW} gtf_puts_case("gonna"); 77 [Aa]{WB}try/{NW} gtf_puts_case("a go"); 78 [Oo][Kk]"." | 79 [Ff]ine/{NW} gtf_puts_case("not so bad"); 80 Take/{NW} gtf_puts_case("'Ave"); 81 take/{NW} gtf_puts_case("'ave"); 82 Take{WB}a{WB}look/{NW} | 83 Look/{NW} gtf_puts_case("'Ave a look"); 84 take{WB}a{WB}look/{NW} | 85 look/{NW} gtf_puts_case("'ave a look"); 86 [Hh]onestly/{NW} | 87 [Ss]eriously/{NW} gtf_puts_case("straight up"); 88 seam/{NW} gtf_puts_case("join"); 89 [Gg]ood/{NW} { if(gtf_random(3) == 0) 90 gtf_puts_case("right good"); 91 else 92 gtf_echo(); 93 } 94 [Ll]end{WB}me/{NW} gtf_puts_case("borrow us"); 95 [Ll]end/{NW} gtf_puts_case("borrow"); 96 [Gg]ive{WB}me/{NW} gtf_puts_case("give us"); 97 [Gg]ive{WB}up/{NW} gtf_puts_case("give over"); 98 [Pp]ut{WB}it/{NW} gtf_puts_case("stick it"); 99 [Pp]ut{WB}those/{NW} gtf_puts_case("stick those"); 100 [Pp]ut{WB}them/{NW} gtf_puts_case("stick 'em"); 101 [Dd]iscussion gtf_puts_case("chat"); BEGIN(INW); 102 [Tt]ry({WB}it)?/{NW} gtf_puts_case("give it a go"); 103 [Oo]ur/{NW} gtf_puts_case("us"); 104 [Ss]aw/{NW} gtf_puts_case("seen"); 105 [Ss]ee/{NW} gtf_puts_case("spot"); 106 [Ss]ees/{NW} gtf_puts_case("spots"); 107 [Aa]{WB}lot/{NW} gtf_puts_case("a bit"); 108 [Ll]ots{WB}of/{NW} gtf_puts_case("a bit a'"); 109 [Aa]nyway/{NW} gtf_puts_case("any road, so"); 110 [Aa]nyhow/{NW} gtf_puts_case("any road"); 111 Around/{NW} gtf_puts_case("'Round"); 112 around/{NW} gtf_puts_case("'round"); 113 [Pp]ants/{NW} gtf_puts_case("kegs"); 114 [Cc]lothes/{NW} gtf_puts_case("kit"); 115 [Ss]occer/{NW} | 116 [Ff]ootball/{NW} gtf_puts_case("footie"); 117 [Yy](ou{WB}|')all/{NW} gtf_puts_case("you lot"); 118 [Nn]ude/{NW} gtf_puts_case("buff"); 119 [Nn]aked/{NW} gtf_puts_case("stark bloody naked"); 120 [Pp]laying({WB}around)?/{NW} | 121 [Hh]aving{WB}fun/{NW} gtf_puts_case("messing"); 122 [Cc]lassy/{NW} gtf_puts_case("posh"); 123 [Gg]et/{NW} gtf_puts_case("cop"); 124 [Gg]etting/{NW} gtf_puts_case("copping"); 125 [Gg]et{WB}me/{NW} gtf_puts_case("get us"); 126 [Dd]own/{NW} gtf_puts_case("dahn"); 127 [Dd]ownstairs/{NW} gtf_puts_case("down the apples and pears"); 128 [Ee]yes/{NW} gtf_puts_case("mince pies"); 129 [Pp]erhaps/{NW} gtf_puts_case("peraps"); 130 [Ss]tairs/{NW} gtf_puts_case("apples and pears"); 131 [Tt]own/{NW} gtf_puts_case("tahn"); 132 [Uu]pstairs/{NW} gtf_puts_case("up the apples and pears"); 133 [Pp]olice/{NW} | 134 [Cc]ops/{NW} | 135 [Pp]olice(wo)?men/{NW} gtf_puts_case("bobbies"); 136 [Cc]op/{NW} | 137 [Pp]olice(wo)?man/{NW} gtf_puts_case("bobby"); 138 [Ss]uit/{NW} gtf_puts_case("whistle and flute"); 139 [Pp]rofessional | 140 [Ee]xpert gtf_puts_case("ace"); BEGIN(INW); 141 [Ll]ove gtf_puts_case("luv"); BEGIN(INW); 142 [Cc]lean gtf_puts_case("tidy"); BEGIN(INW); 143 [Mm]outh/{NW} gtf_puts_case("North and South"); 144 [Ff]ace/{NW} gtf_puts_case("boat race"); 145 [Tt]rouble/{NW} gtf_puts_case("Barney Rubble"); 146 [Ww]ife/{NW} { switch(gtf_random(2)) 147 { 148 case 0: gtf_puts_case("trouble and strife"); break; 149 case 1: gtf_puts_case("ole lady"); break; 150 } 151 } 152 [Rr]oad/{NW} gtf_puts_case("frog and toad"); 153 [Pp]ub/{NW} gtf_puts_case("rub-a-dub"); 154 [Pp]ubs/{NW} gtf_puts_case("rub-a-dubs"); 155 [Bb]ar/{NW} gtf_puts_case("boozer"); 156 [Bb]ars/{NW} gtf_puts_case("boozers"); 157 [Hh]usband/{NW} gtf_puts_case("ole man"); 158 [Pp]arty gtf_puts_case("knees-up"); 159 [Pp]arties/{NW} gtf_puts_case("knees-ups"); 160 [Mm]y/{NW} gtf_puts_case("me"); 161 [Yy]ou/{NW} gtf_puts_case("yer"); 162 [Yy]ou({WB}are|r)? gtf_puts_case("yor"); 163 [Yy]ou({WB}a|')re/{NW} gtf_puts_case("yor"); 164 [Tt]hose/{NW} gtf_puts_case("them"); 165 [Tt]he/{NW} { switch(gtf_random(5)) 166 { 167 case 0: gtf_puts_case("the bleedin'"); break; 168 case 1: gtf_puts_case("the bloody"); break; 169 case 2: gtf_puts_case("the bloomin'"); break; 170 case 3: gtf_puts_case("the chuffin'"); break; 171 default: gtf_echo(); 172 } 173 } 174 [Tt]his gtf_echo(); BEGIN(INW); 175 [Tt]hat gtf_echo(); BEGIN(INW); 176 [Tt]hus/{NW} | 177 [Hh]ence/{NW} gtf_puts_case("so"); 178 [Tt]han gtf_echo(); BEGIN(INW); 179 [Ww]ho gtf_echo(); BEGIN(INW); 180 old/{NW} gtf_puts_case("ole"); 181 to/{NW} gtf_puts("ter"); 182 [Ww]hat gtf_puts_case("wot"); BEGIN(INW); 183 [Ww]as/{NW} gtf_puts_case("were"); 184 [Aa]ren't{WB}you/{NW} gtf_puts_case("Aintcha "); 185 [Aa]ren't/{NW} | 186 [Aa]re{WB}not/{NW} | 187 [Ii]s({WB}no|n')t/{NW} gtf_puts_case("Ain't"); 188 [Ww]hat({WB}i|')s{WB}that/{NW} gtf_puts_case("wossat"); 189 [Ww]hat({WB}i|')s/{NW} gtf_puts_case("woss"); 190 [Ww]hat({WB}a|')re{WB}you(r)?/{NW} | 191 [Ww]hat{WB}you({WB}a|')re/{NW} | 192 [Ww]hat{WB}do{WB}you(r)?/{NW} gtf_puts_case("wotcher"); 193 [Ww]atch{WB}it/{NW} gtf_puts_case("wotchit"); 194 [Ii]({WB}a|')m/{NW} { switch(gtf_random(2)) 195 { case 0: gtf_puts_case("I'm bloody well"); break; 196 default: gtf_echo(); 197 } 198 } 199 [Ww]hat{WB}is{WB}th gtf_puts_case("Woss"); BEGIN(INW); 200 [Ww]hat{WB}you({WB}a|')re/{NW} gtf_puts_case("wotcher"); 201 [Ww]hat{WB}(are|do){WB}you(r)? gtf_puts_case("wotcher"); 202 H[aeu]llo/{NW} gtf_puts_case("'Allo"); 203 h[aeu]llo/{NW} gtf_puts_case("'allo"); 204 [Ww]hat gtf_puts_case("wot"); BEGIN(INW); 205 [Ww]ere/{NW} gtf_puts_case("was"); 206 [Bb]other gtf_puts_case("ars"); BEGIN(INW); 207 [Bb]oys/{NW} gtf_puts_case("fellas"); 208 [Mm]other gtf_puts_case("Muvver"); BEGIN(INW); 209 [Mm]om gtf_puts_case("mum"); BEGIN(INW); 210 [Aa]rrest | 211 [Ss]teal | 212 [Bb]ust gtf_puts_case("nick"); BEGIN(INW); 213 [Ss]tole(n)?/{NW} | 214 [Hh]andcuffed/{NW} gtf_puts_case("nicked"); 215 [Hh]ell/{NW} gtf_puts_case("hell fire"); 216 [Uu]neployed/{NW} gtf_puts_case("on dole"); 217 [Rr]ude/{NW} | 218 [Ss]assy/{NW} | 219 [Ii]mpudent/{NW} gtf_puts_case("cheeky"); 220 [Tt]elephone/{NW} | 221 [Pp]hone/{NW} gtf_puts_case("dog and bone"); 222 [Pp]erson gtf_puts_case("bloke"); BEGIN(INW); 223 [Pp]eople gtf_puts_case("blokes"); BEGIN(INW); 224 ([Aa]n{WB})?[Aa]merican/{NW} | 225 [Yy]ank(ee)?/{NW} gtf_puts_case("a septic tank"); BEGIN(INW); 226 [Oo]ld{WB}man/{NW} | 227 [Gg]entleman/{NW} gtf_puts_case("geezer"); BEGIN(INW); 228 [Oo]ld{WB}men/{NW} | 229 [Gg]entlemen/{NW} gtf_puts_case("geezers"); BEGIN(INW); 230 [Gg]uy gtf_puts_case("lad"); BEGIN(INW); 231 [Ss]omeone/{NW} gtf_puts_case("some bloke"); 232 [Ss]omebody/{NW} gtf_puts_case("some geezer"); 233 [Oo]ther gtf_puts_case("uvver"); BEGIN(INW); 234 [Aa]nother gtf_puts_case("aunuvver"); BEGIN(INW); 235 [Hh]i/{NW} gtf_puts_case("oi"); 236 [Ww]ow/{NW} | 237 [Yy]ay/{NW} | 238 [Yy]ahoo/{NW} gtf_puts_case("cor"); 239 [Hh]oora(y|h)/{NW} | 240 [Yy]eehaw/{NW} | 241 [Gg]eez/{NW} | 242 [Gg]osh/{NW} | 243 [Gg]olly/{NW} gtf_puts_case("blimey"); 244 [Hh]ey/{NW} { switch(gtf_random(2)) 245 { case 0: gtf_puts_case("eh, up"); break; 246 case 1: gtf_puts_case("oi"); break; 247 } 248 } 249 [Cc]ow/{NW} gtf_puts_case("cah"); 250 [Ss]tate{WB}of{WB}the{WB}art/{NW} gtf_puts_case("top o' the range"); 251 [Ff]ather gtf_puts_case("favver"); BEGIN(INW); 252 [Rr]ather/{NW} gtf_puts_case("ravver"); 253 [Ww]eather gtf_puts_case("wevver"); BEGIN(INW); 254 [Ll]eather/{NW} gtf_puts_case("Levver"); 255 [Ww]ither/{NW} gtf_puts_case("wivver"); 256 [Ee]ither/{NW} gtf_puts_case("eever"); 257 [Ss]mart gtf_puts_case("keen"); BEGIN(INW); 258 [Ww]ith gtf_puts_case("wiv"); BEGIN(INW); 259 [Aa]nything/{NW} gtf_puts_case("anyfink"); 260 [Ss]omething/{NW} gtf_puts_case("sumfink"); 261 [Nn]othing/{NW} gtf_puts_case("nuffink"); 262 [Ee]verything/{NW} gtf_puts_case("evryfink"); 263 [Vv]ery/{NW} | 264 [Rr]eally/{NW} gtf_puts_case("right"); 265 [Bb]other/{NW} gtf_puts_case("bovver"); 266 [Dd]umb gtf_puts_case("daft"); BEGIN(INW); 267 [Cc]ool{WB}it/{NW} | 268 [Cc]hill{WB}out/{NW} gtf_puts_case("don't get a benny on"); 269 [Ii]mmoral | 270 [Cc]rude gtf_puts_case("naughty"); BEGIN(INW); 271 [Pp]rofanity/{NW} gtf_puts_case("naughty language"); 272 [Ss]wear{WB}word gtf_puts_case("naughty word"); BEGIN(INW); 273 [Gg]et{WB}over/{NW} gtf_puts_case("grow out"); 274 [Gg]ot{WB}over/{NW} gtf_puts_case("grew out"); 275 [Gg]otten{WB}over/{NW} gtf_puts_case("grown out"); 276 [Ss]uppose/{NW} gtf_puts_case("s'pose"); 277 [Kk]ind{WB}of/{NW} gtf_puts_case("sort of"); 278 [Dd]oesn't/{NW} gtf_puts_case("don't"); 279 [Gg]uitar(s)?/{NW} | 280 [Dd]rum(s)?/{NW} | 281 [Tt]rumpet(s)?/{NW} | 282 [Vv]iolin(s)?/{NW} | 283 [Cc]larinet(s)?/{NW} | 284 [Tt]rombone(s)?/{NW} | 285 [Oo]boe(s)?/{NW} | 286 [Ff]lute(s)?/{NW} | 287 [Tt]uba(s)?/{NW} gtf_puts_case("spoons"); 288 [Pp]iano/{NW} gtf_puts_case("joanna"); 289 290 [Dd]ata gtf_puts_case("Info"); BEGIN(INW); 291 [Dd]irectory/{NW} gtf_puts_case("Lockup"); 292 [Dd]irectories/{NW} gtf_puts_case("Lockups"); 293 [Pp]rocess { switch(gtf_random(2)) 294 { 295 case 0: gtf_puts_case("Queen Bess"); break; 296 case 1: gtf_puts_case("Rudolf 'Ess"); break; 297 } 298 } 299 [Cc]omputer gtf_puts_case("French Tutor"); BEGIN(INW); 300 [Bb]yte gtf_puts_case("Jimmy White"); BEGIN(INW); 301 [Ff]iles gtf_puts_case("Nobby Stiles"); BEGIN(INW); 302 [Ff]ile gtf_puts_case("Royal Mile"); BEGIN(INW); 303 [Ll]anguage gtf_puts_case("'Am Sandwich"); BEGIN(INW); 304 [Zz]ero gtf_puts_case("Emperor Nero"); BEGIN(INW); 305 [Jj]ob gtf_puts_case("Uncle Bob"); BEGIN(INW); 306 [Ss]hell gtf_puts_case("Bow Bell"); BEGIN(INW); 307 [Ss]ave gtf_puts_case("Chas'n'Dave"); BEGIN(INW); 308 [Ll]oad gtf_puts_case("Old Kent Road"); BEGIN(INW); 309 [Mm]ouse gtf_puts_case("Doll's 'Ouse"); BEGIN(INW); 310 [Bb]uffer gtf_puts_case("Sausage Stuffer"); BEGIN(INW); 311 [Kk]eyboard gtf_puts_case("Henry Ford"); BEGIN(INW); 312 [Mm]anual gtf_puts_case("Cocker Spaniel"); BEGIN(INW); 313 [Ss]creen gtf_puts_case("James Dean"); BEGIN(INW); 314 [Pp]rinter gtf_puts_case("'Arold Pinter"); BEGIN(INW); 315 [Pp]lotter gtf_puts_case("Pansy Potter"); BEGIN(INW); 316 [Cc]ompiler gtf_puts_case("Martin Tyler"); BEGIN(INW); 317 [Ss]tring gtf_puts_case("Emperor Ming"); BEGIN(INW); 318 [Bb]rain gtf_puts_case("Michael Caine"); BEGIN(INW); 319 [Pp][Aa][Ss][Cc][Aa][Ll]/{NW} { switch(gtf_random(2)) 320 { 321 case 0: gtf_puts_case("Pall Mall"); break; 322 case 1: gtf_puts_case("Roald Dahl"); break; 323 } 324 } 325 [Aa][Ll][Gg][Oo][Ll]/{NW} gtf_puts_case("Johnny Ball"); 326 [Ff][Oo][Rr][Tt][Rr][Aa][Nn]/{NW} gtf_puts_case("Manfred Mann"); 327 [Cc][Oo][Bb][Oo][Ll]/{NW} gtf_puts_case("Albert Hall"); 328 C/{NW} { switch(gtf_random(4)) 329 { 330 case 0: gtf_puts_case("Bruce Lee"); break; 331 case 1: gtf_puts_case("Circus Flea"); break; 332 case 2: gtf_puts_case("Bumble Bee"); break; 333 case 3: gtf_puts_case("Door Key"); break; 334 } 335 } 336 [Jj]ava/{NW} gtf_puts_case("Wot a palavah"); 337 [Ww][aA][pP]/{NW} gtf_puts_case("Pony and trap"); 338 [Ll]oon(e)?y | 339 [Ff]ruitcake | 340 [Nn]utcase gtf_puts_case("nutter"); BEGIN(INW); 341 [Bb]ook gtf_puts_case("butcher's hook"); BEGIN(INW); 342 [Ss]topped/{NW} gtf_puts_case("'Ad the mockers put on"); 343 [Ss]topping/{NW} gtf_puts_case("Putting the mockers on"); 344 stops/{NW} gtf_puts_case("puts the mockers on"); 345 [Ss]top/{NW} gtf_puts_case("put the mockers on"); 346 [Ll]ondoner gtf_puts_case("Cockney"); BEGIN(INW); 347 [Hh] gtf_puts_case("'"); BEGIN(INW); 348 [Mm]ini(ature)? | 349 [Tt]iny | 350 [Ll]ittle | 351 [Ss]mall gtf_puts_case("wee"); BEGIN(INW); 352 [Mm]oney/{NW} gtf_puts_case("brass"); 353 [Pp]al/{NW} | 354 [Bb]uddy/{NW} gtf_puts_case("mate"); 355 [Pp]als/{NW} gtf_puts_case("mates"); 356 [Ff]riend { switch(gtf_random(3)) 357 { 358 case 0: gtf_puts_case("mucker"); break; 359 case 1: gtf_puts_case("mate"); break; 360 case 2: gtf_puts_case("china"); break; 361 } 362 BEGIN(INW); 363 } 364 [Ww]oman/{NW} { switch(gtf_random(4)) 365 { case 0: gtf_puts_case("bint"); break; 366 case 1: gtf_puts_case("cow"); break; 367 case 2: gtf_puts_case("lass"); break; 368 case 3: gtf_puts_case("tart"); break; 369 } 370 } 371 [Ww]omen/{NW} { switch(gtf_random(4)) 372 { case 0: gtf_puts_case("bints"); break; 373 case 1: gtf_puts_case("cows"); break; 374 case 2: gtf_puts_case("ruddy ladies"); break; 375 case 3: gtf_puts_case("tarts"); break; 376 } 377 } 378 [Tt]hing { switch(gtf_random(2)) 379 { case 0: gtf_puts_case("fink"); 380 case 1: gtf_puts_case("bugger"); 381 } 382 BEGIN(INW); 383 } 384 [Dd]evil | 385 [Rr]ascal | 386 [Aa]sshole | 387 [Dd]ork | 388 [Dd]olt | 389 [Nn]erd | 390 [Ii]diot { switch(gtf_random(6)) 391 { case 0: gtf_puts_case("bog eyes"); break; 392 case 1: gtf_puts_case("poof"); break; 393 case 2: gtf_puts_case("git"); break; 394 case 3: gtf_puts_case("fairy"); break; 395 case 4: gtf_puts_case("tosser"); break; 396 case 5: gtf_puts_case("divvy"); break; 397 } 398 BEGIN(INW); 399 } 400 [Bb]e{WB}quiet/{NW} | 401 [Ss]hut{WB}up/{NW} { switch(gtf_random(2)) 402 { case 0: gtf_puts_case("shut it"); break; 403 default: gtf_puts_case("Button it"); break; 404 } 405 } 406 [Aa]l(l{WB})?right/{NW} { switch(gtf_random(3)) 407 { case 0: gtf_puts_case("arright"); break; 408 case 1: gtf_puts_case("awright"); break; 409 case 2: gtf_puts_case("right"); break; 410 } 411 } 412 [Cc]igarette gtf_puts_case("fag"); BEGIN(INW); 413 [Gg]oing/{NW} gtf_puts_case("gahn"); 414 [Bb]ring | 415 [Ss]ting | 416 [Ss]wing | 417 [CcFfSs]ling | 418 [BbKkMmPpRrSsWw]ing gtf_echo(); BEGIN(INW); 419 [Tt]here | 420 [Tt]hey | 421 [Tt]his | 422 [Tt]hat gtf_echo(); BEGIN(INW); 423 Th gtf_puts("F"); BEGIN(INW); 424 [Mm]r"."/{NW} gtf_puts("Guvnor"); 425 [Ww]hy | 426 [Ww]here | gtf_echo(); BEGIN(INW); 427 [Ww]h gtf_puts_case("W"); BEGIN(INW); 428 [Oo]f/{NW} gtf_puts_case("o'"); 429 430 {WC} { BEGIN(INW); gtf_echo(); } 431 432 } 433 434 <INW>{ 435 436 [Aa]{WB}h gtf_puts_case("an '"); 437 aw gtf_puts_case("or"); 438 439 ing/{NW} gtf_puts_case("in'"); BEGIN(NIW); 440 "." { switch(gtf_random(32)) 441 { 442 case 0: 443 gtf_puts_case(". I'll get out me spoons."); 444 break; 445 case 1: 446 gtf_puts_case(". Yer can't 'ave a knees-up wivout a joanna."); 447 break; 448 case 2: 449 gtf_puts_case(". Cor blimey guv, would I lie to you."); 450 break; 451 case 3: 452 gtf_puts_case(". I'll make us all a nice cup a' tea."); 453 break; 454 case 4: 455 gtf_puts_case(", do wot Guvnor!"); 456 break; 457 case 5: 458 gtf_puts_case(", right?"); 459 break; 460 case 6: 461 gtf_puts_case(". Right."); 462 break; 463 case 7: 464 case 8: 465 gtf_puts_case(", i'n it?"); 466 break; 467 default: 468 gtf_echo(); 469 } 470 BEGIN(NIW); 471 } 472 "?" { if(gtf_random(3) == 0) 473 gtf_puts(", isit?"); 474 else 475 { 476 switch(gtf_random(4)) 477 { 478 case 0: gtf_puts(", then"); break; 479 case 1: gtf_puts(", eh"); break; 480 case 2: gtf_puts(", then, eh"); break; 481 } 482 switch(gtf_random(6)) 483 { 484 case 0: gtf_puts(", mate?"); break; 485 case 1: gtf_puts(", guv?"); break; 486 case 2: gtf_puts(", squire?"); break; 487 case 3: gtf_puts(", luv?"); break; 488 default: gtf_echo(); 489 } 490 } 491 } 492 , { if(gtf_random(3) == 0) 493 gtf_puts(", right,"); 494 else 495 gtf_echo(); 496 } 497 ! { switch(gtf_random(7)) 498 { 499 case 0: gtf_puts_case("! Blimey!"); break; 500 case 1: gtf_puts_case("! Struth!"); break; 501 case 2: gtf_puts_case("! Right!"); break; 502 case 3: gtf_puts_case(", guv!"); break; 503 case 4: gtf_puts_case("! Honest, guv!"); break; 504 case 5: gtf_puts_case("! Oi!"); break; 505 case 6: gtf_puts_case(", mate!"); break; 506 default: gtf_echo(); 507 } 508 } 509 510 {NW} BEGIN(NIW); unput(yytext[0]); 511 512 } 513 514 {EOT} /* ignore trailing EOT character */ 515 . gtf_echo(); 516 517 %% 518 519 #ifdef LIBRARY_MODE 520 521 int gtf_filter_cockney(const char *input, char *buf, size_t bufsz) 522 { 523 gtf_databuf_t buffer; 524 YY_BUFFER_STATE _yybuf; 525 526 gtf_strbuf_init(&buffer, buf, bufsz); 527 _yybuf = yy_scan_string(input); 528 yylex(&buffer); 529 yy_delete_buffer(_yybuf); 530 gtf_reset(); 531 532 return(buffer.overflow); 533 } 534 535 int __gtf_filter_cockney(const char *input, char *buf, size_t bufsz) 536 { 537 return(gtf_filter_cockney(input, buf, bufsz)); 538 } 539 540 #else /* LIBRARY_MODE */ 541 542 int main(int argc, char **argv) 543 { 544 gtf_parse_args(); 545 gtf_random_seed(); 546 547 yylex(NULL); 548 549 return(EXIT_SUCCESS); 550 } 551 552 #endif /* LIBRARY_MODE */ 553 554 /* end of source file */ 555