summaryrefslogtreecommitdiff
path: root/tests/examplefiles/hexdump_xxd
diff options
context:
space:
mode:
authorMiikka Salminen <miikka.salminen@gmail.com>2015-10-28 16:39:01 +0200
committerMiikka Salminen <miikka.salminen@gmail.com>2015-10-28 16:39:01 +0200
commitef0518913142c9c87f6fddba695e77d873211a43 (patch)
tree6e98de43c901ff6ffedcf35e7bc548cad7973020 /tests/examplefiles/hexdump_xxd
parentb8f3945ff8955bc5adb77277cda3341edc58e33d (diff)
downloadpygments-ef0518913142c9c87f6fddba695e77d873211a43.tar.gz
Added support for od and xxd. Minor enhancements.
Diffstat (limited to 'tests/examplefiles/hexdump_xxd')
-rw-r--r--tests/examplefiles/hexdump_xxd309
1 files changed, 309 insertions, 0 deletions
diff --git a/tests/examplefiles/hexdump_xxd b/tests/examplefiles/hexdump_xxd
new file mode 100644
index 00000000..33a8a6e1
--- /dev/null
+++ b/tests/examplefiles/hexdump_xxd
@@ -0,0 +1,309 @@
+0000000: 2f2f 2043 7265 6174 6564 2062 7920 4c69 // Created by Li
+0000010: 6f6e 656c 6c6f 204c 756e 6573 7520 616e onello Lunesu an
+0000020: 6420 706c 6163 6564 2069 6e20 7468 6520 d placed in the
+0000030: 7075 626c 6963 2064 6f6d 6169 6e2e 0a2f public domain../
+0000040: 2f20 5468 6973 2066 696c 6520 6861 7320 / This file has
+0000050: 6265 656e 206d 6f64 6966 6965 6420 6672 been modified fr
+0000060: 6f6d 2069 7473 206f 7269 6769 6e61 6c20 om its original
+0000070: 7665 7273 696f 6e2e 0a2f 2f20 4974 2068 version..// It h
+0000080: 6173 2062 6565 6e20 666f 726d 6174 7465 as been formatte
+0000090: 6420 746f 2066 6974 2079 6f75 7220 7363 d to fit your sc
+00000a0: 7265 656e 2e0a 6d6f 6475 6c65 2070 686f reen..module pho
+00000b0: 6e65 6e6f 3b20 2020 2020 2f2f 206f 7074 neno; // opt
+00000c0: 696f 6e61 6c0a 696d 706f 7274 2073 7464 ional.import std
+00000d0: 2e73 7464 696f 3b20 2020 2f2f 2077 7269 .stdio; // wri
+00000e0: 7465 666c 6e20 2020 2020 0a69 6d70 6f72 tefln .impor
+00000f0: 7420 7374 642e 6374 7970 653b 2020 202f t std.ctype; /
+0000100: 2f20 6973 6469 6769 7420 2020 2020 0a69 / isdigit .i
+0000110: 6d70 6f72 7420 7374 642e 7374 7265 616d mport std.stream
+0000120: 3b20 202f 2f20 4275 6666 6572 6564 4669 ; // BufferedFi
+0000130: 6c65 0a0a 2f2f 204a 7573 7420 666f 7220 le..// Just for
+0000140: 7265 6164 6162 696c 6974 7920 2869 6d61 readability (ima
+0000150: 6769 6e65 2063 6861 725b 5d5b 5d5b 6368 gine char[][][ch
+0000160: 6172 5b5d 5d29 2020 2020 0a61 6c69 6173 ar[]]) .alias
+0000170: 2063 6861 725b 5d20 7374 7269 6e67 3b0a char[] string;.
+0000180: 616c 6961 7320 7374 7269 6e67 5b5d 2073 alias string[] s
+0000190: 7472 696e 6761 7272 6179 3b0a 0a2f 2f2f tringarray;..///
+00001a0: 2053 7472 6970 7320 6e6f 6e2d 6469 6769 Strips non-digi
+00001b0: 7420 6368 6172 6163 7465 7273 2066 726f t characters fro
+00001c0: 6d20 7468 6520 7374 7269 6e67 2028 434f m the string (CO
+00001d0: 5729 0a73 7472 696e 6720 7374 7269 704e W).string stripN
+00001e0: 6f6e 4469 6769 7428 2069 6e20 7374 7269 onDigit( in stri
+00001f0: 6e67 206c 696e 6520 2920 0a7b 0a20 2020 ng line ) .{.
+0000200: 2073 7472 696e 6720 7265 743b 0a20 2020 string ret;.
+0000210: 2066 6f72 6561 6368 2875 696e 7420 692c foreach(uint i,
+0000220: 2063 3b20 6c69 6e65 2920 7b0a 2020 2020 c; line) {.
+0000230: 2020 2020 2f2f 2045 7272 6f72 3a20 7374 // Error: st
+0000240: 642e 6374 7970 652e 6973 6469 6769 7420 d.ctype.isdigit
+0000250: 6174 2043 3a5c 646d 645c 7372 635c 7068 at C:\dmd\src\ph
+0000260: 6f62 6f73 5c73 7464 5c63 7479 7065 2e64 obos\std\ctype.d
+0000270: 2833 3729 200a 2020 2020 2020 2020 2f2f (37) . //
+0000280: 2063 6f6e 666c 6963 7473 2077 6974 6820 conflicts with
+0000290: 7374 642e 7374 7265 616d 2e69 7364 6967 std.stream.isdig
+00002a0: 6974 2061 7420 433a 5c64 6d64 5c73 7263 it at C:\dmd\src
+00002b0: 5c70 686f 626f 735c 7374 645c 7374 7265 \phobos\std\stre
+00002c0: 616d 2e64 2832 3932 3429 0a20 2020 2020 am.d(2924).
+00002d0: 2020 2069 6620 2821 7374 642e 6374 7970 if (!std.ctyp
+00002e0: 652e 6973 6469 6769 7428 6329 2920 7b0a e.isdigit(c)) {.
+00002f0: 2020 2020 2020 2020 2020 2020 6966 2028 if (
+0000300: 2172 6574 290a 2020 2020 2020 2020 2020 !ret).
+0000310: 2020 2020 2020 7265 7420 3d20 6c69 6e65 ret = line
+0000320: 5b30 2e2e 695d 3b20 2020 200a 2020 2020 [0..i]; .
+0000330: 2020 2020 7d20 2020 200a 2020 2020 2020 } .
+0000340: 2020 656c 7365 2069 6620 2872 6574 290a else if (ret).
+0000350: 2020 2020 2020 2020 2020 2020 7265 7420 ret
+0000360: 7e3d 2063 3b20 2020 200a 2020 2020 7d20 ~= c; . }
+0000370: 2020 200a 2020 2020 7265 7475 726e 2072 . return r
+0000380: 6574 3f72 6574 3a6c 696e 653b 0a7d 0a0a et?ret:line;.}..
+0000390: 756e 6974 7465 7374 207b 0a20 2020 2061 unittest {. a
+00003a0: 7373 6572 7428 2073 7472 6970 4e6f 6e44 ssert( stripNonD
+00003b0: 6967 6974 2822 6173 6466 2229 203d 3d20 igit("asdf") ==
+00003c0: 2222 2020 293b 0a20 2020 2061 7373 6572 "" );. asser
+00003d0: 7428 2073 7472 6970 4e6f 6e44 6967 6974 t( stripNonDigit
+00003e0: 2822 5c27 3133 2d3d 3220 346b 6f70 2229 ("\'13-=2 4kop")
+00003f0: 203d 3d20 2022 3133 3234 2220 2029 3b0a == "1324" );.
+0000400: 7d0a 0a2f 2f2f 2043 6f6e 7665 7274 7320 }../// Converts
+0000410: 6120 776f 7264 2069 6e74 6f20 6120 6e75 a word into a nu
+0000420: 6d62 6572 2c20 6967 6e6f 7269 6e67 2061 mber, ignoring a
+0000430: 6c6c 206e 6f6e 2061 6c70 6861 2063 6861 ll non alpha cha
+0000440: 7261 6374 6572 7320 200a 7374 7269 6e67 racters .string
+0000450: 2077 6f72 6454 6f4e 756d 2820 696e 2073 wordToNum( in s
+0000460: 7472 696e 6720 776f 7264 2029 0a7b 0a2f tring word ).{./
+0000470: 2f20 7472 616e 736c 6174 696f 6e20 7461 / translation ta
+0000480: 626c 6520 666f 7220 7468 6520 7461 736b ble for the task
+0000490: 2061 7420 6861 6e64 0a63 6f6e 7374 2063 at hand.const c
+00004a0: 6861 725b 3235 365d 2054 5241 4e53 4c41 har[256] TRANSLA
+00004b0: 5445 203d 2020 2020 0a20 2020 2022 2020 TE = . "
+00004c0: 2020 2020 2020 2020 2020 2020 2020 2020
+00004d0: 2020 2020 2020 2020 2020 2020 2020 2220 "
+00004e0: 202f 2f20 3020 2020 0a20 2020 2022 2020 // 0 . "
+00004f0: 2020 2020 2020 2020 2020 2020 2020 3031 01
+0000500: 3233 3435 3637 3839 2020 2020 2020 2220 23456789 "
+0000510: 202f 2f20 3332 2020 2020 200a 2020 2020 // 32 .
+0000520: 2220 3537 3633 3034 3939 3631 3738 3531 " 57630499617851
+0000530: 3838 3132 3334 3736 3232 3339 2020 2020 881234762239
+0000540: 2022 2020 2f2f 2036 3420 2020 0a20 2020 " // 64 .
+0000550: 2022 2035 3736 3330 3439 3936 3137 3835 " 5763049961785
+0000560: 3138 3831 3233 3437 3632 3233 3920 2020 1881234762239
+0000570: 2020 220a 2020 2020 2220 2020 2020 2020 ". "
+0000580: 2020 2020 2020 2020 2020 2020 2020 2020
+0000590: 2020 2020 2020 2020 2022 0a20 2020 2022 ". "
+00005a0: 2020 2020 2020 2020 2020 2020 2020 2020
+00005b0: 2020 2020 2020 2020 2020 2020 2020 2020
+00005c0: 220a 2020 2020 2220 2020 2020 2020 2020 ". "
+00005d0: 2020 2020 2020 2020 2020 2020 2020 2020
+00005e0: 2020 2020 2020 2022 2020 2020 0a20 2020 " .
+00005f0: 2022 2020 2020 2020 2020 2020 2020 2020 "
+0000600: 2020 2020 2020 2020 2020 2020 2020 2020
+0000610: 2020 223b 0a20 2020 2073 7472 696e 6720 ";. string
+0000620: 7265 743b 0a20 2020 2066 6f72 6561 6368 ret;. foreach
+0000630: 2863 3b20 6361 7374 2875 6279 7465 5b5d (c; cast(ubyte[]
+0000640: 2977 6f72 6429 0a20 2020 2020 2020 2069 )word). i
+0000650: 6620 2854 5241 4e53 4c41 5445 5b63 5d20 f (TRANSLATE[c]
+0000660: 213d 2027 2027 290a 2020 2020 2020 2020 != ' ').
+0000670: 2020 2020 7265 7420 7e3d 2054 5241 4e53 ret ~= TRANS
+0000680: 4c41 5445 5b63 5d3b 0a20 2020 2072 6574 LATE[c];. ret
+0000690: 7572 6e20 7265 743b 0a7d 0a0a 756e 6974 urn ret;.}..unit
+00006a0: 7465 7374 207b 0a20 2f2f 2054 6573 7420 test {. // Test
+00006b0: 776f 7264 546f 4e75 6d20 7573 696e 6720 wordToNum using
+00006c0: 7468 6520 7461 626c 6520 6672 6f6d 2074 the table from t
+00006d0: 6865 2074 6173 6b20 6465 7363 7269 7074 he task descript
+00006e0: 696f 6e2e 0a20 6173 7365 7274 2820 2230 ion.. assert( "0
+00006f0: 3131 3132 3232 3333 3334 3435 3536 3636 1112223334455666
+0000700: 3737 3738 3838 3939 3922 203d 3d0a 2020 777888999" ==.
+0000710: 2077 6f72 6454 6f4e 756d 2822 4520 7c20 wordToNum("E |
+0000720: 4a20 4e20 5120 7c20 5220 5720 5820 7c20 J N Q | R W X |
+0000730: 4420 5320 5920 7c20 4620 5420 7c20 4120 D S Y | F T | A
+0000740: 4d20 7c20 4320 4920 5620 7c20 4220 4b20 M | C I V | B K
+0000750: 5520 7c20 4c20 4f20 5020 7c20 4720 4820 U | L O P | G H
+0000760: 5a22 2929 3b0a 2061 7373 6572 7428 2022 Z"));. assert( "
+0000770: 3031 3131 3232 3233 3333 3434 3535 3636 0111222333445566
+0000780: 3637 3737 3838 3839 3939 2220 3d3d 200a 6777888999" == .
+0000790: 2020 2077 6f72 6454 6f4e 756d 2822 6520 wordToNum("e
+00007a0: 7c20 6a20 6e20 7120 7c20 7220 7720 7820 | j n q | r w x
+00007b0: 7c20 6420 7320 7920 7c20 6620 7420 7c20 | d s y | f t |
+00007c0: 6120 6d20 7c20 6320 6920 7620 7c20 6220 a m | c i v | b
+00007d0: 6b20 7520 7c20 6c20 6f20 7020 7c20 6720 k u | l o p | g
+00007e0: 6820 7a22 2929 3b0a 2061 7373 6572 7428 h z"));. assert(
+00007f0: 2022 3031 3233 3435 3637 3839 2220 3d3d "0123456789" ==
+0000800: 200a 2020 2077 6f72 6454 6f4e 756d 2822 . wordToNum("
+0000810: 3020 7c20 2020 3120 2020 7c20 2020 3220 0 | 1 | 2
+0000820: 2020 7c20 2020 3320 2020 7c20 2034 2020 | 3 | 4
+0000830: 7c20 2035 2020 7c20 2020 3620 2020 7c20 | 5 | 6 |
+0000840: 2020 3720 2020 7c20 2020 3820 2020 7c20 7 | 8 |
+0000850: 2020 3922 2929 3b0a 7d0a 0a76 6f69 6420 9"));.}..void
+0000860: 6d61 696e 2820 7374 7269 6e67 5b5d 2061 main( string[] a
+0000870: 7267 7320 290a 7b0a 2020 2020 2f2f 2054 rgs ).{. // T
+0000880: 6869 7320 6173 736f 6369 6174 6976 6520 his associative
+0000890: 6172 7261 7920 6d61 7073 2061 206e 756d array maps a num
+00008a0: 6265 7220 746f 2061 6e20 6172 7261 7920 ber to an array
+00008b0: 6f66 2077 6f72 6473 2e20 2020 200a 2020 of words. .
+00008c0: 2020 7374 7269 6e67 6172 7261 795b 7374 stringarray[st
+00008d0: 7269 6e67 5d20 2020 206e 756d 3277 6f72 ring] num2wor
+00008e0: 6473 3b0a 0a20 2020 2066 6f72 6561 6368 ds;.. foreach
+00008f0: 2873 7472 696e 6720 776f 7264 3b20 6e65 (string word; ne
+0000900: 7720 4275 6666 6572 6564 4669 6c65 2822 w BufferedFile("
+0000910: 6469 6374 696f 6e61 7279 2e74 7874 2220 dictionary.txt"
+0000920: 2920 290a 2020 2020 2020 2020 6e75 6d32 ) ). num2
+0000930: 776f 7264 735b 2077 6f72 6454 6f4e 756d words[ wordToNum
+0000940: 2877 6f72 6429 205d 207e 3d20 776f 7264 (word) ] ~= word
+0000950: 2e64 7570 3b20 2020 2020 2020 202f 2f20 .dup; //
+0000960: 6d75 7374 2064 7570 0a0a 2020 2020 2f2f must dup.. //
+0000970: 2f20 4669 6e64 7320 616c 6c20 616c 7465 / Finds all alte
+0000980: 726e 6174 6976 6573 2066 6f72 2074 6865 rnatives for the
+0000990: 2067 6976 656e 206e 756d 6265 720a 2020 given number.
+00009a0: 2020 2f2f 2f20 2873 686f 756c 6420 6861 /// (should ha
+00009b0: 7665 2062 6565 6e20 7374 7269 7070 6564 ve been stripped
+00009c0: 2066 726f 6d20 6e6f 6e2d 6469 6769 7420 from non-digit
+00009d0: 6368 6172 6163 7465 7273 290a 2020 2020 characters).
+00009e0: 7374 7269 6e67 6172 7261 7920 5f46 696e stringarray _Fin
+00009f0: 6457 6f72 6473 2820 7374 7269 6e67 206e dWords( string n
+0000a00: 756d 6265 7273 2c20 626f 6f6c 2064 6967 umbers, bool dig
+0000a10: 6974 6f6b 2029 0a20 2020 2069 6e20 7b0a itok ). in {.
+0000a20: 2020 2020 2020 2020 6173 7365 7274 286e assert(n
+0000a30: 756d 6265 7273 2e6c 656e 6774 6820 3e20 umbers.length >
+0000a40: 2030 293b 2020 2020 0a20 2020 207d 2020 0); . }
+0000a50: 2020 0a20 2020 206f 7574 2872 6573 756c . out(resul
+0000a60: 7429 207b 0a20 2020 2020 2020 2066 6f72 t) {. for
+0000a70: 6561 6368 2028 613b 2072 6573 756c 7429 each (a; result)
+0000a80: 0a20 2020 2020 2020 2020 2020 2061 7373 . ass
+0000a90: 6572 7428 2077 6f72 6454 6f4e 756d 2861 ert( wordToNum(a
+0000aa0: 2920 3d3d 206e 756d 6265 7273 2029 3b0a ) == numbers );.
+0000ab0: 2020 2020 7d20 2020 200a 2020 2020 626f } . bo
+0000ac0: 6479 207b 0a20 2020 2020 2020 2073 7472 dy {. str
+0000ad0: 696e 6761 7272 6179 2072 6574 3b0a 2020 ingarray ret;.
+0000ae0: 2020 2020 2020 626f 6f6c 2066 6f75 6e64 bool found
+0000af0: 776f 7264 203d 2066 616c 7365 3b0a 2020 word = false;.
+0000b00: 2020 2020 2020 666f 7220 2875 696e 7420 for (uint
+0000b10: 743d 313b 2074 3c3d 6e75 6d62 6572 732e t=1; t<=numbers.
+0000b20: 6c65 6e67 7468 3b20 2b2b 7429 207b 0a20 length; ++t) {.
+0000b30: 2020 2020 2020 2020 2020 2061 7574 6f20 auto
+0000b40: 616c 7465 726e 6174 6976 6573 203d 206e alternatives = n
+0000b50: 756d 6265 7273 5b30 2e2e 745d 2069 6e20 umbers[0..t] in
+0000b60: 6e75 6d32 776f 7264 733b 0a20 2020 2020 num2words;.
+0000b70: 2020 2020 2020 2069 6620 2821 616c 7465 if (!alte
+0000b80: 726e 6174 6976 6573 290a 2020 2020 2020 rnatives).
+0000b90: 2020 2020 2020 2020 2020 636f 6e74 696e contin
+0000ba0: 7565 3b0a 2020 2020 2020 2020 2020 2020 ue;.
+0000bb0: 666f 756e 6477 6f72 6420 3d20 7472 7565 foundword = true
+0000bc0: 3b0a 2020 2020 2020 2020 2020 2020 6966 ;. if
+0000bd0: 2028 6e75 6d62 6572 732e 6c65 6e67 7468 (numbers.length
+0000be0: 203e 2020 7429 207b 0a20 2020 2020 2020 > t) {.
+0000bf0: 2020 2020 2020 2020 202f 2f20 436f 6d62 // Comb
+0000c00: 696e 6520 616c 6c20 6375 7272 656e 7420 ine all current
+0000c10: 616c 7465 726e 6174 6976 6573 2077 6974 alternatives wit
+0000c20: 6820 616c 6c20 616c 7465 726e 6174 6976 h all alternativ
+0000c30: 6573 2020 2020 200a 2020 2020 2020 2020 es .
+0000c40: 2020 2020 2020 2020 2f2f 206f 6620 7468 // of th
+0000c50: 6520 7265 7374 2028 6e65 7874 2070 6965 e rest (next pie
+0000c60: 6365 2063 616e 2073 7461 7274 2077 6974 ce can start wit
+0000c70: 6820 6120 6469 6769 7429 2020 2020 2020 h a digit)
+0000c80: 2020 2020 2020 2020 0a20 2020 2020 2020 .
+0000c90: 2020 2020 2020 2020 2066 6f72 6561 6368 foreach
+0000ca0: 2028 6132 3b20 5f46 696e 6457 6f72 6473 (a2; _FindWords
+0000cb0: 2820 6e75 6d62 6572 735b 742e 2e24 5d2c ( numbers[t..$],
+0000cc0: 2074 7275 6520 2020 2020 2920 290a 2020 true ) ).
+0000cd0: 2020 2020 2020 2020 2020 2020 2020 2020
+0000ce0: 2020 666f 7265 6163 6828 6131 3b20 2a61 foreach(a1; *a
+0000cf0: 6c74 6572 6e61 7469 7665 7329 0a20 2020 lternatives).
+0000d00: 2020 2020 2020 2020 2020 2020 2020 2020
+0000d10: 2020 2020 7265 7420 7e3d 2061 3120 7e20 ret ~= a1 ~
+0000d20: 2220 2220 7e20 6132 3b0a 2020 2020 2020 " " ~ a2;.
+0000d30: 2020 2020 2020 7d0a 2020 2020 2020 2020 }.
+0000d40: 2020 2020 656c 7365 2020 2020 0a20 2020 else .
+0000d50: 2020 2020 2020 2020 2020 2020 2072 6574 ret
+0000d60: 207e 3d20 2a61 6c74 6572 6e61 7469 7665 ~= *alternative
+0000d70: 733b 2020 2020 2f2f 2061 7070 656e 6420 s; // append
+0000d80: 7468 6573 6520 616c 7465 726e 6174 6976 these alternativ
+0000d90: 6573 0a20 2020 2020 2020 207d 0a20 2020 es. }.
+0000da0: 2020 2020 202f 2f20 5472 7920 746f 206b // Try to k
+0000db0: 6565 7020 3120 6469 6769 742c 206f 6e6c eep 1 digit, onl
+0000dc0: 7920 6966 2077 6527 7265 2061 6c6c 6f77 y if we're allow
+0000dd0: 6564 2061 6e64 206e 6f20 6f74 6865 720a ed and no other.
+0000de0: 2020 2020 2020 2020 2f2f 2061 6c74 6572 // alter
+0000df0: 6e61 7469 7665 7320 7765 7265 2066 6f75 natives were fou
+0000e00: 6e64 0a20 2020 2020 2020 202f 2f20 5465 nd. // Te
+0000e10: 7374 696e 6720 2272 6574 2e6c 656e 6774 sting "ret.lengt
+0000e20: 6822 206d 616b 6573 206d 6f72 6520 7365 h" makes more se
+0000e30: 6e73 6520 7468 616e 2074 6573 7469 6e67 nse than testing
+0000e40: 2022 666f 756e 6477 6f72 6422 2c0a 2020 "foundword",.
+0000e50: 2020 2020 2020 2f2f 2062 7574 2074 6865 // but the
+0000e60: 206f 7468 6572 2069 6d70 6c65 6d65 6e74 other implement
+0000e70: 6174 696f 6e73 2073 6565 6d20 746f 2064 ations seem to d
+0000e80: 6f20 6a75 7374 2074 6869 732e 0a20 2020 o just this..
+0000e90: 2020 2020 2069 6620 2864 6967 6974 6f6b if (digitok
+0000ea0: 2026 2620 2166 6f75 6e64 776f 7264 2920 && !foundword)
+0000eb0: 7b20 2f2f 7265 742e 6c65 6e67 7468 203d { //ret.length =
+0000ec0: 3d20 3020 200a 2020 2020 2020 2020 2020 = 0 .
+0000ed0: 2020 6966 286e 756d 6265 7273 2e6c 656e if(numbers.len
+0000ee0: 6774 6820 3e20 2031 2920 7b0a 2020 2020 gth > 1) {.
+0000ef0: 2020 2020 2020 2020 2020 2020 2f2f 2043 // C
+0000f00: 6f6d 6269 6e65 2031 2064 6967 6974 2077 ombine 1 digit w
+0000f10: 6974 6820 616c 6c20 616c 7465 6e61 7469 ith all altenati
+0000f20: 7665 7320 6672 6f6d 2074 6865 2072 6573 ves from the res
+0000f30: 7420 2020 200a 2020 2020 2020 2020 2020 t .
+0000f40: 2020 2020 2020 2f2f 2028 6e65 7874 2070 // (next p
+0000f50: 6965 6365 2063 616e 206e 6f74 2073 7461 iece can not sta
+0000f60: 7274 2077 6974 6820 6120 6469 6769 7429 rt with a digit)
+0000f70: 2020 2020 2020 2020 2020 0a20 2020 2020 .
+0000f80: 2020 2020 2020 2020 2020 2066 6f72 6561 forea
+0000f90: 6368 2028 613b 205f 4669 6e64 576f 7264 ch (a; _FindWord
+0000fa0: 7328 206e 756d 6265 7273 5b31 2e2e 245d s( numbers[1..$]
+0000fb0: 2c20 6661 6c73 6520 2920 290a 2020 2020 , false ) ).
+0000fc0: 2020 2020 2020 2020 2020 2020 2020 2020
+0000fd0: 7265 7420 7e3d 206e 756d 6265 7273 5b30 ret ~= numbers[0
+0000fe0: 2e2e 315d 207e 2022 2022 207e 2061 3b0a ..1] ~ " " ~ a;.
+0000ff0: 2020 2020 2020 2020 2020 2020 7d20 2020 }
+0001000: 200a 2020 2020 2020 2020 2020 2020 656c . el
+0001010: 7365 2020 2020 0a20 2020 2020 2020 2020 se .
+0001020: 2020 2020 2020 2072 6574 207e 3d20 6e75 ret ~= nu
+0001030: 6d62 6572 735b 302e 2e31 5d3b 2020 2020 mbers[0..1];
+0001040: 2f2f 206a 7573 7420 6170 7065 6e64 2074 // just append t
+0001050: 6869 7320 6469 6769 7420 2020 2020 2020 his digit
+0001060: 2020 2020 2020 0a20 2020 2020 2020 207d . }
+0001070: 2020 2020 0a20 2020 2020 2020 2072 6574 . ret
+0001080: 7572 6e20 7265 743b 0a20 2020 207d 0a0a urn ret;. }..
+0001090: 2020 2020 2f2f 2f20 2854 6869 7320 6675 /// (This fu
+00010a0: 6e63 7469 6f6e 2077 6173 2069 6e6c 696e nction was inlin
+00010b0: 6564 2069 6e20 7468 6520 6f72 6967 696e ed in the origin
+00010c0: 616c 2070 726f 6772 616d 2920 0a20 2020 al program) .
+00010d0: 202f 2f2f 2046 696e 6473 2061 6c6c 2061 /// Finds all a
+00010e0: 6c74 6572 6e61 7469 7665 7320 666f 7220 lternatives for
+00010f0: 7468 6520 6769 7665 6e20 7068 6f6e 6520 the given phone
+0001100: 6e75 6d62 6572 200a 2020 2020 2f2f 2f20 number . ///
+0001110: 5265 7475 726e 733a 2061 7272 6179 206f Returns: array o
+0001120: 6620 7374 7269 6e67 7320 0a20 2020 2073 f strings . s
+0001130: 7472 696e 6761 7272 6179 2046 696e 6457 tringarray FindW
+0001140: 6f72 6473 2820 7374 7269 6e67 2070 686f ords( string pho
+0001150: 6e65 5f6e 756d 6265 7220 290a 2020 2020 ne_number ).
+0001160: 7b0a 2020 2020 2020 2020 6966 2028 2170 {. if (!p
+0001170: 686f 6e65 5f6e 756d 6265 722e 6c65 6e67 hone_number.leng
+0001180: 7468 290a 2020 2020 2020 2020 2020 2020 th).
+0001190: 7265 7475 726e 206e 756c 6c3b 0a20 2020 return null;.
+00011a0: 2020 2020 202f 2f20 5374 7269 7020 7468 // Strip th
+00011b0: 6520 6e6f 6e2d 6469 6769 7420 6368 6172 e non-digit char
+00011c0: 6163 7465 7273 2066 726f 6d20 7468 6520 acters from the
+00011d0: 7068 6f6e 6520 6e75 6d62 6572 2c20 616e phone number, an
+00011e0: 640a 2020 2020 2020 2020 2f2f 2070 6173 d. // pas
+00011f0: 7320 6974 2074 6f20 7468 6520 7265 6375 s it to the recu
+0001200: 7273 6976 6520 6675 6e63 7469 6f6e 2028 rsive function (
+0001210: 6c65 6164 696e 6720 6469 6769 7420 6973 leading digit is
+0001220: 2061 6c6c 6f77 6564 290a 2020 2020 2020 allowed).
+0001230: 2020 7265 7475 726e 205f 4669 6e64 576f return _FindWo
+0001240: 7264 7328 2073 7472 6970 4e6f 6e44 6967 rds( stripNonDig
+0001250: 6974 2870 686f 6e65 5f6e 756d 6265 7229 it(phone_number)
+0001260: 2c20 7472 7565 2029 3b20 2020 200a 2020 , true ); .
+0001270: 2020 7d20 2020 200a 2020 2020 0a20 2020 } . .
+0001280: 202f 2f20 5265 6164 2074 6865 2070 686f // Read the pho
+0001290: 6e65 206e 756d 6265 7273 2020 2020 200a ne numbers .
+00012a0: 2020 2020 666f 7265 6163 6828 7374 7269 foreach(stri
+00012b0: 6e67 2070 686f 6e65 3b20 6e65 7720 4275 ng phone; new Bu
+00012c0: 6666 6572 6564 4669 6c65 2822 696e 7075 fferedFile("inpu
+00012d0: 742e 7478 7422 2020 2029 2029 0a20 2020 t.txt" ) ).
+00012e0: 2020 2020 2066 6f72 6561 6368 2861 6c74 foreach(alt
+00012f0: 6572 6e61 7469 7665 3b20 4669 6e64 576f ernative; FindWo
+0001300: 7264 7328 2070 686f 6e65 2029 2029 0a20 rds( phone ) ).
+0001310: 2020 2020 2020 2020 2020 2077 7269 7465 write
+0001320: 666c 6e28 7068 6f6e 652c 2022 3a20 222c fln(phone, ": ",
+0001330: 2061 6c74 6572 6e61 7469 7665 2029 3b0a alternative );.
+0001340: 7d0a 0a }..