File Coverage

blib/lib/Encode/Arabic/ArabTeX.pm
Criterion Covered Total %
statement 219 345 63.4
branch 99 218 45.4
condition 8 30 26.6
subroutine 28 29 96.5
pod 6 10 60.0
total 360 632 56.9


line stmt bran cond sub pod time code
1             # ##################################################################### Otakar Smrz, 2003/01/23
2             #
3             # Encoding of Arabic: ArabTeX Notation by Klaus Lagally ############################ 2003/06/19
4              
5             package Encode::Arabic::ArabTeX;
6              
7             our $VERSION = '14.1';
8              
9 4     4   16827 use 5.008;
  4         10  
  4         137  
10              
11 4     4   16 use strict;
  4         6  
  4         122  
12 4     4   17 use warnings;
  4         5  
  4         124  
13              
14 4     4   19 use Scalar::Util 'blessed';
  4         6  
  4         394  
15 4     4   18 use Carp;
  4         7  
  4         217  
16              
17 4     4   2200 use Encode::Encoding;
  4         40923  
  4         186  
18 4     4   33 use base 'Encode::Encoding';
  4         6  
  4         529  
19              
20             __PACKAGE__->Define('ArabTeX', 'Lagally', 'TeX');
21              
22              
23 4     4   2324 use Encode::Mapper ':others', ':silent', ':join';
  4         13  
  4         27  
24              
25              
26             our %options; # records of options per package .. global register
27             our %option; # options of the caller package .. used with local
28              
29             our $enmode;
30             our $demode;
31              
32             our $enlevel = 2;
33             our $delevel = 3;
34              
35             our %modemap = (
36              
37             'default' => 3,
38             'undef' => 0,
39              
40             'fullvocalize' => 4,
41             'full' => 4,
42              
43             'vocalize' => 3,
44             'nosukuun' => 3,
45              
46             'novocalize' => 2,
47             'novowels' => 2,
48             'none' => 2,
49              
50             'noshadda' => 1,
51             'noneplus' => 1,
52             );
53              
54              
55             sub import { # perform import as if Encode were used one level before this module
56              
57 2 100 66 2   19 if (defined $_[1] and $_[1] eq ':xml') { # interfere little with possible Encode's options
58              
59 254         193 Encode::Mapper->options (
60              
61             'override' => [ # override rules of these LHS .. no other tricks ^^
62              
63             ( # combinations of '<' and '>' with the other bytes
64             map {
65              
66 1         4 my $x = chr $_;
67              
68 254         740 "<" . $x, [ "<" . $x, ">" ], # propagate the '>' sign implying ..
69             ">" . $x, [ $x, ">" ], # .. preservation of the bytes
70              
71             } 0x00 .. 0x3B, 0x3D, 0x3F .. 0xFF
72             ),
73              
74             ">>", ">", # stop the whole process ..
75             "<>", "<>", # .. do not even start it
76              
77             "><", [ "<", ">" ], # rather than nested '<' and '>', ..
78             "<<", [ "<<", ">" ],
79              
80             ">\\<", [ "<", ">" ], # .. prefer these escape sequences
81             ">\\\\", [ "\\", ">" ],
82             ">\\>", [ ">", ">" ],
83              
84             ">", ">", # singular symbols may migrate right ..
85             "<", "<", # .. or preserve the rest of the data
86             ]
87              
88             );
89              
90 1         53 splice @_, 1, 1;
91             }
92              
93 2 50 33     10 if (defined $_[1] and $_[1] eq ':simple') {
94              
95 0         0 __PACKAGE__->options($_[1]);
96 0         0 splice @_, 1, 1;
97             }
98              
99 2 50 33     8 if (defined $_[1] and $_[1] eq ':describe') {
100              
101 0         0 __PACKAGE__->options($_[1]);
102 0         0 splice @_, 1, 1;
103             }
104              
105 2         12 require Encode;
106              
107 2 50       46 push @Encode::ISA, 'Exporter' unless Encode->can('export_to_level');
108              
109 2         283 Encode->export_to_level(1, @_);
110             }
111              
112              
113             sub options ($%) {
114 0     0 0 0 my $cls = shift @_;
115 0         0 my ($i, $opt, %opt);
116              
117 0         0 my @returns = %option;
118              
119 0         0 while (@_) {
120              
121 0         0 $opt = lc shift @_;
122              
123 0 0       0 if ($opt =~ /^\:/) {
124              
125 0 0 0     0 $opt eq ':simple' and $opt{'non-quoting'} = 1 and $opt{'non-refined'} = 1 and next;
      0        
126 0 0 0     0 $opt eq ':describe' and $opt{'describe'} = 1 and next;
127             }
128             else {
129              
130 0         0 $opt =~ /^\-*(.*)$/;
131 0         0 $opt{$1} = shift @_;
132             }
133             }
134              
135 0 0       0 return %opt unless defined $cls;
136              
137 0         0 $option{$_} = $opt{$_} foreach keys %opt;
138              
139 0         0 return @returns;
140             }
141              
142              
143             sub encode ($$;$) {
144 6     6 1 7014 my ($cls, $text, $check) = @_;
145              
146 6 50       40 $cls = blessed $cls if ref $cls;
147              
148 4     4   35 no strict 'refs';
  4         7  
  4         539  
149              
150 6 50       11 $cls->encoder() unless defined ${ $cls . '::encoder' };
  6         32  
151              
152 6         10 return Encode::Mapper->encode($text, ${ $cls . '::encoder' }, undef);
  6         36  
153             }
154              
155              
156             sub decode ($$;$) {
157 3     3 1 100 my ($cls, $text, $check) = @_;
158              
159 3 50       19 $cls = blessed $cls if ref $cls;
160              
161 4     4   25 no strict 'refs';
  4         7  
  4         3263  
162              
163 3 50       4 $cls->decoder() unless defined ${ $cls . '::decoder' };
  3         17  
164              
165 3         8 return Encode::Mapper->decode($text, ${ $cls . '::decoder' }, 'utf8');
  3         18  
166             }
167              
168              
169             sub encoder ($@) {
170 1     1 1 1522 my $cls = shift @_;
171              
172 1         6 my $encoder = $cls->eecoder('encoder', @_);
173              
174 1 50 33     6 return $encoder unless defined $encoder and $encoder == -1;
175              
176 1         3 $encoder = [];
177              
178              
179 10         41 $encoder->[0] = Encode::Mapper->compile (
180              
181             [
182             'silent' => 0,
183             ],
184              
185             (
186             map {
187              
188 1         5 chr 0x0660 + $_, "" . $_,
189              
190             } 0 .. 9
191             ),
192              
193             "\x{064B}", "aN", # 240 "\xF0", # "\xD9\x8B"
194             "\x{064C}", "uN", # 241 "\xF1", # "\xD9\x8C"
195             "\x{064D}", "iN", # 242 "\xF2", # "\xD9\x8D"
196             "\x{064E}", "a", # 243 "\xF3", # "\xD9\x8E"
197             "\x{064F}", "u", # 245 "\xF5", # "\xD9\x8F"
198             "\x{0650}", "i", # 246 "\xF6", # "\xD9\x90"
199             "\x{0670}", "_a",
200             "\x{0657}", "_u",
201             "\x{0656}", "_i",
202              
203             "\x{060C}", ",", # 161 "\xA1", # "\xD8\x8C" right-to-left-comma
204             "\x{061B}", ";", # 186 "\xBA", # "\xD8\x9B" right-to-left-semicolon
205             "\x{061F}", "?", # 191 "\xBF", # "\xD8\x9F" right-to-left-question-mark
206             "\x{0621}", "'", # 193 "\xC1", # "\xD8\xA1" hamza-on-the-line
207             "\x{0622}", "'A", # 194 "\xC2", # "\xD8\xA2" madda-over-'alif
208             "\x{0623}", "'", # 195 "\xC3", # "\xD8\xA3" hamza-over-'alif
209             "\x{0624}", "'", # 196 "\xC4", # "\xD8\xA4" hamza-over-waaw
210             "\x{0625}", "'", # 197 "\xC5", # "\xD8\xA5" hamza-under-'alif
211             "\x{0626}", "'", # 198 "\xC6", # "\xD8\xA6" hamza-over-yaa'
212             "\x{0627}", "A", # 199 "\xC7", # "\xD8\xA7" bare 'alif
213             "\x{0628}", "b", # 200 "\xC8", # "\xD8\xA8"
214             "\x{0629}", "T", # 201 "\xC9", # "\xD8\xA9"
215             "\x{062A}", "t", # 202 "\xCA", # "\xD8\xAA"
216             "\x{062B}", "_t", # 203 "\xCB", # "\xD8\xAB" <_t>
217             "\x{062C}", "^g", # 204 "\xCC", # "\xD8\xAC" <^g>
218             "\x{062D}", ".h", # 205 "\xCD", # "\xD8\xAD" <.h>
219             "\x{062E}", "_h", # 206 "\xCE", # "\xD8\xAE" <_h>
220             "\x{062F}", "d", # 207 "\xCF", # "\xD8\xAF"
221             "\x{0630}", "_d", # 208 "\xD0", # "\xD8\xB0" <_d>
222             "\x{0631}", "r", # 209 "\xD1", # "\xD8\xB1"
223             "\x{0632}", "z", # 210 "\xD2", # "\xD8\xB2"
224             "\x{0633}", "s", # 211 "\xD3", # "\xD8\xB3"
225             "\x{0634}", "^s", # 212 "\xD4", # "\xD8\xB4" <^s>
226             "\x{0635}", ".s", # 213 "\xD5", # "\xD8\xB5" <.s>
227             "\x{0636}", ".d", # 214 "\xD6", # "\xD8\xB6" <.d>
228             "\x{0637}", ".t", # 216 "\xD8", # "\xD8\xB7" <.t>
229             "\x{0638}", ".z", # 217 "\xD9", # "\xD8\xB8" <.z>
230             "\x{0639}", "`", # 218 "\xDA", # "\xD8\xB9" <`>
231             "\x{063A}", ".g", # 219 "\xDB", # "\xD8\xBA" <.g>
232             "\x{0640}", "--", # 220 "\xDC", # "\xD9\x80" ta.twiil
233             "\x{0641}", "f", # 221 "\xDD", # "\xD9\x81"
234             "\x{0642}", "q", # 222 "\xDE", # "\xD9\x82"
235             "\x{0643}", "k", # 223 "\xDF", # "\xD9\x83"
236             "\x{0644}", "l", # 225 "\xE1", # "\xD9\x84"
237             "\x{0645}", "m", # 227 "\xE3", # "\xD9\x85"
238             "\x{0646}", "n", # 228 "\xE4", # "\xD9\x86"
239             "\x{0647}", "h", # 229 "\xE5", # "\xD9\x87"
240             "\x{0648}", "w", # 230 "\xE6", # "\xD9\x88"
241             "\x{0649}", "Y", # 236 "\xEC", # "\xD9\x89" 'alif maq.suura
242             "\x{064A}", "y", # 237 "\xED", # "\xD9\x8A"
243             "\x{0651}", "\\shadda{}", # 248 "\xF8", # "\xD9\x91" ^sadda
244             # "\x{0652}", '"', # 250 "\xFA", # "\xD9\x92" sukuun
245             "\x{0652}", "", # 250 "\xFA", # "\xD9\x92" sukuun
246             "\x{0671}", "A", # 199 "\xC7", # "\xD9\xB1" wa.sla-on-'alif
247              
248             "\x{067E}", "p",
249             "\x{06A4}", "v",
250             "\x{06AF}", "g",
251              
252             "\x{0681}", "c",
253             "\x{0686}", "^c",
254             "\x{0685}", ",c",
255             "\x{0698}", "^z",
256             "\x{06AD}", "^n",
257             "\x{06B5}", "^l",
258             "\x{0695}", ".r",
259              
260             "\x{0628}\x{0651}", "bb", # 200 "\xC8", # "\xD8\xA8"
261             "\x{062A}\x{0651}", "tt", # 202 "\xCA", # "\xD8\xAA"
262             "\x{062B}\x{0651}", "_t_t", # 203 "\xCB", # "\xD8\xAB" <_t>
263             "\x{062C}\x{0651}", "^g^g", # 204 "\xCC", # "\xD8\xAC" <^g>
264             "\x{062D}\x{0651}", ".h.h", # 205 "\xCD", # "\xD8\xAD" <.h>
265             "\x{062E}\x{0651}", "_h_h", # 206 "\xCE", # "\xD8\xAE" <_h>
266             "\x{062F}\x{0651}", "dd", # 207 "\xCF", # "\xD8\xAF"
267             "\x{0630}\x{0651}", "_d_d", # 208 "\xD0", # "\xD8\xB0" <_d>
268             "\x{0631}\x{0651}", "rr", # 209 "\xD1", # "\xD8\xB1"
269             "\x{0632}\x{0651}", "zz", # 210 "\xD2", # "\xD8\xB2"
270             "\x{0633}\x{0651}", "ss", # 211 "\xD3", # "\xD8\xB3"
271             "\x{0634}\x{0651}", "^s^s", # 212 "\xD4", # "\xD8\xB4" <^s>
272             "\x{0635}\x{0651}", ".s.s", # 213 "\xD5", # "\xD8\xB5" <.s>
273             "\x{0636}\x{0651}", ".d.d", # 214 "\xD6", # "\xD8\xB6" <.d>
274             "\x{0637}\x{0651}", ".t.t", # 216 "\xD8", # "\xD8\xB7" <.t>
275             "\x{0638}\x{0651}", ".z.z", # 217 "\xD9", # "\xD8\xB8" <.z>
276             "\x{0639}\x{0651}", "``", # 218 "\xDA", # "\xD8\xB9" <`>
277             "\x{063A}\x{0651}", ".g.g", # 219 "\xDB", # "\xD8\xBA" <.g>
278             "\x{0641}\x{0651}", "ff", # 221 "\xDD", # "\xD9\x81"
279             "\x{0642}\x{0651}", "qq", # 222 "\xDE", # "\xD9\x82"
280             "\x{0643}\x{0651}", "kk", # 223 "\xDF", # "\xD9\x83"
281             "\x{0644}\x{0651}", "ll", # 225 "\xE1", # "\xD9\x84"
282             "\x{0645}\x{0651}", "mm", # 227 "\xE3", # "\xD9\x85"
283             "\x{0646}\x{0651}", "nn", # 228 "\xE4", # "\xD9\x86"
284             "\x{0647}\x{0651}", "hh", # 229 "\xE5", # "\xD9\x87"
285             "\x{0648}\x{0651}", "ww", # 230 "\xE6", # "\xD9\x88"
286             "\x{064A}\x{0651}", "yy", # 237 "\xED", # "\xD9\x8A"
287              
288             );
289              
290              
291 4     4   31 no strict 'refs';
  4         5  
  4         53117  
292              
293 1         8 ${ $cls . '::encoder' } = $encoder;
  1         7  
294              
295 1 50       4 if ($option{'describe'}) {
296              
297 0         0 $_->describe('') foreach @{${ $cls . '::encoder' }};
  0         0  
  0         0  
298             }
299              
300 1 50       2 $cls->enmode(defined ${ $cls . '::enmode' } ? ${ $cls . '::enmode' } : 'default');
  1         8  
  0         0  
301              
302 1         1 return ${ $cls . '::encoder' };
  1         5  
303             }
304              
305              
306             sub decoder ($@) {
307 1     1 1 6 my $cls = shift @_;
308              
309 1         5 my $decoder = $cls->eecoder('decoder', @_);
310              
311 1 50 33     6 return $decoder unless defined $decoder and $decoder == -1;
312              
313 1         1 $decoder = [];
314              
315              
316 1         12 my @sunny = (
317             [ "t", "\x{062A}" ], # "\xD8\xAA"
318             [ "_t", "\x{062B}" ], # "\xD8\xAB" <_t>
319             [ "d", "\x{062F}" ], # "\xD8\xAF"
320             [ "_d", "\x{0630}" ], # "\xD8\xB0" <_d>
321             [ "r", "\x{0631}" ], # "\xD8\xB1"
322             [ "z", "\x{0632}" ], # "\xD8\xB2"
323             [ "s", "\x{0633}" ], # "\xD8\xB3"
324             [ "^s", "\x{0634}" ], # "\xD8\xB4" <^s>
325             [ ".s", "\x{0635}" ], # "\xD8\xB5" <.s>
326             [ ".d", "\x{0636}" ], # "\xD8\xB6" <.d>
327             [ ".t", "\x{0637}" ], # "\xD8\xB7" <.t>
328             [ ".z", "\x{0638}" ], # "\xD8\xB8" <.z>
329             [ "l", "\x{0644}" ], # "\xD9\x84"
330             [ "n", "\x{0646}" ], # "\xD9\x86"
331             );
332              
333              
334 1         3 my @empty = (
335             [ "|", "" ], # ArabTeX's "invisible consonant"
336             [ "", "\x{0627}" ], # "\xD8\xA7" bare 'alif
337             );
338              
339              
340 1         3 my @taaaa = (
341             [ "T", "\x{0629}" ], # "\xD8\xA9"
342             [ "H", "\x{0629}" ], # "\xD8\xA9"
343             );
344              
345              
346 1         19 my @moony = (
347             [ "'A", "\x{0622}" ], # "\xD8\xA2" madda-over-'alif
348             [ "'a", "\x{0623}" ], # "\xD8\xA3" hamza-over-'alif
349             [ "'i", "\x{0625}" ], # "\xD8\xA5" hamza-under-'alif
350             [ "'w", "\x{0624}" ], # "\xD8\xA4" hamza-over-waaw
351             [ "'y", "\x{0626}" ], # "\xD8\xA6" hamza-over-yaa'
352             [ "'|", "\x{0621}" ], # "\xD8\xA1" hamza-on-the-line
353             [ "b", "\x{0628}" ], # "\xD8\xA8"
354             [ "^g", "\x{062C}" ], # "\xD8\xAC" <^g>
355             [ ".h", "\x{062D}" ], # "\xD8\xAD" <.h>
356             [ "_h", "\x{062E}" ], # "\xD8\xAE" <_h>
357             [ "`", "\x{0639}" ], # "\xD8\xB9" <`>
358             [ ".g", "\x{063A}" ], # "\xD8\xBA" <.g>
359             [ "f", "\x{0641}" ], # "\xD9\x81"
360             [ "q", "\x{0642}" ], # "\xD9\x82"
361             [ "k", "\x{0643}" ], # "\xD9\x83"
362             [ "m", "\x{0645}" ], # "\xD9\x85"
363             [ "h", "\x{0647}" ], # "\xD9\x87"
364             [ "w", "\x{0648}" ], # "\xD9\x88"
365             [ "y", "\x{064A}" ], # "\xD9\x8A"
366              
367             [ "B", "\x{0640}" ], # ArabTeX's "consonantal ta.twiil"
368              
369             [ "p", "\x{067E}" ],
370             [ "v", "\x{06A4}" ],
371             [ "g", "\x{06AF}" ],
372              
373             [ "c", "\x{0681}" ], # .ha with hamza
374             [ "^c", "\x{0686}" ], # gim with three
375             [ ",c", "\x{0685}" ], # _ha with three
376             [ "^z", "\x{0698}" ], # zay with three
377             [ "^n", "\x{06AD}" ], # kaf with three
378             [ "^l", "\x{06B5}" ], # lam with a bow above
379             [ ".r", "\x{0695}" ], # ra' with a bow below
380             );
381              
382              
383 1         7 my @scope = (
384             "b", "t", "_t", "^g", ".h", "_h", "d", "_d", "r", "z", "s", "^s", ".s",
385             ".d", ".t", ".z", "`", ".g", "f", "q", "k", "l", "m", "n", "h", "w",
386             "p", "v", "g", "c", "^c", ",c", "^z", "^n", "^l", ".r", "|", "B",
387             # "'", "y" treated specifically in some cases -- "T", "H" must as well
388             );
389              
390              
391 39 50       265 $decoder->[0] = Encode::Mapper->compile (
392              
393             [
394             'silent' => 0,
395             ],
396              
397             "_A", [ "", "Y" ],
398             "_U", [ "", "U" ],
399              
400             "WA", [ "", "W" ],
401              
402             "y_A", [ "", "yY" ],
403              
404             "yaN_A", [ "", "yaNY" ],
405             "yaNY", [ "", "yaN" ],
406              
407             "yY", [ "y", "A" ],
408              
409             # word-internal occurrence
410              
411             "TA", [ "t", "A" ],
412             "TU", [ "t", "U" ],
413             "TI", [ "t", "I" ],
414             "TY", [ "t", "Y" ],
415              
416             "T_I", [ "t", "_I" ],
417              
418             "T_A", [ "t", "_A" ],
419             "T_U", [ "t", "_U" ],
420              
421             (
422             map {
423              
424 41         56 "T" . $_, [ "t", $_ ],
425              
426             "Ta" . $_, [ "t", "a" . $_ ],
427             "Tu" . $_, [ "t", "u" . $_ ],
428             "Ti" . $_, [ "t", "i" . $_ ],
429              
430             ( $option{'non-quoting'} ? () : (
431              
432             "T\"" . $_, [ "t", "\"" . $_ ],
433              
434             "T\"a" . $_, [ "t", "\"a" . $_ ],
435             "T\"u" . $_, [ "t", "\"u" . $_ ],
436             "T\"i" . $_, [ "t", "\"i" . $_ ],
437              
438             ) ),
439              
440             } @scope, "y" # "T", "H", "W"
441             ),
442              
443             "Ta'", [ "t", "a'" ],
444             "Tu'", [ "t", "u'" ],
445             "Ti'", [ "t", "i'" ],
446              
447             ( $option{'non-quoting'} ? () : (
448              
449             "T\"'", [ "t", "\"'" ],
450              
451             "T\"a'", [ "t", "\"a'" ],
452             "T\"u'", [ "t", "\"u'" ],
453             "T\"i'", [ "t", "\"i'" ],
454              
455             ) ),
456              
457             (
458             map {
459              
460 63         106 "Y" . $_, [ "A", $_ ],
461              
462             } @scope, "y", "T", "H" # "W"
463             ),
464              
465             # vowel-quoted sequences
466              
467             ( $option{'non-quoting'} ? (
468              
469             "\"", "", # use non-quoting quotes only on no purpose ^^
470              
471             ) : (
472              
473             "\"", "\"",
474              
475             ) ),
476              
477             # general non-protection of \TeX directives
478             (
479             map {
480              
481 4         43 "\\cap" . $_, [ "\\", "cap" . $_ ],
482              
483             } 'A' .. 'Z', 'a' .. 'z', '_', '0' .. '9'
484             ),
485              
486             "\\", "\\",
487              
488             # strict \cap removal and white-space collapsing
489             (
490             map {
491              
492 40         201 "\\cap" . $_ . "\x09", [ "", "\\cap " ],
493             "\\cap" . $_ . "\x0A", [ "", "\\cap " ],
494             "\\cap" . $_ . "\x0D", [ "", "\\cap " ],
495             "\\cap" . $_ . "\x20", [ "", "\\cap " ],
496              
497             "\\cap" . $_, "",
498              
499             } "\x09", "\x0A", "\x0D", "\x20"
500             ),
501              
502             "\\cap", "",
503              
504             # interfering rarely with the notation, or erroneous
505              
506             "^A'a", [ "^A'|", "a" ],
507              
508             "^A", [ "^A", "|" ],
509             "^I", [ "^I", "|" ],
510             "^U", [ "^U", "|" ],
511              
512             "_a", [ "_a", "|" ],
513             "_i", [ "_i", "|" ],
514             "_u", [ "_u", "|" ],
515              
516             "_aA", [ "_aA", "|" ],
517             "_aY", [ "_aY", "|" ],
518             "_aU", [ "_aU", "|" ],
519             "_aI", [ "_aI", "|" ],
520              
521             "'_a", [ "", "_a" ],
522             "'_i", [ "", "_i" ],
523             "'_u", [ "", "_u" ],
524              
525             "'^A", [ "", "^A" ],
526             "'^I", [ "", "^I" ],
527             "'^U", [ "", "^U" ],
528              
529             # word-initial carriers
530              
531             "'", "'a", # covers much implicitly
532              
533             "'i", [ "'i", "i" ],
534              
535             "'A", [ "'", "A" ],
536             "'I", [ "'i", "I" ],
537              
538             "'_I", [ "'i", "_I" ],
539              
540             "''", "'a'a", # .. still needed ^^
541              
542             "''i", [ "'i'i", "i" ],
543             "''I", [ "'i'i", "I" ],
544              
545             "''_I", [ "'i'i", "_I" ],
546              
547             ( $option{'non-quoting'} ? () : (
548              
549             "'\"i", [ "'i\"", "i" ],
550              
551             "'\"A", [ "'", "A" ],
552             "'\"I", [ "'i\"", "I" ],
553              
554             "'\"_I", [ "'i\"", "_I" ],
555              
556             "''\"i", [ "'i'i\"", "i" ],
557             "''\"I", [ "'i'i\"", "I" ],
558              
559             "''\"_I", [ "'i'i\"", "_I" ],
560              
561             ) ),
562              
563             # word-final carriers
564              
565             "Y'", "A'|",
566              
567             "A'", "A'|",
568             "I'", "I'|",
569             "U'", "U'|",
570              
571             # "a'", "a'a",
572             # "a'i", "a'ii",
573             # "a'\"i", "a'i\"i",
574              
575             "i'", "i'y",
576             "u'", "u'w",
577              
578             "Y''", "A'|'|",
579              
580             "A''", "A'|'|",
581             "I''", "I'|'|",
582             "U''", "U'|'|",
583              
584             # "a''", "a'a'a",
585             # "a''i", "a'i'ii",
586             # "a''\"i", "a'i'i\"i",
587              
588             "i''", "i'y'y",
589             "u''", "u'w'w",
590              
591             (
592             map { # covers cases in the map below over @scope and # quoted included
593              
594 44 50       3182 $_ . "'", $_ . "'|",
595             $_ . "''", $_ . "'|'|",
596              
597             } @scope, "y", $option{'non-quoting'} ? () : "\"" # quoted included
598             ),
599              
600             "T'", "t'|",
601             "T''", "t'|'|",
602              
603             # word-internal carriers # doubled
604              
605             "a'A", [ "a'", "A" ], # unclear ^^
606             "a'I", [ "a'y", "I" ], "a''I", [ "a'y'y", "I" ],
607             "a'U", [ "a'w", "U" ], "a''U", [ "a'w'w", "U" ],
608              
609             "a'_I", [ "a'y", "_I" ], "a''_I", [ "a'y'y", "_I" ],
610              
611             "u'I", [ "u'y", "I" ], "u''I", [ "u'y'y", "I" ],
612              
613             "u'_I", [ "u'y", "_I" ], "u''_I", [ "u'y'y", "_I" ],
614              
615             "I'aN", [ "I'y", "aN" ], "I''aN", [ "I'y'y", "aN" ],
616             "y'aN", [ "y'y", "aN" ], "y''aN", [ "y'y'y", "aN" ],
617              
618             "A'A", [ "A'|", "A" ], "A''A", [ "A'|'|", "A" ],
619             "A'I", [ "A'y", "I" ], "A''I", [ "A'y'y", "I" ],
620             "A'U", [ "A'w", "U" ], "A''U", [ "A'w'w", "U" ],
621             "A'Y", [ "A'|", "Y" ], "A''Y", [ "A'|'|", "Y" ],
622              
623             "A'_I", [ "A'y", "_I" ], "A''_I", [ "A'y'y", "_I" ],
624              
625             "A'_U", [ "", "A'U" ], "A''_U", [ "", "A''U" ],
626             "A'_A", [ "", "A'Y" ], "A''_A", [ "", "A''Y" ],
627              
628             "I'A", [ "I'y", "A" ], "I''A", [ "I'y'y", "A" ],
629             "I'I", [ "I'y", "I" ], "I''I", [ "I'y'y", "I" ],
630             "I'U", [ "I'y", "U" ], "I''U", [ "I'y'y", "U" ],
631             "I'Y", [ "I'y", "Y" ], "I''Y", [ "I'y'y", "Y" ],
632              
633             "I'_I", [ "I'y", "_I" ], "I''_I", [ "I'y'y", "_I" ],
634              
635             "I'_U", [ "", "I'U" ], "I''_U", [ "", "I''U" ],
636             "I'_A", [ "", "I'Y" ], "I''_A", [ "", "I''Y" ],
637              
638             "y'A", [ "y'y", "A" ], "y''A", [ "y'y'y", "A" ],
639             "y'I", [ "y'y", "I" ], "y''I", [ "y'y'y", "I" ],
640             "y'U", [ "y'y", "U" ], "y''U", [ "y'y'y", "U" ],
641             "y'Y", [ "y'y", "Y" ], "y''Y", [ "y'y'y", "Y" ],
642              
643             "y'_I", [ "y'y", "_I" ], "y''_I", [ "y'y'y", "_I" ],
644              
645             "y'_U", [ "", "y'U" ], "y''_U", [ "", "y''U" ],
646             "y'_A", [ "", "y'Y" ], "y''_A", [ "", "y''Y" ],
647              
648             "U'A", [ "U'w", "A" ], "U''A", [ "U'w'w", "A" ],
649             "U'I", [ "U'y", "I" ], "U''I", [ "U'y'y", "I" ],
650             "U'U", [ "U'w", "U" ], "U''U", [ "U'w'w", "U" ],
651             "U'Y", [ "U'w", "Y" ], "U''Y", [ "U'w'w", "Y" ],
652              
653             "U'_I", [ "U'y", "_I" ], "U''_I", [ "U'y'y", "_I" ],
654              
655             "U'_U", [ "", "U'U" ], "U''_U", [ "", "U''U" ],
656             "U'_A", [ "", "U'Y" ], "U''_A", [ "", "U''Y" ],
657              
658             "uw'A", [ "uw'w", "A" ], "uw''A", [ "uw'w'w", "A" ],
659             "uw'I", [ "uw'y", "I" ], "uw''I", [ "uw'y'y", "I" ],
660             "uw'U", [ "uw'w", "U" ], "uw''U", [ "uw'w'w", "U" ],
661             "uw'Y", [ "uw'w", "Y" ], "uw''Y", [ "uw'w'w", "Y" ],
662              
663             "uw'_I", [ "uw'y", "_I" ], "uw''_I", [ "uw'y'y", "_I" ],
664              
665             "uw'_U", [ "", "uw'U" ], "uw''_U", [ "", "uw''U" ],
666             "uw'_A", [ "", "uw'Y" ], "uw''_A", [ "", "uw''Y" ],
667              
668             ( $option{'non-quoting'} ? () : (
669              
670             "a'\"A", [ "a'", "A" ], # unclear ^^
671             "a'\"I", [ "a'y\"", "I" ], "a''\"I", [ "a'y'y\"", "I" ],
672             "a'\"U", [ "a'w\"", "U" ], "a''\"U", [ "a'w'w\"", "U" ],
673              
674             "a'\"_I", [ "a'y\"", "_I" ], "a''\"_I", [ "a'y'y\"", "_I" ],
675              
676             "u'\"I", [ "u'y\"", "I" ], "u''\"I", [ "u'y'y\"", "I" ],
677              
678             "u'\"_I", [ "u'y\"", "_I" ], "u''\"_I", [ "u'y'y\"", "_I" ],
679              
680             "I'\"aN", [ "I'y\"", "aN" ], "I''\"aN", [ "I'y'y\"", "aN" ],
681             "y'\"aN", [ "y'y\"", "aN" ], "y''\"aN", [ "y'y'y\"", "aN" ],
682              
683             "y\"'\"aN", [ "y\"'y\"", "aN" ], "y\"''\"aN", [ "y\"'y'y\"", "aN" ],
684             "y\"'aN", [ "y\"'y", "aN" ], "y\"''aN", [ "y\"'y'y", "aN" ],
685              
686             "A'\"A", [ "A'|\"", "A" ], "A''\"A", [ "A'|'|\"", "A" ],
687             "A'\"I", [ "A'y\"", "I" ], "A''\"I", [ "A'y'y\"", "I" ],
688             "A'\"U", [ "A'w\"", "U" ], "A''\"U", [ "A'w'w\"", "U" ],
689             "A'\"Y", [ "A'|\"", "Y" ], "A''\"Y", [ "A'|'|\"", "Y" ],
690              
691             "A'\"_I", [ "A'y\"", "_I" ], "A''\"_I", [ "A'y'y\"", "_I" ],
692              
693             "A'\"_U", [ "", "A'\"U" ], "A''\"_U", [ "", "A''\"U" ],
694             "A'\"_A", [ "", "A'\"Y" ], "A''\"_A", [ "", "A''\"Y" ],
695              
696             "I'\"A", [ "I'y\"", "A" ], "I''\"A", [ "I'y'y\"", "A" ],
697             "I'\"I", [ "I'y\"", "I" ], "I''\"I", [ "I'y'y\"", "I" ],
698             "I'\"U", [ "I'y\"", "U" ], "I''\"U", [ "I'y'y\"", "U" ],
699             "I'\"Y", [ "I'y\"", "Y" ], "I''\"Y", [ "I'y'y\"", "Y" ],
700              
701             "I'\"_I", [ "I'y\"", "_I" ], "I''\"_I", [ "I'y'y\"", "_I" ],
702              
703             "I'\"_U", [ "", "I'\"U" ], "I''\"_U", [ "", "I''\"U" ],
704             "I'\"_A", [ "", "I'\"Y" ], "I''\"_A", [ "", "I''\"Y" ],
705              
706             "y'\"A", [ "y'y\"", "A" ], "y''\"A", [ "y'y'y\"", "A" ],
707             "y'\"I", [ "y'y\"", "I" ], "y''\"I", [ "y'y'y\"", "I" ],
708             "y'\"U", [ "y'y\"", "U" ], "y''\"U", [ "y'y'y\"", "U" ],
709             "y'\"Y", [ "y'y\"", "Y" ], "y''\"Y", [ "y'y'y\"", "Y" ],
710              
711             "y'\"_I", [ "y'y\"", "_I" ], "y''\"_I", [ "y'y'y\"", "_I" ],
712              
713             "y'\"_U", [ "", "y'\"U" ], "y''\"_U", [ "", "y''\"U" ],
714             "y'\"_A", [ "", "y'\"Y" ], "y''\"_A", [ "", "y''\"Y" ],
715              
716             "y\"'\"A", [ "y\"'y\"", "A" ], "y\"''\"A", [ "y\"'y'y\"", "A" ],
717             "y\"'\"I", [ "y\"'y\"", "I" ], "y\"''\"I", [ "y\"'y'y\"", "I" ],
718             "y\"'\"U", [ "y\"'y\"", "U" ], "y\"''\"U", [ "y\"'y'y\"", "U" ],
719             "y\"'\"Y", [ "y\"'y\"", "Y" ], "y\"''\"Y", [ "y\"'y'y\"", "Y" ],
720              
721             "y\"'\"_I", [ "y\"'y\"", "_I" ], "y\"''\"_I", [ "y\"'y'y\"", "_I" ],
722              
723             "y\"'\"_U", [ "", "y\"'\"U" ], "y\"''\"_U", [ "", "y\"''\"U" ],
724             "y\"'\"_A", [ "", "y\"'\"Y" ], "y\"''\"_A", [ "", "y\"''\"Y" ],
725              
726             "y\"'A", [ "y\"'y", "A" ], "y\"''A", [ "y\"'y'y", "A" ],
727             "y\"'I", [ "y\"'y", "I" ], "y\"''I", [ "y\"'y'y", "I" ],
728             "y\"'U", [ "y\"'y", "U" ], "y\"''U", [ "y\"'y'y", "U" ],
729             "y\"'Y", [ "y\"'y", "Y" ], "y\"''Y", [ "y\"'y'y", "Y" ],
730              
731             "y\"'_I", [ "y\"'y", "_I" ], "y\"''_I", [ "y\"'y'y", "_I" ],
732              
733             "y\"'_U", [ "", "y\"'U" ], "y\"''_U", [ "", "y\"''U" ],
734             "y\"'_A", [ "", "y\"'Y" ], "y\"''_A", [ "", "y\"''Y" ],
735              
736             "U'\"A", [ "U'w\"", "A" ], "U''\"A", [ "U'w'w\"", "A" ],
737             "U'\"I", [ "U'y\"", "I" ], "U''\"I", [ "U'y'y\"", "I" ],
738             "U'\"U", [ "U'w\"", "U" ], "U''\"U", [ "U'w'w\"", "U" ],
739             "U'\"Y", [ "U'w\"", "Y" ], "U''\"Y", [ "U'w'w\"", "Y" ],
740              
741             "U'\"_I", [ "U'y\"", "_I" ], "U''\"_I", [ "U'y'y\"", "_I" ],
742              
743             "U'\"_U", [ "", "U'\"U" ], "U''\"_U", [ "", "U''\"U" ],
744             "U'\"_A", [ "", "U'\"Y" ], "U''\"_A", [ "", "U''\"Y" ],
745              
746             "uw'\"A", [ "uw'w\"", "A" ], "uw''\"A", [ "uw'w'w\"", "A" ],
747             "uw'\"I", [ "uw'y\"", "I" ], "uw''\"I", [ "uw'y'y\"", "I" ],
748             "uw'\"U", [ "uw'w\"", "U" ], "uw''\"U", [ "uw'w'w\"", "U" ],
749             "uw'\"Y", [ "uw'w\"", "Y" ], "uw''\"Y", [ "uw'w'w\"", "Y" ],
750              
751             "uw'\"_I", [ "uw'y\"", "_I" ], "uw''\"_I", [ "uw'y'y\"", "_I" ],
752              
753             "uw'\"_U", [ "", "uw'\"U" ], "uw''\"_U", [ "", "uw''\"U" ],
754             "uw'\"_A", [ "", "uw'\"Y" ], "uw''\"_A", [ "", "uw''\"Y" ],
755              
756             ) ),
757              
758             (
759             map { # doubled
760              
761 39         49 "a'i" . $_, [ "a'y", "i" . $_ ], "a''i" . $_, [ "a'y'y", "i" . $_ ],
762             "a'u" . $_, [ "a'w", "u" . $_ ], "a''u" . $_, [ "a'w'w", "u" . $_ ],
763             "u'i" . $_, [ "u'y", "i" . $_ ], "u''i" . $_, [ "u'y'y", "i" . $_ ],
764              
765             "A'a" . $_, [ "A'|", "a" . $_ ], "A''a" . $_, [ "A'|'|", "a" . $_ ],
766             "A'i" . $_, [ "A'y", "i" . $_ ], "A''i" . $_, [ "A'y'y", "i" . $_ ],
767             "A'u" . $_, [ "A'w", "u" . $_ ], "A''u" . $_, [ "A'w'w", "u" . $_ ],
768              
769             "I'a" . $_, [ "I'y", "a" . $_ ], "I''a" . $_, [ "I'y'y", "a" . $_ ],
770             "I'i" . $_, [ "I'y", "i" . $_ ], "I''i" . $_, [ "I'y'y", "i" . $_ ],
771             "I'u" . $_, [ "I'y", "u" . $_ ], "I''u" . $_, [ "I'y'y", "u" . $_ ],
772              
773             "y'a" . $_, [ "y'y", "a" . $_ ], "y''a" . $_, [ "y'y'y", "a" . $_ ],
774             "y'i" . $_, [ "y'y", "i" . $_ ], "y''i" . $_, [ "y'y'y", "i" . $_ ],
775             "y'u" . $_, [ "y'y", "u" . $_ ], "y''u" . $_, [ "y'y'y", "u" . $_ ],
776              
777             "U'a" . $_, [ "U'w", "a" . $_ ], "U''a" . $_, [ "U'w'w", "a" . $_ ],
778             "U'i" . $_, [ "U'y", "i" . $_ ], "U''i" . $_, [ "U'y'y", "i" . $_ ],
779             "U'u" . $_, [ "U'w", "u" . $_ ], "U''u" . $_, [ "U'w'w", "u" . $_ ],
780              
781             "uw'a" . $_, [ "uw'w", "a" . $_ ], "uw''a" . $_, [ "uw'w'w", "a" . $_ ],
782             "uw'i" . $_, [ "uw'y", "i" . $_ ], "uw''i" . $_, [ "uw'y'y", "i" . $_ ],
783             "uw'u" . $_, [ "uw'w", "u" . $_ ], "uw''u" . $_, [ "uw'w'w", "u" . $_ ],
784              
785             ( $option{'non-quoting'} ? () : (
786              
787             "a'\"i" . $_, [ "a'y\"", "i" . $_ ], "a''\"i" . $_, [ "a'y'y\"", "i" . $_ ],
788             "a'\"u" . $_, [ "a'w\"", "u" . $_ ], "a''\"u" . $_, [ "a'w'w\"", "u" . $_ ],
789             "u'\"i" . $_, [ "u'y\"", "i" . $_ ], "u''\"i" . $_, [ "u'y'y\"", "i" . $_ ],
790              
791             "A'\"a" . $_, [ "A'|\"", "a" . $_ ], "A''\"a" . $_, [ "A'|'|\"", "a" . $_ ],
792             "A'\"i" . $_, [ "A'y\"", "i" . $_ ], "A''\"i" . $_, [ "A'y'y\"", "i" . $_ ],
793             "A'\"u" . $_, [ "A'w\"", "u" . $_ ], "A''\"u" . $_, [ "A'w'w\"", "u" . $_ ],
794              
795             "I'\"a" . $_, [ "I'y\"", "a" . $_ ], "I''\"a" . $_, [ "I'y'y\"", "a" . $_ ],
796             "I'\"i" . $_, [ "I'y\"", "i" . $_ ], "I''\"i" . $_, [ "I'y'y\"", "i" . $_ ],
797             "I'\"u" . $_, [ "I'y\"", "u" . $_ ], "I''\"u" . $_, [ "I'y'y\"", "u" . $_ ],
798              
799             "y'\"a" . $_, [ "y'y\"", "a" . $_ ], "y''\"a" . $_, [ "y'y'y\"", "a" . $_ ],
800             "y'\"i" . $_, [ "y'y\"", "i" . $_ ], "y''\"i" . $_, [ "y'y'y\"", "i" . $_ ],
801             "y'\"u" . $_, [ "y'y\"", "u" . $_ ], "y''\"u" . $_, [ "y'y'y\"", "u" . $_ ],
802              
803             "y\"'\"a" . $_, [ "y\"'y\"", "a" . $_ ], "y\"''\"a" . $_, [ "y\"'y'y\"", "a" . $_ ],
804             "y\"'\"i" . $_, [ "y\"'y\"", "i" . $_ ], "y\"''\"i" . $_, [ "y\"'y'y\"", "i" . $_ ],
805             "y\"'\"u" . $_, [ "y\"'y\"", "u" . $_ ], "y\"''\"u" . $_, [ "y\"'y'y\"", "u" . $_ ],
806              
807             "y\"'a" . $_, [ "y\"'y", "a" . $_ ], "y\"''a" . $_, [ "y\"'y'y", "a" . $_ ],
808             "y\"'i" . $_, [ "y\"'y", "i" . $_ ], "y\"''i" . $_, [ "y\"'y'y", "i" . $_ ],
809             "y\"'u" . $_, [ "y\"'y", "u" . $_ ], "y\"''u" . $_, [ "y\"'y'y", "u" . $_ ],
810              
811             "U'\"a" . $_, [ "U'w\"", "a" . $_ ], "U''\"a" . $_, [ "U'w'w\"", "a" . $_ ],
812             "U'\"i" . $_, [ "U'y\"", "i" . $_ ], "U''\"i" . $_, [ "U'y'y\"", "i" . $_ ],
813             "U'\"u" . $_, [ "U'w\"", "u" . $_ ], "U''\"u" . $_, [ "U'w'w\"", "u" . $_ ],
814              
815             "uw'\"a" . $_, [ "uw'w\"", "a" . $_ ], "uw''\"a" . $_, [ "uw'w'w\"", "a" . $_ ],
816             "uw'\"i" . $_, [ "uw'y\"", "i" . $_ ], "uw''\"i" . $_, [ "uw'y'y\"", "i" . $_ ],
817             "uw'\"u" . $_, [ "uw'w\"", "u" . $_ ], "uw''\"u" . $_, [ "uw'w'w\"", "u" . $_ ],
818              
819             ) ),
820              
821             } "'", @scope, "y", "T", "H", "W", "_W"
822             ),
823              
824             (
825             map { # doubled
826              
827 40 50       1549 my $fix = $_;
828              
829 1716 50       22940 $_ . "'A", [ $_ . "'", "A" ], $_ . "''A", [ $_ . "'a'a", "A" ],
830             $_ . "'I", [ $_ . "'y", "I" ], $_ . "''I", [ $_ . "'y'y", "I" ],
831             $_ . "'U", [ $_ . "'w", "U" ], $_ . "''U", [ $_ . "'w'w", "U" ],
832              
833             $_ . "'Y", [ $_ . "'a", "Y" ], $_ . "''Y", [ $_ . "'a'a", "Y" ],
834              
835             $_ . "'aNY", [ $_ . "'a", "aNY" ], $_ . "''aNY", [ $_ . "'a'a", "aNY" ],
836              
837             $_ . "'_I", [ $_ . "'y", "_I" ], $_ . "''_I", [ $_ . "'y'y", "_I" ],
838              
839             $_ . "'_U", [ "", $_ . "'U" ], $_ . "''_U", [ "", $_ . "''U" ],
840              
841             ( $option{'non-quoting'} ? () : (
842              
843             $_ . "'\"A", [ $_ . "'", "A" ], $_ . "''\"A", [ $_ . "'a'a\"", "A" ],
844             $_ . "'\"I", [ $_ . "'y\"", "I" ], $_ . "''\"I", [ $_ . "'y'y\"", "I" ],
845             $_ . "'\"U", [ $_ . "'w\"", "U" ], $_ . "''\"U", [ $_ . "'w'w\"", "U" ],
846              
847             $_ . "'\"Y", [ $_ . "'a\"", "Y" ], $_ . "''\"Y", [ $_ . "'a'a\"", "Y" ],
848              
849             $_ . "'\"aNY", [ $_ . "'a\"", "aNY" ], $_ . "''\"aNY", [ $_ . "'a'a\"", "aNY" ],
850              
851             $_ . "'\"_I", [ $_ . "'y\"", "_I" ], $_ . "''\"_I", [ $_ . "'y'y\"", "_I" ],
852              
853             $_ . "'\"_U", [ "", $_ . "'\"U" ], $_ . "''\"_U", [ "", $_ . "''\"U" ],
854              
855             ) ),
856              
857             map { # doubled
858              
859 39 50       836 $fix . "'a" . $_, [ $fix . "'a", "a" . $_ ], $fix . "''a" . $_, [ $fix . "'a'a", "a" . $_ ],
860             $fix . "'i" . $_, [ $fix . "'y", "i" . $_ ], $fix . "''i" . $_, [ $fix . "'y'y", "i" . $_ ],
861             $fix . "'u" . $_, [ $fix . "'w", "u" . $_ ], $fix . "''u" . $_, [ $fix . "'w'w", "u" . $_ ],
862              
863             ( $option{'non-quoting'} ? () : (
864              
865             $fix . "'\"a" . $_, [ $fix . "'a\"", "a" . $_ ], $fix . "''\"a" . $_, [ $fix . "'a'a\"", "a" . $_ ],
866             $fix . "'\"i" . $_, [ $fix . "'y\"", "i" . $_ ], $fix . "''\"i" . $_, [ $fix . "'y'y\"", "i" . $_ ],
867             $fix . "'\"u" . $_, [ $fix . "'w\"", "u" . $_ ], $fix . "''\"u" . $_, [ $fix . "'w'w\"", "u" . $_ ],
868              
869             ) ),
870              
871             } "'", @scope, "y", "T", "H", "W", "_W"
872              
873             } @scope, $option{'non-quoting'} ? () : "\"" # quoted included
874             ),
875              
876             "T'A", [ "t'", "A" ], "T''A", [ "t'a'a", "A" ],
877             "T'I", [ "t'y", "I" ], "T''I", [ "t'y'y", "I" ],
878             "T'U", [ "t'w", "U" ], "T''U", [ "t'w'w", "U" ],
879              
880             "T'_I", [ "t'y", "_I" ], "T''_I", [ "t'y'y", "_I" ],
881              
882             "T'_U", [ "", "T'U" ], "T''_U", [ "", "T''U" ],
883              
884             ( $option{'non-quoting'} ? () : (
885              
886             "T'\"A", [ "t'", "A" ], "T''\"A", [ "t'a'a\"", "A" ],
887             "T'\"I", [ "t'y\"", "I" ], "T''\"I", [ "t'y'y\"", "I" ],
888             "T'\"U", [ "t'w\"", "U" ], "T''\"U", [ "t'w'w\"", "U" ],
889              
890             "T'\"_I", [ "t'y\"", "_I" ], "T''\"_I", [ "t'y'y\"", "_I" ],
891              
892             "T'\"_U", [ "", "T'\"U" ], "T''\"_U", [ "", "T''\"U" ],
893              
894             ) ),
895              
896             (
897             map { # doubled
898              
899 1 50       12 "T'a" . $_, [ "t'a", "a" . $_ ], "T''a" . $_, [ "t'a'a", "a" . $_ ],
    50          
    50          
    50          
    50          
    50          
    50          
900             "T'i" . $_, [ "t'y", "i" . $_ ], "T''i" . $_, [ "t'y'y", "i" . $_ ],
901             "T'u" . $_, [ "t'w", "u" . $_ ], "T''u" . $_, [ "t'w'w", "u" . $_ ],
902              
903             ( $option{'non-quoting'} ? () : (
904              
905             "T'\"a" . $_, [ "t'a\"", "a" . $_ ], "T''\"a" . $_, [ "t'a'a\"", "a" . $_ ],
906             "T'\"i" . $_, [ "t'y\"", "i" . $_ ], "T''\"i" . $_, [ "t'y'y\"", "i" . $_ ],
907             "T'\"u" . $_, [ "t'w\"", "u" . $_ ], "T''\"u" . $_, [ "t'w'w\"", "u" . $_ ],
908              
909             ) ),
910              
911             } "'", @scope, "y" # "T", "H", "W"
912             ),
913              
914             );
915              
916              
917 10         38 $decoder->[1] = Encode::Mapper->compile (
918              
919             [
920             'others' => undef,
921             'silent' => 0,
922             ],
923              
924             # non-exciting entities
925              
926             "\x09", "\x09",
927             "\x0A", "\x0A",
928             "\x0D", "\x0D",
929              
930             " ", " ",
931             ".", ".",
932             ":", ":",
933             "!", "!",
934              
935             "/", "/",
936             "\\", "\\",
937              
938             ",", "\x{060C}", # "\xD8\x8C" right-to-left-comma
939             ";", "\x{061B}", # "\xD8\x9B" right-to-left-semicolon
940             "?", "\x{061F}", # "\xD8\x9F" right-to-left-question-mark
941              
942             "--", "\x{0640}", # "\xD9\x80" ta.twiil
943              
944             (
945             map {
946              
947 47         259 "" . $_, chr 0x0660 + $_,
948              
949             } 0 .. 9
950             ),
951              
952             # improper auxiliary vowels -- the case of conditioned deletion
953              
954             "-a", "",
955             "-u", "",
956             "-i", "",
957              
958             (
959             map {
960              
961 2         10 "-a" . $_->[0], [ "", "a" . $_->[0] ],
962             "-i" . $_->[0], [ "", "i" . $_->[0] ],
963             "-u" . $_->[0], [ "", "u" . $_->[0] ],
964              
965             } @sunny, @moony, @taaaa, $empty[0]
966             ),
967              
968             # non-voweled/sukuuned sunnies and moonies
969             (
970             map {
971              
972 2         9 my $x = 1 + $_;
973 2         7 my $y = "\x{0651}" x $_; # "\xD9\x91" ^sadda
974              
975 88         142 map {
976              
977 2         15 my $fix = $_;
978              
979 4136 50       151757 $_->[0] x $x, $_->[1] . $y . "\x{0652}", # "\xD9\x92" sukuun
    50          
980              
981             ( $option{'non-refined'} ? () : (
982              
983             $_->[0] x $x . "-a", $_->[1] . $y . "\x{064E}",
984             $_->[0] x $x . "-u", $_->[1] . $y . "\x{064F}",
985             $_->[0] x $x . "-i", $_->[1] . $y . "\x{0650}",
986              
987             $_->[0] x $x . "-A", $_->[1] . $y . "\x{064E}\x{0627}",
988             $_->[0] x $x . "-Y", $_->[1] . $y . "\x{064E}\x{0649}",
989              
990             $_->[0] x $x . "-U", $_->[1] . $y . "\x{064F}\x{0648}",
991             $_->[0] x $x . "-I", $_->[1] . $y . "\x{0650}\x{064A}",
992              
993             $_->[0] x $x . "-aN", $_->[1] . $y . "\x{064B}" . ( $_->[0] eq "'a" ? "" : "\x{0627}" ),
994             $_->[0] x $x . "-uN", $_->[1] . $y . "\x{064C}",
995             $_->[0] x $x . "-iN", $_->[1] . $y . "\x{064D}",
996              
997             $_->[0] x $x . "-aNA", $_->[1] . $y . "\x{064B}\x{0627}",
998             $_->[0] x $x . "-uNA", $_->[1] . $y . "\x{064C}\x{0627}",
999             $_->[0] x $x . "-iNA", $_->[1] . $y . "\x{064D}\x{0627}",
1000              
1001             $_->[0] x $x . "-aNY", $_->[1] . $y . "\x{064B}\x{0649}",
1002             $_->[0] x $x . "-uNY", $_->[1] . $y . "\x{064C}\x{0649}",
1003             $_->[0] x $x . "-iNY", $_->[1] . $y . "\x{064D}\x{0649}",
1004              
1005             $_->[0] x $x . "-aNU", $_->[1] . $y . "\x{064B}\x{0648}",
1006             $_->[0] x $x . "-uNU", $_->[1] . $y . "\x{064C}\x{0648}",
1007             $_->[0] x $x . "-iNU", $_->[1] . $y . "\x{064D}\x{0648}",
1008              
1009             ) ),
1010              
1011             ( $option{'non-quoting'} ? () : (
1012              
1013             $_->[0] x $x . "\"", $_->[1] . $y . "\"\x{0652}", # "\xD9\x92" sukuun
1014              
1015             ( $option{'non-refined'} ? () : (
1016              
1017             $_->[0] x $x . "-\"a", $_->[1] . $y . "\"\x{064E}",
1018             $_->[0] x $x . "-\"u", $_->[1] . $y . "\"\x{064F}",
1019             $_->[0] x $x . "-\"i", $_->[1] . $y . "\"\x{0650}",
1020              
1021             $_->[0] x $x . "-\"A", $_->[1] . $y . "\"\x{064E}\x{0627}",
1022             $_->[0] x $x . "-\"Y", $_->[1] . $y . "\"\x{064E}\x{0649}",
1023              
1024             $_->[0] x $x . "-\"U", $_->[1] . $y . "\"\x{064F}\x{0648}",
1025             $_->[0] x $x . "-\"I", $_->[1] . $y . "\"\x{0650}\x{064A}",
1026              
1027             $_->[0] x $x . "-\"aN", $_->[1] . $y . "\"\x{064B}" . ( $_->[0] eq "'a" ? "" : "\x{0627}" ),
1028             $_->[0] x $x . "-\"uN", $_->[1] . $y . "\"\x{064C}",
1029             $_->[0] x $x . "-\"iN", $_->[1] . $y . "\"\x{064D}",
1030              
1031             $_->[0] x $x . "-\"aNA", $_->[1] . $y . "\"\x{064B}\x{0627}",
1032             $_->[0] x $x . "-\"uNA", $_->[1] . $y . "\"\x{064C}\x{0627}",
1033             $_->[0] x $x . "-\"iNA", $_->[1] . $y . "\"\x{064D}\x{0627}",
1034              
1035             $_->[0] x $x . "-\"aNY", $_->[1] . $y . "\"\x{064B}\x{0649}",
1036             $_->[0] x $x . "-\"uNY", $_->[1] . $y . "\"\x{064C}\x{0649}",
1037             $_->[0] x $x . "-\"iNY", $_->[1] . $y . "\"\x{064D}\x{0649}",
1038              
1039             $_->[0] x $x . "-\"aNU", $_->[1] . $y . "\"\x{064B}\x{0648}",
1040             $_->[0] x $x . "-\"uNU", $_->[1] . $y . "\"\x{064C}\x{0648}",
1041             $_->[0] x $x . "-\"iNU", $_->[1] . $y . "\"\x{064D}\x{0648}",
1042              
1043             ) ),
1044              
1045             ) ),
1046              
1047             map {
1048              
1049 88 100       3202 ( $option{'non-refined'} ? () : (
    50          
    100          
    50          
    50          
1050              
1051             $fix->[0] x $x . "-a" . $_->[0], [ $fix->[1] . $y . "\x{0652}", "a" . $_->[0] ],
1052             $fix->[0] x $x . "-u" . $_->[0], [ $fix->[1] . $y . "\x{0652}", "u" . $_->[0] ],
1053             $fix->[0] x $x . "-i" . $_->[0], [ $fix->[1] . $y . "\x{0652}", "i" . $_->[0] ],
1054              
1055             $fix->[0] x $x . "-A" . $_->[0], [ $fix->[1] . $y . "\x{0652}", "A" . $_->[0] ],
1056             $fix->[0] x $x . "-Y" . $_->[0], [ $fix->[1] . $y . "\x{0652}", "Y" . $_->[0] ],
1057              
1058             $fix->[0] x $x . "-U" . $_->[0], [ $fix->[1] . $y . "\x{0652}", "U" . $_->[0] ],
1059             $fix->[0] x $x . "-I" . $_->[0], [ $fix->[1] . $y . "\x{0652}", "I" . $_->[0] ],
1060              
1061             ( $option{'non-quoting'} ? () : (
1062              
1063             $fix->[0] x $x . "-\"a" . $_->[0], [ $fix->[1] . $y . "\x{0652}\"", "a" . $_->[0] ],
1064             $fix->[0] x $x . "-\"u" . $_->[0], [ $fix->[1] . $y . "\x{0652}\"", "u" . $_->[0] ],
1065             $fix->[0] x $x . "-\"i" . $_->[0], [ $fix->[1] . $y . "\x{0652}\"", "i" . $_->[0] ],
1066              
1067             $fix->[0] x $x . "-\"A" . $_->[0], [ $fix->[1] . $y . "\x{0652}\"", "A" . $_->[0] ],
1068             $fix->[0] x $x . "-\"Y" . $_->[0], [ $fix->[1] . $y . "\x{0652}\"", "Y" . $_->[0] ],
1069              
1070             $fix->[0] x $x . "-\"U" . $_->[0], [ $fix->[1] . $y . "\x{0652}\"", "U" . $_->[0] ],
1071             $fix->[0] x $x . "-\"I" . $_->[0], [ $fix->[1] . $y . "\x{0652}\"", "I" . $_->[0] ],
1072              
1073             ) ),
1074              
1075             ) ),
1076              
1077             } @sunny, @moony, @taaaa, $empty[0]
1078              
1079             } @sunny, @moony[1 .. $#moony], $empty[0] # $moony[0] excluded as long as is unclear ^^
1080              
1081             } 0, 1
1082             ),
1083              
1084             $moony[0]->[0], $moony[0]->[1], # now necessary of course ^^
1085              
1086             # voweled/non-sukuuned sunnies and moonies
1087             (
1088             map {
1089              
1090 2         5 my $x = 1 + $_;
1091 2         5 my $y = "\x{0651}" x $_; # "\xD9\x91" ^sadda
1092              
1093 90         107 map {
1094              
1095 2         5 my $fix = $_;
1096              
1097 1350 50       11827 $_->[0] x $x . "a", $_->[1] . $y . "\x{064E}",
1098             $_->[0] x $x . "u", $_->[1] . $y . "\x{064F}",
1099             $_->[0] x $x . "i", $_->[1] . $y . "\x{0650}",
1100              
1101             $_->[0] x $x . "_a", $_->[1] . $y . "\x{0670}",
1102              
1103             ( $option{'non-refined'} ? () : (
1104              
1105             $_->[0] x $x . "_u", $_->[1] . $y . "\x{0657}",
1106             $_->[0] x $x . "_i", $_->[1] . $y . "\x{0656}",
1107              
1108             $_->[0] x $x . "_aA", $_->[1] . $y . "\x{0670}\x{0627}",
1109             $_->[0] x $x . "_aY", $_->[1] . $y . "\x{0670}\x{0649}",
1110             $_->[0] x $x . "_aU", $_->[1] . $y . "\x{0670}\x{0648}",
1111             $_->[0] x $x . "_aI", $_->[1] . $y . "\x{0670}\x{064A}",
1112              
1113             ) ),
1114              
1115             $_->[0] x $x . "A", $_->[1] . $y . "\x{064E}\x{0627}",
1116             $_->[0] x $x . "Y", $_->[1] . $y . "\x{064E}\x{0649}",
1117              
1118             $_->[0] x $x . "_I", $_->[1] . $y . "\x{0650}\x{0627}",
1119              
1120             $_->[0] x $x . "U", $_->[1] . $y . "\x{064F}\x{0648}",
1121             $_->[0] x $x . "I", $_->[1] . $y . "\x{0650}\x{064A}",
1122              
1123             $_->[0] x $x . "Uw", [ $_->[1] . $y . "\x{064F}", "ww" ],
1124             $_->[0] x $x . "Iy", [ $_->[1] . $y . "\x{0650}", "yy" ],
1125              
1126             ( $option{'non-refined'} ? () : (
1127              
1128             $_->[0] x $x . "^A", $_->[1] . $y . "\x{064F}\x{0627}\x{0653}",
1129             $_->[0] x $x . "^U", $_->[1] . $y . "\x{064F}\x{0648}\x{0653}",
1130             $_->[0] x $x . "^I", $_->[1] . $y . "\x{0650}\x{064A}\x{0653}",
1131              
1132             $_->[0] x $x . "^Uw", [ $_->[1] . $y . "\x{064F}\x{0648}\x{0655}", "|" ], # roughly
1133             $_->[0] x $x . "^Iy", [ $_->[1] . $y . "\x{0650}\x{0649}\x{0655}", "|" ], # roughly
1134              
1135             ) ),
1136              
1137             $_->[0] x $x . "aa", [ "", $_->[0] x $x . "A" ],
1138             $_->[0] x $x . "uw", [ "", $_->[0] x $x . "U" ],
1139             $_->[0] x $x . "iy", [ "", $_->[0] x $x . "I" ],
1140              
1141             ( $option{'non-quoting'} ? () : (
1142              
1143             $_->[0] x $x . "\"a", $_->[1] . $y . "\"\x{064E}",
1144             $_->[0] x $x . "\"u", $_->[1] . $y . "\"\x{064F}",
1145             $_->[0] x $x . "\"i", $_->[1] . $y . "\"\x{0650}",
1146              
1147             $_->[0] x $x . "\"_a", $_->[1] . $y . "\"\x{0670}",
1148              
1149             ( $option{'non-refined'} ? () : (
1150              
1151             $_->[0] x $x . "\"_u", $_->[1] . $y . "\"\x{0657}",
1152             $_->[0] x $x . "\"_i", $_->[1] . $y . "\"\x{0656}",
1153              
1154             $_->[0] x $x . "\"_aA", $_->[1] . $y . "\"\x{0670}\x{0627}",
1155             $_->[0] x $x . "\"_aY", $_->[1] . $y . "\"\x{0670}\x{0649}",
1156             $_->[0] x $x . "\"_aU", $_->[1] . $y . "\"\x{0670}\x{0648}",
1157             $_->[0] x $x . "\"_aI", $_->[1] . $y . "\"\x{0670}\x{064A}",
1158              
1159             ) ),
1160              
1161             $_->[0] x $x . "\"A", $_->[1] . $y . "\"\x{064E}\x{0627}",
1162             $_->[0] x $x . "\"Y", $_->[1] . $y . "\"\x{064E}\x{0649}",
1163              
1164             $_->[0] x $x . "\"A\"", $_->[1] . $y . "\"\x{064E}\x{0627}\"\x{0652}",
1165             $_->[0] x $x . "\"Y\"", $_->[1] . $y . "\"\x{064E}\x{0649}\"\x{0652}",
1166              
1167             $_->[0] x $x . "A\"", $_->[1] . $y . "\x{064E}\x{0627}\"\x{0652}",
1168             $_->[0] x $x . "Y\"", $_->[1] . $y . "\x{064E}\x{0649}\"\x{0652}",
1169              
1170             $_->[0] x $x . "\"_I", $_->[1] . $y . "\"\x{0650}\x{0627}",
1171             $_->[0] x $x . "\"_I\"", $_->[1] . $y . "\"\x{0650}\x{0627}\"\x{0652}",
1172             $_->[0] x $x . "_I\"", $_->[1] . $y . "\x{0650}\x{0627}\"\x{0652}",
1173              
1174             $_->[0] x $x . "\"U", $_->[1] . $y . "\"\x{064F}\x{0648}",
1175             $_->[0] x $x . "\"I", $_->[1] . $y . "\"\x{0650}\x{064A}",
1176              
1177             $_->[0] x $x . "\"U\"", $_->[1] . $y . "\"\x{064F}\x{0648}\"\x{0652}",
1178             $_->[0] x $x . "\"I\"", $_->[1] . $y . "\"\x{0650}\x{064A}\"\x{0652}",
1179              
1180             $_->[0] x $x . "U\"", $_->[1] . $y . "\x{064F}\x{0648}\"\x{0652}",
1181             $_->[0] x $x . "I\"", $_->[1] . $y . "\x{0650}\x{064A}\"\x{0652}",
1182              
1183             $_->[0] x $x . "\"Uw", [ $_->[1] . $y . "\"\x{064F}", "ww" ],
1184             $_->[0] x $x . "\"Iy", [ $_->[1] . $y . "\"\x{0650}", "yy" ],
1185              
1186             ( $option{'non-refined'} ? () : (
1187              
1188             $_->[0] x $x . "\"^A", $_->[1] . $y . "\"\x{064F}\x{0627}\x{0653}",
1189             $_->[0] x $x . "\"^U", $_->[1] . $y . "\"\x{064F}\x{0648}\x{0653}",
1190             $_->[0] x $x . "\"^I", $_->[1] . $y . "\"\x{0650}\x{064A}\x{0653}",
1191              
1192             $_->[0] x $x . "\"^Uw", [ $_->[1] . $y . "\"\x{064F}\x{0648}\x{0655}", "|" ], # roughly
1193             $_->[0] x $x . "\"^Iy", [ $_->[1] . $y . "\"\x{0650}\x{0649}\x{0655}", "|" ], # roughly
1194              
1195             ) ),
1196              
1197             $_->[0] x $x . "\"aa", [ "", $_->[0] x $x . "\"A" ],
1198             $_->[0] x $x . "\"uw", [ "", $_->[0] x $x . "\"U" ],
1199             $_->[0] x $x . "\"iy", [ "", $_->[0] x $x . "\"I" ],
1200              
1201             ) ),
1202              
1203             (
1204             map {
1205              
1206 90 50       3319 $fix->[0] x $x . "uw" . $_, [ $fix->[1] . $y . "\x{064F}", "w" . $_ ],
    50          
    50          
    50          
    50          
    50          
    100          
    100          
    50          
1207             $fix->[0] x $x . "iy" . $_, [ $fix->[1] . $y . "\x{0650}", "y" . $_ ],
1208              
1209             ( $option{'non-quoting'} ? () : (
1210              
1211             $fix->[0] x $x . "\"uw" . $_, [ $fix->[1] . $y . "\"\x{064F}", "w" . $_ ],
1212             $fix->[0] x $x . "\"iy" . $_, [ $fix->[1] . $y . "\"\x{0650}", "y" . $_ ],
1213              
1214             ) ),
1215              
1216             } "\"", qw "a u i A Y U I _I", $option{'non-refined'} ? () : qw "_a _u _i ^A ^U ^I"
1217             ),
1218              
1219             $_->[0] x $x . "_aA'|aN", $_->[1] . $y . "\x{0670}\x{0627}\x{0621}\x{064B}",
1220             $_->[0] x $x . "A'|aN", $_->[1] . $y . "\x{064E}\x{0627}\x{0621}\x{064B}",
1221              
1222             $_->[0] x $x . "aN", $_->[1] . $y . "\x{064B}" . ( $_->[0] eq "'a" ? "" : "\x{0627}" ),
1223             $_->[0] x $x . "uN", $_->[1] . $y . "\x{064C}",
1224             $_->[0] x $x . "iN", $_->[1] . $y . "\x{064D}",
1225              
1226             ( $option{'non-quoting'} ? () : (
1227              
1228             $_->[0] x $x . "\"_aA'|aN", $_->[1] . $y . "\"\x{0670}\x{0627}\x{0621}\x{064B}",
1229             $_->[0] x $x . "\"A'|aN", $_->[1] . $y . "\"\x{064E}\x{0627}\x{0621}\x{064B}",
1230              
1231             $_->[0] x $x . "\"_aA'|\"aN", $_->[1] . $y . "\"\x{0670}\x{0627}\x{0621}\"\x{064B}",
1232             $_->[0] x $x . "\"A'|\"aN", $_->[1] . $y . "\"\x{064E}\x{0627}\x{0621}\"\x{064B}",
1233              
1234             $_->[0] x $x . "_aA'|\"aN", $_->[1] . $y . "\x{0670}\x{0627}\x{0621}\"\x{064B}",
1235             $_->[0] x $x . "A'|\"aN", $_->[1] . $y . "\x{064E}\x{0627}\x{0621}\"\x{064B}",
1236              
1237             $_->[0] x $x . "\"A\"'|aN", $_->[1] . $y . "\"\x{064E}\x{0627}\"\x{0652}\x{0621}\x{064B}",
1238             $_->[0] x $x . "\"A\"'|\"aN", $_->[1] . $y . "\"\x{064E}\x{0627}\"\x{0652}\x{0621}\"\x{064B}",
1239             $_->[0] x $x . "A\"'|\"aN", $_->[1] . $y . "\x{064E}\x{0627}\"\x{0652}\x{0621}\"\x{064B}",
1240              
1241             $_->[0] x $x . "\"aN", $_->[1] . $y . "\"\x{064B}" . ( $_->[0] eq "'a" ? "" : "\x{0627}" ),
1242             $_->[0] x $x . "\"uN", $_->[1] . $y . "\"\x{064C}",
1243             $_->[0] x $x . "\"iN", $_->[1] . $y . "\"\x{064D}",
1244              
1245             ) ),
1246              
1247             } @sunny, @moony, $empty[0]
1248              
1249             } 0, 1
1250             ),
1251              
1252             # 'alif protected endings
1253             (
1254             map {
1255              
1256 2 50       13 my $x = 1 + $_;
1257 2         4 my $y = "\x{0651}" x $_; # "\xD9\x91" ^sadda
1258              
1259 90 50       4084 map {
    50          
    50          
1260              
1261 2         6 $_->[0] x $x . "_aA'|aNA", $_->[1] . $y . "\x{0670}\x{0627}\x{0621}\x{064B}\x{0627}",
1262             $_->[0] x $x . "A'|aNA", $_->[1] . $y . "\x{064E}\x{0627}\x{0621}\x{064B}\x{0627}",
1263              
1264             $_->[0] x $x . "aNA", $_->[1] . $y . "\x{064B}\x{0627}",
1265             $_->[0] x $x . "aNY", $_->[1] . $y . "\x{064B}\x{0649}",
1266              
1267             $_->[0] x $x . "uNU", $_->[1] . $y . "\x{064C}\x{0648}",
1268             $_->[0] x $x . "iNU", $_->[1] . $y . "\x{064D}\x{0648}",
1269              
1270             ( $option{'non-refined'} ? () : (
1271              
1272             $_->[0] x $x . "uNA", $_->[1] . $y . "\x{064C}\x{0627}",
1273             $_->[0] x $x . "iNA", $_->[1] . $y . "\x{064D}\x{0627}",
1274              
1275             $_->[0] x $x . "uNY", $_->[1] . $y . "\x{064C}\x{0649}",
1276             $_->[0] x $x . "iNY", $_->[1] . $y . "\x{064D}\x{0649}",
1277              
1278             $_->[0] x $x . "aNU", $_->[1] . $y . "\x{064B}\x{0648}",
1279              
1280             $_->[0] x $x . "aW-a", $_->[1] . $y . "\x{064E}\x{0648}\x{064E}\x{0627}",
1281             $_->[0] x $x . "aW-u", $_->[1] . $y . "\x{064E}\x{0648}\x{064F}\x{0627}",
1282             $_->[0] x $x . "aW-i", $_->[1] . $y . "\x{064E}\x{0648}\x{0650}\x{0627}",
1283              
1284             ) ),
1285              
1286             $_->[0] x $x . "a_W", $_->[1] . $y . "\x{064E}\x{0648}",
1287             $_->[0] x $x . "u_W", $_->[1] . $y . "\x{064F}\x{0648}",
1288             $_->[0] x $x . "i_W", $_->[1] . $y . "\x{0650}\x{0648}",
1289              
1290             $_->[0] x $x . "aW", $_->[1] . $y . "\x{064E}\x{0648}\x{0652}\x{0627}",
1291             $_->[0] x $x . "uW", $_->[1] . $y . "\x{064F}\x{0648}\x{0627}",
1292             $_->[0] x $x . "UW", $_->[1] . $y . "\x{064F}\x{0648}\x{0627}",
1293             $_->[0] x $x . "UA", $_->[1] . $y . "\x{064F}\x{0648}\x{0627}",
1294              
1295             ( $option{'non-quoting'} ? () : (
1296              
1297             $_->[0] x $x . "\"_aA'|aNA", $_->[1] . $y . "\"\x{0670}\x{0627}\x{0621}\x{064B}\x{0627}",
1298             $_->[0] x $x . "\"A'|aNA", $_->[1] . $y . "\"\x{064E}\x{0627}\x{0621}\x{064B}\x{0627}",
1299              
1300             $_->[0] x $x . "\"_aA'|\"aNA", $_->[1] . $y . "\"\x{0670}\x{0627}\x{0621}\"\x{064B}\x{0627}",
1301             $_->[0] x $x . "\"A'|\"aNA", $_->[1] . $y . "\"\x{064E}\x{0627}\x{0621}\"\x{064B}\x{0627}",
1302              
1303             $_->[0] x $x . "_aA'|\"aNA", $_->[1] . $y . "\x{0670}\x{0627}\x{0621}\"\x{064B}\x{0627}",
1304             $_->[0] x $x . "A'|\"aNA", $_->[1] . $y . "\x{064E}\x{0627}\x{0621}\"\x{064B}\x{0627}",
1305              
1306             $_->[0] x $x . "\"A\"'|aNA", $_->[1] . $y . "\"\x{064E}\x{0627}\"\x{0652}\x{0621}\x{064B}\x{0627}",
1307             $_->[0] x $x . "\"A\"'|\"aNA", $_->[1] . $y . "\"\x{064E}\x{0627}\"\x{0652}\x{0621}\"\x{064B}\x{0627}",
1308             $_->[0] x $x . "A\"'|\"aNA", $_->[1] . $y . "\x{064E}\x{0627}\"\x{0652}\x{0621}\"\x{064B}\x{0627}",
1309              
1310             $_->[0] x $x . "\"aNA", $_->[1] . $y . "\"\x{064B}\x{0627}",
1311             $_->[0] x $x . "\"aNY", $_->[1] . $y . "\"\x{064B}\x{0649}",
1312              
1313             $_->[0] x $x . "\"uNU", $_->[1] . $y . "\"\x{064C}\x{0648}",
1314             $_->[0] x $x . "\"iNU", $_->[1] . $y . "\"\x{064D}\x{0648}",
1315              
1316             ( $option{'non-refined'} ? () : (
1317              
1318             $_->[0] x $x . "\"uNA", $_->[1] . $y . "\"\x{064C}\x{0627}",
1319             $_->[0] x $x . "\"iNA", $_->[1] . $y . "\"\x{064D}\x{0627}",
1320              
1321             $_->[0] x $x . "\"uNY", $_->[1] . $y . "\"\x{064C}\x{0649}",
1322             $_->[0] x $x . "\"iNY", $_->[1] . $y . "\"\x{064D}\x{0649}",
1323              
1324             $_->[0] x $x . "\"aNU", $_->[1] . $y . "\"\x{064B}\x{0648}",
1325              
1326             $_->[0] x $x . "\"aW-a", $_->[1] . $y . "\"\x{064E}\x{0648}\x{064E}\x{0627}",
1327             $_->[0] x $x . "\"aW-u", $_->[1] . $y . "\"\x{064E}\x{0648}\x{064F}\x{0627}",
1328             $_->[0] x $x . "\"aW-i", $_->[1] . $y . "\"\x{064E}\x{0648}\x{0650}\x{0627}",
1329              
1330             $_->[0] x $x . "\"aW-\"a", $_->[1] . $y . "\"\x{064E}\x{0648}\"\x{064E}\x{0627}",
1331             $_->[0] x $x . "\"aW-\"u", $_->[1] . $y . "\"\x{064E}\x{0648}\"\x{064F}\x{0627}",
1332             $_->[0] x $x . "\"aW-\"i", $_->[1] . $y . "\"\x{064E}\x{0648}\"\x{0650}\x{0627}",
1333              
1334             $_->[0] x $x . "aW-\"a", $_->[1] . $y . "\x{064E}\x{0648}\"\x{064E}\x{0627}",
1335             $_->[0] x $x . "aW-\"u", $_->[1] . $y . "\x{064E}\x{0648}\"\x{064F}\x{0627}",
1336             $_->[0] x $x . "aW-\"i", $_->[1] . $y . "\x{064E}\x{0648}\"\x{0650}\x{0627}",
1337              
1338             $_->[0] x $x . "\"aW-\"", $_->[1] . $y . "\"\x{064E}\x{0648}\"\x{0652}\x{0627}",
1339             $_->[0] x $x . "aW-\"", $_->[1] . $y . "\x{064E}\x{0648}\"\x{0652}\x{0627}",
1340              
1341             ) ),
1342              
1343             $_->[0] x $x . "\"a_W", $_->[1] . $y . "\"\x{064E}\x{0648}",
1344             $_->[0] x $x . "\"u_W", $_->[1] . $y . "\"\x{064F}\x{0648}",
1345             $_->[0] x $x . "\"i_W", $_->[1] . $y . "\"\x{0650}\x{0648}",
1346              
1347             $_->[0] x $x . "\"aW", $_->[1] . $y . "\"\x{064E}\x{0648}\x{0652}\x{0627}",
1348             $_->[0] x $x . "\"uW", $_->[1] . $y . "\"\x{064F}\x{0648}\x{0627}",
1349             $_->[0] x $x . "\"UW", $_->[1] . $y . "\"\x{064F}\x{0648}\x{0627}",
1350             $_->[0] x $x . "\"UA", $_->[1] . $y . "\"\x{064F}\x{0648}\x{0627}",
1351              
1352             ) ),
1353              
1354             } @sunny, @moony, $empty[0]
1355              
1356             } 0, 1
1357             ),
1358              
1359             # taa' marbuu.ta endings
1360             (
1361             map {
1362              
1363 1         2 $_->[0], $_->[1] . "\x{0652}", # "\xD9\x92" sukuun
1364              
1365             ( $option{'non-quoting'} ? () : (
1366              
1367             $_->[0] . "\"", $_->[1] . "\"\x{0652}", # "\xD9\x92" sukuun
1368              
1369             ) ),
1370              
1371             } @taaaa
1372             ),
1373              
1374             (
1375             map {
1376              
1377 44         128 my $fix = $_;
1378              
1379 45 50       415 $_->[0] . "a", $_->[1] . "\x{064E}",
    50          
1380             $_->[0] . "u", $_->[1] . "\x{064F}",
1381             $_->[0] . "i", $_->[1] . "\x{0650}",
1382              
1383             $_->[0] . "aN", $_->[1] . "\x{064B}",
1384             $_->[0] . "uN", $_->[1] . "\x{064C}",
1385             $_->[0] . "iN", $_->[1] . "\x{064D}",
1386              
1387             ( $option{'non-quoting'} ? () : (
1388              
1389             $_->[0] . "\"a", $_->[1] . "\"\x{064E}",
1390             $_->[0] . "\"u", $_->[1] . "\"\x{064F}",
1391             $_->[0] . "\"i", $_->[1] . "\"\x{0650}",
1392              
1393             $_->[0] . "\"aN", $_->[1] . "\"\x{064B}",
1394             $_->[0] . "\"uN", $_->[1] . "\"\x{064C}",
1395             $_->[0] . "\"iN", $_->[1] . "\"\x{064D}",
1396              
1397             ) ),
1398              
1399             # non-voweled/sukuuned
1400              
1401             ( $option{'non-refined'} ? () : (
1402              
1403             $_->[0] . "-a", $_->[1] . "\x{064E}",
1404             $_->[0] . "-u", $_->[1] . "\x{064F}",
1405             $_->[0] . "-i", $_->[1] . "\x{0650}",
1406              
1407             $_->[0] . "-aN", $_->[1] . "\x{064B}",
1408             $_->[0] . "-uN", $_->[1] . "\x{064C}",
1409             $_->[0] . "-iN", $_->[1] . "\x{064D}",
1410              
1411             ( $option{'non-quoting'} ? () : (
1412              
1413             $_->[0] . "-\"a", $_->[1] . "\"\x{064E}",
1414             $_->[0] . "-\"u", $_->[1] . "\"\x{064F}",
1415             $_->[0] . "-\"i", $_->[1] . "\"\x{0650}",
1416              
1417             $_->[0] . "-\"aN", $_->[1] . "\"\x{064B}",
1418             $_->[0] . "-\"uN", $_->[1] . "\"\x{064C}",
1419             $_->[0] . "-\"iN", $_->[1] . "\"\x{064D}",
1420              
1421             ) ),
1422              
1423             ) ),
1424              
1425             map {
1426              
1427 1 50       39 ( $option{'non-refined'} ? () : (
    50          
    50          
1428              
1429             $fix->[0] . "-a" . $_->[0], [ $fix->[1] . "\x{0652}", "a" . $_->[0] ],
1430             $fix->[0] . "-u" . $_->[0], [ $fix->[1] . "\x{0652}", "u" . $_->[0] ],
1431             $fix->[0] . "-i" . $_->[0], [ $fix->[1] . "\x{0652}", "i" . $_->[0] ],
1432              
1433             ( $option{'non-quoting'} ? () : (
1434              
1435             $fix->[0] . "-\"a" . $_->[0], [ $fix->[1] . "\x{0652}\"", "a" . $_->[0] ],
1436             $fix->[0] . "-\"u" . $_->[0], [ $fix->[1] . "\x{0652}\"", "u" . $_->[0] ],
1437             $fix->[0] . "-\"i" . $_->[0], [ $fix->[1] . "\x{0652}\"", "i" . $_->[0] ],
1438              
1439             ) ),
1440              
1441             ) ),
1442              
1443             } @sunny, @moony, $empty[0] # @taaaa
1444              
1445             } $taaaa[0]
1446             ),
1447              
1448             # definite article assimilation .. non-linguistic
1449              
1450             (
1451             map {
1452              
1453 8         9 $_->[0] . "-" . $_->[0], [ "\x{0644}", $_->[0] x 2 ],
1454             "l-" . $_->[0] x 2, [ "\x{0644}", $_->[0] x 2 ],
1455              
1456             } @sunny, @moony
1457             ),
1458              
1459             (
1460             map {
1461              
1462 1         2 my $fix = $_;
1463              
1464 344         1188 "l" . $_ . "-all", [ "", "l" . ( $_ eq "" ? "|" : $_ ) . "ll" ],
1465             "l" . $_ . "-al-", [ "", "l" . ( $_ eq "" ? "|" : $_ ) . "l-" ],
1466              
1467             "l" . $_ . "-al-l", [ "", "l" . $_ . "-ll" ],
1468             "l" . $_ . "-al-ll", [ "", "l" . $_ . "-ll" ],
1469              
1470             map {
1471              
1472 112         115 "l" . $fix . "-a" . $_->[0] . "-" . $_->[0], [ "", "l" . $fix . "l-" . $_->[0] x 2 ],
1473             "l" . $fix . "-al-" . $_->[0] x 2, [ "", "l" . $fix . "l-" . $_->[0] x 2 ],
1474              
1475 8 100       53 } @moony, grep { $_->[0] ne "l" } @sunny
    100          
1476              
1477             } "", "a", "u", "i", $option{'non-quoting'} ? () : ( "\"", "\"a", "\"u", "\"i" )
1478             ),
1479              
1480             # initial vowels
1481              
1482             ( $option{'non-quoting'} ? () : (
1483              
1484             "\"", "\x{0671}", # this grapheme is mode-dependent in the next level
1485              
1486             ) ),
1487              
1488             (
1489             map {
1490              
1491 1 50       12771 my $fix = $_;
    50          
1492              
1493 15 50       3271 $_->[0] . "a", $_->[1] . "\x{064E}",
1494             $_->[0] . "u", $_->[1] . "\x{064F}",
1495             $_->[0] . "i", $_->[1] . "\x{0650}",
1496              
1497             ( $option{'non-refined'} ? () : (
1498              
1499             $_->[0] . "_a", $_->[1] . "\x{0670}",
1500             $_->[0] . "_u", $_->[1] . "\x{0657}",
1501             $_->[0] . "_i", $_->[1] . "\x{0656}",
1502              
1503             $_->[0] . "_aA", $_->[1] . "\x{0670}\x{0627}",
1504             $_->[0] . "_aY", $_->[1] . "\x{0670}\x{0649}",
1505             $_->[0] . "_aU", $_->[1] . "\x{0670}\x{0648}",
1506             $_->[0] . "_aI", $_->[1] . "\x{0670}\x{064A}",
1507              
1508             ) ),
1509              
1510             $_->[0] . "A", $_->[1] . "\x{064E}\x{0627}",
1511             $_->[0] . "Y", $_->[1] . "\x{064E}\x{0649}",
1512              
1513             $_->[0] . "_I", $_->[1] . "\x{0650}\x{0627}",
1514              
1515             $_->[0] . "U", $_->[1] . "\x{064F}\x{0648}",
1516             $_->[0] . "I", $_->[1] . "\x{0650}\x{064A}",
1517              
1518             $_->[0] . "Uw", [ $_->[1] . "\x{064F}\x{0648}\x{0651}", "|" ],
1519             $_->[0] . "Iy", [ $_->[1] . "\x{0650}\x{064A}\x{0651}", "|" ],
1520              
1521             ( $option{'non-refined'} ? () : (
1522              
1523             $_->[0] . "^A", "\x{0622}", # use no equivs
1524             $_->[0] . "^U", "\x{0623}\x{064F}\x{0648}", # use no equivs
1525             $_->[0] . "^I", "\x{0625}\x{0650}\x{064A}", # use no equivs
1526              
1527             ) ),
1528              
1529             $_->[0] . "aa", [ "", $_->[0] . "A" ],
1530             $_->[0] . "uw", [ "", $_->[0] . "U" ],
1531             $_->[0] . "iy", [ "", $_->[0] . "I" ],
1532              
1533             ( $option{'non-quoting'} ? () : (
1534              
1535             $_->[0] . "\"a", $_->[1] . "\"\x{064E}",
1536             $_->[0] . "\"u", $_->[1] . "\"\x{064F}",
1537             $_->[0] . "\"i", $_->[1] . "\"\x{0650}",
1538              
1539             ( $option{'non-refined'} ? () : (
1540              
1541             $_->[0] . "\"_a", $_->[1] . "\"\x{0670}",
1542             $_->[0] . "\"_u", $_->[1] . "\"\x{0657}",
1543             $_->[0] . "\"_i", $_->[1] . "\"\x{0656}",
1544              
1545             $_->[0] . "\"_aA", $_->[1] . "\"\x{0670}\x{0627}",
1546             $_->[0] . "\"_aY", $_->[1] . "\"\x{0670}\x{0649}",
1547             $_->[0] . "\"_aU", $_->[1] . "\"\x{0670}\x{0648}",
1548             $_->[0] . "\"_aI", $_->[1] . "\"\x{0670}\x{064A}",
1549              
1550             ) ),
1551              
1552             $_->[0] . "\"A", $_->[1] . "\"\x{064E}\x{0627}",
1553             $_->[0] . "\"Y", $_->[1] . "\"\x{064E}\x{0649}",
1554              
1555             $_->[0] . "\"A\"", $_->[1] . "\"\x{064E}\x{0627}\"\x{0652}",
1556             $_->[0] . "\"Y\"", $_->[1] . "\"\x{064E}\x{0649}\"\x{0652}",
1557              
1558             $_->[0] . "A\"", $_->[1] . "\x{064E}\x{0627}\"\x{0652}",
1559             $_->[0] . "Y\"", $_->[1] . "\x{064E}\x{0649}\"\x{0652}",
1560              
1561             $_->[0] . "\"_I", $_->[1] . "\"\x{0650}\x{0627}",
1562             $_->[0] . "\"_I\"", $_->[1] . "\"\x{0650}\x{0627}\"\x{0652}",
1563             $_->[0] . "_I\"", $_->[1] . "\x{0650}\x{0627}\"\x{0652}",
1564              
1565             $_->[0] . "\"U", $_->[1] . "\"\x{064F}\x{0648}",
1566             $_->[0] . "\"I", $_->[1] . "\"\x{0650}\x{064A}",
1567              
1568             $_->[0] . "\"U\"", $_->[1] . "\"\x{064F}\x{0648}\"\x{0652}",
1569             $_->[0] . "\"I\"", $_->[1] . "\"\x{0650}\x{064A}\"\x{0652}",
1570              
1571             $_->[0] . "U\"", $_->[1] . "\x{064F}\x{0648}\"\x{0652}",
1572             $_->[0] . "I\"", $_->[1] . "\x{0650}\x{064A}\"\x{0652}",
1573              
1574             $_->[0] . "\"Uw", [ $_->[1] . "\"\x{064F}\x{0648}\x{0651}", "|" ],
1575             $_->[0] . "\"Iy", [ $_->[1] . "\"\x{0650}\x{064A}\x{0651}", "|" ],
1576              
1577             ( $option{'non-refined'} ? () : (
1578              
1579             $_->[0] . "\"^A", "\"\x{0622}", # use no equivs
1580             $_->[0] . "\"^U", "\"\x{0623}\x{064F}\x{0648}", # use no equivs
1581             $_->[0] . "\"^I", "\"\x{0625}\x{0650}\x{064A}", # use no equivs
1582              
1583             ) ),
1584              
1585             $_->[0] . "\"aa", [ "", $_->[0] . "\"A" ],
1586             $_->[0] . "\"uw", [ "", $_->[0] . "\"U" ],
1587             $_->[0] . "\"iy", [ "", $_->[0] . "\"I" ],
1588              
1589             ) ),
1590              
1591             (
1592             map {
1593              
1594 1 50       68 $fix->[0] . "uw" . $_, [ $fix->[1] . "\x{064F}", "w" . $_ ],
    50          
    50          
    50          
    50          
    50          
    50          
1595             $fix->[0] . "iy" . $_, [ $fix->[1] . "\x{0650}", "y" . $_ ],
1596              
1597             ( $option{'non-quoting'} ? () : (
1598              
1599             $fix->[0] . "\"uw" . $_, [ $fix->[1] . "\"\x{064F}", "w" . $_ ],
1600             $fix->[0] . "\"iy" . $_, [ $fix->[1] . "\"\x{0650}", "y" . $_ ],
1601              
1602             ) ),
1603              
1604             } "\"", qw "a u i A Y U I _I", $option{'non-refined'} ? () : qw "_a _u _i ^A ^U ^I"
1605             ),
1606              
1607             $_->[0] . "_aA'|aN", $_->[1] . "\x{0670}\x{0627}\x{0621}\x{064B}",
1608             $_->[0] . "A'|aN", $_->[1] . "\x{064E}\x{0627}\x{0621}\x{064B}",
1609              
1610             $_->[0] . "aN", $_->[1] . "\x{064B}",
1611             $_->[0] . "uN", $_->[1] . "\x{064C}",
1612             $_->[0] . "iN", $_->[1] . "\x{064D}",
1613              
1614             ( $option{'non-quoting'} ? () : (
1615              
1616             $_->[0] . "\"_aA'|aN", $_->[1] . "\"\x{0670}\x{0627}\x{0621}\x{064B}",
1617             $_->[0] . "\"A'|aN", $_->[1] . "\"\x{064E}\x{0627}\x{0621}\x{064B}",
1618              
1619             $_->[0] . "\"_aA'|\"aN", $_->[1] . "\"\x{0670}\x{0627}\x{0621}\"\x{064B}",
1620             $_->[0] . "\"A'|\"aN", $_->[1] . "\"\x{064E}\x{0627}\x{0621}\"\x{064B}",
1621              
1622             $_->[0] . "_aA'|\"aN", $_->[1] . "\x{0670}\x{0627}\x{0621}\"\x{064B}",
1623             $_->[0] . "A'|\"aN", $_->[1] . "\x{064E}\x{0627}\x{0621}\"\x{064B}",
1624              
1625             $_->[0] . "\"A\"'|aN", $_->[1] . "\"\x{064E}\x{0627}\"\x{0652}\x{0621}\x{064B}",
1626             $_->[0] . "\"A\"'|\"aN", $_->[1] . "\"\x{064E}\x{0627}\"\x{0652}\x{0621}\"\x{064B}",
1627             $_->[0] . "A\"'|\"aN", $_->[1] . "\x{064E}\x{0627}\"\x{0652}\x{0621}\"\x{064B}",
1628              
1629             $_->[0] . "\"aN", $_->[1] . "\"\x{064B}",
1630             $_->[0] . "\"uN", $_->[1] . "\"\x{064C}",
1631             $_->[0] . "\"iN", $_->[1] . "\"\x{064D}",
1632              
1633             ) ),
1634              
1635             } $empty[1]
1636             ),
1637              
1638             # non-notation insertion escapes provided through ':xml'
1639              
1640             );
1641              
1642              
1643 4     4   51 no strict 'refs';
  4         28  
  4         3654  
1644              
1645 1         28725 ${ $cls . '::decoder' } = $decoder;
  1         14  
1646              
1647 1 50       7 if ($option{'describe'}) {
1648              
1649 0         0 $_->describe('') foreach @{${ $cls . '::decoder' }};
  0         0  
  0         0  
1650             }
1651              
1652 1 50       2 $cls->demode(defined ${ $cls . '::demode' } ? ${ $cls . '::demode' } : 'default');
  1         13  
  0         0  
1653              
1654 1         1 return ${ $cls . '::decoder' };
  1         49  
1655             }
1656              
1657              
1658             sub eecoder ($@) {
1659 2     2 0 6 my $cls = shift @_;
1660 2         4 my $ext = shift @_;
1661              
1662 2 0       9 my %opt = @_ ? do { my $i = 0; map { ++$i % 2 ? lc $_ : $_ } @_ } : ();
  0 50       0  
  0         0  
  0         0  
1663              
1664 4     4   26 no strict 'refs';
  4         52  
  4         209  
1665              
1666 2         3 my $refcoder = \${ $cls . '::' . $ext };
  2         11  
1667              
1668 4     4   21 use strict 'refs';
  4         5  
  4         2840  
1669              
1670              
1671 2 50       7 if (exists $opt{'load'}) {
1672              
1673 0 0       0 if (ref \$opt{'load'} eq 'SCALAR') {
    0          
    0          
1674              
1675 0 0       0 if (my $done = do $opt{'load'}) { # file-define
1676              
1677 0         0 return ${$refcoder} = $done;
  0         0  
1678             }
1679             else {
1680              
1681 0 0       0 carp "Cannot parse " . $opt{'load'} . ": $@" if $@;
1682 0 0       0 carp "Cannot do " . $opt{'load'} . ": $!" unless defined $done;
1683 0         0 carp "Cannot run " . $opt{'load'};
1684              
1685 0         0 return undef;
1686             }
1687             }
1688             elsif (UNIVERSAL::isa($opt{'load'}, 'CODE')) {
1689              
1690 0         0 return ${$refcoder} = $opt{'load'}->();
  0         0  
1691             }
1692             elsif (UNIVERSAL::isa($opt{'load'}, 'ARRAY')) {
1693              
1694 0 0       0 if (grep { not $_->isa('Encode::Mapper') } @{$opt{'load'}}) {
  0         0  
  0         0  
1695 0         0 carp "Expecting a reference to an array of 'Encode::Mapper' objects";
1696 0         0 return undef;
1697             }
1698              
1699 0         0 return ${$refcoder} = $opt{'load'};
  0         0  
1700             }
1701              
1702 0         0 carp "Invalid type of the 'load' parameter, action ignored";
1703 0         0 return undef;
1704             }
1705              
1706 2 50       6 if (exists $opt{'dump'}) {
1707              
1708 0         0 require Data::Dumper;
1709              
1710 0         0 my ($data, $i, @refs, @data);
1711              
1712 0         0 $data = Data::Dumper->new([${$refcoder}], [$ext]);
  0         0  
1713              
1714 0         0 for ($i = 0; $i < @{${$refcoder}}; $i++) {
  0         0  
  0         0  
1715              
1716 0         0 $refs[$i] = ['L', 'H', $ext . "->[$i]" ];
1717 0         0 $data[$i] = ${$refcoder}->[$i]->dumper($refs[$i]);
  0         0  
1718             }
1719              
1720 0 0       0 if (ref \$opt{'dump'} eq 'SCALAR') {
    0          
1721              
1722 0 0 0     0 if ($opt{'dump'} =~ /^[A-Z][A-Za-z]*(\:\:[A-Z][A-Za-z]*)+$/) {
    0          
1723              
1724 0         0 my $class = $cls;
1725              
1726 0         0 for ($class, $opt{'dump'}) {
1727              
1728 0         0 $_ =~ s/\:\:/\//g;
1729 0         0 $_ .= '.pm';
1730             }
1731              
1732 0         0 my $where = $INC{$class} =~ /^(.*)$class$/;
1733              
1734 0         0 $opt{'dump'} = $where . $opt{'dump'};
1735             }
1736             elsif ($opt{'dump'} !~ s/^!// and -f $opt{'dump'}) { # 'SCALAR'
1737              
1738 0         0 carp "The file " . $opt{'dump'} . " exists, ignoring action";
1739 0         0 return undef;
1740             }
1741              
1742 0 0       0 open my $file, '>', $opt{'dump'} or die $opt{'dump'};
1743 0         0 print $file 'my ($L, $H, $' . $ext . ');';
1744              
1745 0         0 for ($i = 0; $i < @{${$refcoder}}; $i++) {
  0         0  
  0         0  
1746              
1747 0         0 print $file $data[$i]->Useqq(1)->Indent(0)->Dump();
1748             }
1749              
1750 0         0 print $file 'return $' . $ext . ';';
1751 0         0 close $file;
1752              
1753 0         0 return ${$refcoder};
  0         0  
1754             }
1755             elsif (UNIVERSAL::isa($opt{'dump'}, 'SCALAR')) {
1756              
1757 0         0 my $dump = ${$opt{'dump'}};
  0         0  
1758              
1759 0         0 ${$opt{'dump'}} = $data;
  0         0  
1760              
1761 0         0 return ${$refcoder};
  0         0  
1762             }
1763             }
1764              
1765 2         5 return -1;
1766             }
1767              
1768              
1769             sub enmode ($$) {
1770 2     2 1 4 my ($cls, $mode) = @_;
1771              
1772 2 50       6 $cls = blessed $cls if ref $cls;
1773              
1774 2 50       7 $mode = 'undef' unless defined $mode;
1775 2 50       10 $mode = $modemap{$mode} if exists $modemap{$mode};
1776              
1777 4     4   24 no strict 'refs';
  4         6  
  4         895  
1778              
1779 2         2 my $return = ${ $cls . '::enmode' };
  2         7  
1780              
1781 2 50       7 ${ $cls . '::enmode' } = $mode if defined $mode;
  2         5  
1782              
1783 2 50       3 return $return unless defined ${ $cls . '::encoder' };
  2         8  
1784              
1785 2 50       7 if (defined $mode) {
1786              
1787 2 50 33     3 $cls->enmoder($mode) unless defined ${ $cls . '::encoder' }->[$mode + $enlevel] or $mode == 0;
  2         45  
1788              
1789 2         2 ${ $cls . '::encoder' }->[$enlevel - 1] = ${ $cls . '::encoder' }->[$mode + $enlevel];
  2         6  
  2         7  
1790             }
1791              
1792 2         3 return $return;
1793             }
1794              
1795              
1796             sub demode ($$) {
1797 2     2 1 5 my ($cls, $mode) = @_;
1798              
1799 2 50       8 $cls = blessed $cls if ref $cls;
1800              
1801 2 50       8 $mode = 'undef' unless defined $mode;
1802 2 50       11 $mode = $modemap{$mode} if exists $modemap{$mode};
1803              
1804 4     4   21 no strict 'refs';
  4         6  
  4         714  
1805              
1806 2         6 my $return = ${ $cls . '::demode' };
  2         8  
1807              
1808 2 50       9 ${ $cls . '::demode' } = $mode if defined $mode;
  2         6  
1809              
1810 2 50       4 return $return unless defined ${ $cls . '::decoder' };
  2         9  
1811              
1812 2 50       8 if (defined $mode) {
1813              
1814 2 50 33     4 $cls->demoder($mode) unless defined ${ $cls . '::decoder' }->[$mode + $delevel] or $mode == 0;
  2         27  
1815              
1816 2         6 ${ $cls . '::decoder' }->[$delevel - 1] = ${ $cls . '::decoder' }->[$mode + $delevel];
  2         9  
  2         12  
1817             }
1818              
1819 2         6 return $return;
1820             }
1821              
1822              
1823             sub enmoder ($$@) {
1824 1     1 0 2 my ($cls, $mode) = @_;
1825              
1826 4     4   25 no strict 'refs';
  4         7  
  4         16896  
1827              
1828 1         1 return ${ $cls . '::encoder' }->[$mode + $enlevel] = undef;
  1         5  
1829             }
1830              
1831              
1832             sub demoder ($$@) {
1833 1     1 0 3 my ($cls, $mode) = @_;
1834              
1835 1         3 my $demoder = [];
1836              
1837              
1838             # rules for the fullvocalize mode
1839              
1840 0         0 $demoder->[4] = [
1841              
1842             [
1843             'silent' => 0,
1844             ],
1845              
1846             "\x{0671}", "\x{0627}",
1847              
1848             "\"\x{0652}", "",
1849             "\"\x{064E}", "",
1850             "\"\x{064F}", "",
1851             "\"\x{0650}", "",
1852             "\"\x{064B}", "",
1853             "\"\x{064C}", "",
1854             "\"\x{064D}", "",
1855             "\"\x{0670}", "",
1856             "\"\x{0657}", "",
1857             "\"\x{0656}", "",
1858              
1859             "\"", "",
1860              
1861             "\x{064E}\x{0627}\"\x{0652}", "\x{064E}\x{0627}\x{0652}",
1862             "\"\x{064E}\x{0627}\"\x{0652}", "\x{0627}\x{0652}",
1863              
1864             (
1865             ( $option{'font-fixing'} ? (
1866              
1867             map {
1868              
1869 3         4 "\x{0644}" . $_ . "\x{064E}\x{0627}\"\x{0652}", "\x{0644}\x{0627}" . $_ . "\x{064E}\x{0652}",
1870             "\x{0644}" . $_ . "\"\x{064E}\x{0627}\"\x{0652}", "\x{0644}\x{0627}" . $_ . "\x{0652}",
1871              
1872             } "", "\x{0651}"
1873              
1874             ) : () ),
1875             ),
1876              
1877             "\x{064E}\x{0649}\"\x{0652}", "\x{064E}\x{0649}\x{0652}",
1878             "\"\x{064E}\x{0649}\"\x{0652}", "\x{0649}\x{0652}",
1879              
1880             "\x{064F}\x{0648}\"\x{0652}", "\x{064F}\x{0648}\x{0652}",
1881             "\"\x{064F}\x{0648}\"\x{0652}", "\x{0648}\x{0652}",
1882              
1883             "\x{0650}\x{064A}\"\x{0652}", "\x{0650}\x{064A}\x{0652}",
1884             "\"\x{0650}\x{064A}\"\x{0652}", "\x{064A}\x{0652}",
1885              
1886             # modern external/internal substitution with wa.sla
1887             (
1888             map {
1889              
1890 0         0 my $vowel = $_;
1891              
1892 27         25033 map {
1893              
1894 3         5 "\x{064E}" . $_ . "\x{0627}" . $vowel, [ "\x{064E}" . $_ . "\x{0671}", "\"" . $vowel ],
1895             "\x{064F}" . $_ . "\x{0627}" . $vowel, [ "\x{064F}" . $_ . "\x{0671}", "\"" . $vowel ],
1896             "\x{0650}" . $_ . "\x{0627}" . $vowel, [ "\x{0650}" . $_ . "\x{0671}", "\"" . $vowel ],
1897              
1898             "\x{064E}\x{0627}" . $_ . "\x{0627}" . $vowel, [ "\x{064E}\x{0627}" . $_ . "\x{0671}", "\"" . $vowel ],
1899             "\x{064E}\x{0649}" . $_ . "\x{0627}" . $vowel, [ "\x{064E}\x{0649}" . $_ . "\x{0671}", "\"" . $vowel ],
1900             "\x{064F}\x{0648}" . $_ . "\x{0627}" . $vowel, [ "\x{064F}\x{0648}" . $_ . "\x{0671}", "\"" . $vowel ],
1901             "\x{0650}\x{064A}" . $_ . "\x{0627}" . $vowel, [ "\x{0650}\x{064A}" . $_ . "\x{0671}", "\"" . $vowel ],
1902              
1903             # quoted
1904              
1905             "\"\x{064E}" . $_ . "\x{0627}" . $vowel, [ $_ . "\x{0671}", "\"" . $vowel ],
1906             "\"\x{064F}" . $_ . "\x{0627}" . $vowel, [ $_ . "\x{0671}", "\"" . $vowel ],
1907             "\"\x{0650}" . $_ . "\x{0627}" . $vowel, [ $_ . "\x{0671}", "\"" . $vowel ],
1908              
1909             "\"\x{064E}\x{0627}" . $_ . "\x{0627}" . $vowel, [ "\x{0627}" . $_ . "\x{0671}", "\"" . $vowel ],
1910             "\"\x{064E}\x{0649}" . $_ . "\x{0627}" . $vowel, [ "\x{0649}" . $_ . "\x{0671}", "\"" . $vowel ],
1911             "\"\x{064F}\x{0648}" . $_ . "\x{0627}" . $vowel, [ "\x{0648}" . $_ . "\x{0671}", "\"" . $vowel ],
1912             "\"\x{0650}\x{064A}" . $_ . "\x{0627}" . $vowel, [ "\x{064A}" . $_ . "\x{0671}", "\"" . $vowel ],
1913              
1914             "\"\x{064E}" . $_ . "\x{0627}\"" . $vowel, [ $_ . "\x{0627}", $vowel ],
1915             "\"\x{064F}" . $_ . "\x{0627}\"" . $vowel, [ $_ . "\x{0627}", $vowel ],
1916             "\"\x{0650}" . $_ . "\x{0627}\"" . $vowel, [ $_ . "\x{0627}", $vowel ],
1917              
1918             "\"\x{064E}\x{0627}" . $_ . "\x{0627}\"" . $vowel, [ "\x{0627}" . $_ . "\x{0627}", $vowel ],
1919             "\"\x{064E}\x{0649}" . $_ . "\x{0627}\"" . $vowel, [ "\x{0649}" . $_ . "\x{0627}", $vowel ],
1920             "\"\x{064F}\x{0648}" . $_ . "\x{0627}\"" . $vowel, [ "\x{0648}" . $_ . "\x{0627}", $vowel ],
1921             "\"\x{0650}\x{064A}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064A}" . $_ . "\x{0627}", $vowel ],
1922              
1923             "\x{064E}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064E}" . $_ . "\x{0627}", $vowel ],
1924             "\x{064F}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064F}" . $_ . "\x{0627}", $vowel ],
1925             "\x{0650}" . $_ . "\x{0627}\"" . $vowel, [ "\x{0650}" . $_ . "\x{0627}", $vowel ],
1926              
1927             "\x{064E}\x{0627}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064E}\x{0627}" . $_ . "\x{0627}", $vowel ],
1928             "\x{064E}\x{0649}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064E}\x{0649}" . $_ . "\x{0627}", $vowel ],
1929             "\x{064F}\x{0648}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064F}\x{0648}" . $_ . "\x{0627}", $vowel ],
1930             "\x{0650}\x{064A}" . $_ . "\x{0627}\"" . $vowel, [ "\x{0650}\x{064A}" . $_ . "\x{0627}", $vowel ],
1931              
1932             } "", "\x09", "\x0A", "\x0D", "\x20", "\x0D\x0A", "\x20\x20", "\x20\x20\x20", "\x20\x20\x20\x20"
1933              
1934             } "\x{064E}", "\x{064F}", "\x{0650}"
1935             ),
1936              
1937             # laam + 'alif .. either enforce ligatures, or shuffle the diacritics
1938             (
1939             ( $option{'font-fixing'} ? (
1940              
1941             map {
1942              
1943 0         0 my $alif = $_;
1944              
1945 0         0 map {
1946              
1947 0         0 my $vowel = $_;
1948              
1949 0         0 map {
1950              
1951 0         0 "\x{0644}" . $_ . $vowel . $alif, "\x{0644}" . $alif . $_ . $vowel,
1952             "\x{0644}" . $_ . "\"" . $vowel . $alif, "\x{0644}" . $alif . $_,
1953              
1954             } "", "\x{0651}"
1955              
1956             } "\x{064E}", "\x{064F}", "\x{0650}",
1957             "\x{064B}", "\x{064C}", "\x{064D}",
1958             "\x{0652}"
1959              
1960             } "\x{0622}", "\x{0623}", "\x{0625}", "\x{0627}" #, "\x{0671}"
1961              
1962             ) : () ),
1963             ),
1964              
1965             (
1966             ( $option{'font-fixing'} ? (
1967              
1968             map {
1969              
1970 0         0 my $vowel = $_;
1971              
1972 0         0 map {
1973              
1974 0         0 "\x{0644}" . $_ . $vowel . "\x{0671}", "\x{0644}\x{0627}" . $_ . $vowel,
1975             "\x{0644}" . $_ . "\"" . $vowel . "\x{0671}", "\x{0644}\x{0627}" . $_,
1976              
1977             } "", "\x{0651}"
1978              
1979             } "\x{064E}", "\x{064F}", "\x{0650}",
1980             "\x{064B}", "\x{064C}", "\x{064D}",
1981             "\x{0652}"
1982              
1983             ) : () ),
1984             ),
1985              
1986             # laam + vowel + 'alif + vowel .. internal substitution with wa.sla
1987             (
1988             ( $option{'font-fixing'} ? (
1989              
1990             map {
1991              
1992 1 50       10 my $double = $_;
    50          
    50          
    50          
1993              
1994 0         0 map {
1995              
1996 0         0 my $vowel = $_;
1997              
1998 0         0 map {
1999              
2000 0         0 "\x{0644}" . $double . $vowel . "\x{0627}" . $_, [ "\x{0644}\x{0671}" . $double . $vowel, "\"" . $_ ],
2001              
2002             # quoted
2003              
2004             "\x{0644}" . $double . "\"" . $vowel . "\x{0627}" . $_, [ "\x{0644}\x{0671}" . $double, "\"" . $_ ],
2005             "\x{0644}" . $double . "\"" . $vowel . "\x{0627}\"" . $_, [ "\x{0644}\x{0627}" . $double, $_ ],
2006             "\x{0644}" . $double . $vowel . "\x{0627}\"" . $_, [ "\x{0644}\x{0627}" . $double . $vowel, $_ ],
2007              
2008             } "\x{064E}", "\x{064F}", "\x{0650}"
2009              
2010             } "\x{064E}", "\x{064F}", "\x{0650}"
2011              
2012             } "", "\x{0651}"
2013              
2014             ) : () ),
2015             ),
2016              
2017             # optional ligatures to enforce here
2018              
2019             ];
2020              
2021              
2022             # rules for the vocalize mode
2023              
2024 3         6 $demoder->[3] = [
2025              
2026             [
2027             'silent' => 0,
2028             ],
2029              
2030             "\"\x{0652}", "\x{0652}",
2031             "\"\x{064E}", "",
2032             "\"\x{064F}", "",
2033             "\"\x{0650}", "",
2034             "\"\x{064B}", "",
2035             "\"\x{064C}", "",
2036             "\"\x{064D}", "",
2037             "\"\x{0670}", "",
2038             "\"\x{0657}", "",
2039             "\"\x{0656}", "",
2040              
2041             "\x{0652}", "",
2042              
2043             "\"", "",
2044              
2045             # modern external/internal substitution with wa.sla
2046             (
2047             map {
2048              
2049 0         0 my $vowel = $_;
2050              
2051 27         2769 map {
2052              
2053 3         5 "\x{064E}" . $_ . "\x{0627}" . $vowel, [ "\x{064E}" . $_ . "\x{0627}", "\"" . $vowel ],
2054             "\x{064F}" . $_ . "\x{0627}" . $vowel, [ "\x{064F}" . $_ . "\x{0627}", "\"" . $vowel ],
2055             "\x{0650}" . $_ . "\x{0627}" . $vowel, [ "\x{0650}" . $_ . "\x{0627}", "\"" . $vowel ],
2056              
2057             "\x{064E}\x{0627}" . $_ . "\x{0627}" . $vowel, [ "\x{064E}\x{0627}" . $_ . "\x{0627}", "\"" . $vowel ],
2058             "\x{064E}\x{0649}" . $_ . "\x{0627}" . $vowel, [ "\x{064E}\x{0649}" . $_ . "\x{0627}", "\"" . $vowel ],
2059             "\x{064F}\x{0648}" . $_ . "\x{0627}" . $vowel, [ "\x{064F}\x{0648}" . $_ . "\x{0627}", "\"" . $vowel ],
2060             "\x{0650}\x{064A}" . $_ . "\x{0627}" . $vowel, [ "\x{0650}\x{064A}" . $_ . "\x{0627}", "\"" . $vowel ],
2061              
2062             # quoted
2063              
2064             "\"\x{064E}" . $_ . "\x{0627}" . $vowel, [ $_ . "\x{0627}", "\"" . $vowel ],
2065             "\"\x{064F}" . $_ . "\x{0627}" . $vowel, [ $_ . "\x{0627}", "\"" . $vowel ],
2066             "\"\x{0650}" . $_ . "\x{0627}" . $vowel, [ $_ . "\x{0627}", "\"" . $vowel ],
2067              
2068             "\"\x{064E}\x{0627}" . $_ . "\x{0627}" . $vowel, [ "\x{0627}" . $_ . "\x{0627}", "\"" . $vowel ],
2069             "\"\x{064E}\x{0649}" . $_ . "\x{0627}" . $vowel, [ "\x{0649}" . $_ . "\x{0627}", "\"" . $vowel ],
2070             "\"\x{064F}\x{0648}" . $_ . "\x{0627}" . $vowel, [ "\x{0648}" . $_ . "\x{0627}", "\"" . $vowel ],
2071             "\"\x{0650}\x{064A}" . $_ . "\x{0627}" . $vowel, [ "\x{064A}" . $_ . "\x{0627}", "\"" . $vowel ],
2072              
2073             "\"\x{064E}" . $_ . "\x{0627}\"" . $vowel, [ $_ . "\x{0627}", $vowel ],
2074             "\"\x{064F}" . $_ . "\x{0627}\"" . $vowel, [ $_ . "\x{0627}", $vowel ],
2075             "\"\x{0650}" . $_ . "\x{0627}\"" . $vowel, [ $_ . "\x{0627}", $vowel ],
2076              
2077             "\"\x{064E}\x{0627}" . $_ . "\x{0627}\"" . $vowel, [ "\x{0627}" . $_ . "\x{0627}", $vowel ],
2078             "\"\x{064E}\x{0649}" . $_ . "\x{0627}\"" . $vowel, [ "\x{0649}" . $_ . "\x{0627}", $vowel ],
2079             "\"\x{064F}\x{0648}" . $_ . "\x{0627}\"" . $vowel, [ "\x{0648}" . $_ . "\x{0627}", $vowel ],
2080             "\"\x{0650}\x{064A}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064A}" . $_ . "\x{0627}", $vowel ],
2081              
2082             "\x{064E}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064E}" . $_ . "\x{0627}", $vowel ],
2083             "\x{064F}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064F}" . $_ . "\x{0627}", $vowel ],
2084             "\x{0650}" . $_ . "\x{0627}\"" . $vowel, [ "\x{0650}" . $_ . "\x{0627}", $vowel ],
2085              
2086             "\x{064E}\x{0627}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064E}\x{0627}" . $_ . "\x{0627}", $vowel ],
2087             "\x{064E}\x{0649}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064E}\x{0649}" . $_ . "\x{0627}", $vowel ],
2088             "\x{064F}\x{0648}" . $_ . "\x{0627}\"" . $vowel, [ "\x{064F}\x{0648}" . $_ . "\x{0627}", $vowel ],
2089             "\x{0650}\x{064A}" . $_ . "\x{0627}\"" . $vowel, [ "\x{0650}\x{064A}" . $_ . "\x{0627}", $vowel ],
2090              
2091             } "", "\x09", "\x0A", "\x0D", "\x20", "\x0D\x0A", "\x20\x20", "\x20\x20\x20", "\x20\x20\x20\x20"
2092              
2093             } "\x{064E}", "\x{064F}", "\x{0650}"
2094             ),
2095              
2096             # laam + 'alif .. either enforce ligatures, or shuffle the diacritics
2097             (
2098             ( $option{'font-fixing'} ? (
2099              
2100             map {
2101              
2102 0         0 my $alif = $_;
2103              
2104 0         0 map {
2105              
2106 0         0 my $vowel = $_;
2107              
2108 0         0 map {
2109              
2110 0         0 "\x{0644}" . $_ . $vowel . $alif, "\x{0644}" . $alif . $_ . $vowel,
2111             "\x{0644}" . $_ . "\"" . $vowel . $alif, "\x{0644}" . $alif . $_,
2112              
2113             } "", "\x{0651}"
2114              
2115             } "\x{064E}", "\x{064F}", "\x{0650}",
2116             "\x{064B}", "\x{064C}", "\x{064D}",
2117             # "\x{0652}"
2118              
2119             } "\x{0622}", "\x{0623}", "\x{0625}", "\x{0627}", "\x{0671}"
2120              
2121             ) : () ),
2122             ),
2123              
2124             (
2125             ( $option{'font-fixing'} ? (
2126              
2127             map {
2128              
2129 0         0 my $alif = $_;
2130              
2131 0         0 map {
2132              
2133 0         0 "\x{0644}" . $_ . "\x{0652}" . $alif, "\x{0644}" . $alif . $_,
2134             "\x{0644}" . $_ . "\"\x{0652}" . $alif, "\x{0644}" . $alif . $_ . "\x{0652}",
2135              
2136             } "", "\x{0651}"
2137              
2138             } "\x{0622}", "\x{0623}", "\x{0625}", "\x{0627}", "\x{0671}"
2139              
2140             ) : () ),
2141             ),
2142              
2143             # laam + vowel + 'alif + vowel .. internal substitution with wa.sla
2144             (
2145             ( $option{'font-fixing'} ? (
2146              
2147             map {
2148              
2149 1 50       86 my $double = $_;
    50          
    50          
2150              
2151 0         0 map {
2152              
2153 0         0 my $vowel = $_;
2154              
2155 0         0 map {
2156              
2157 0         0 "\x{0644}" . $double . $vowel . "\x{0627}" . $_, [ "\x{0644}\x{0627}" . $double . $vowel, "\"" . $_ ],
2158              
2159             # quoted
2160              
2161             "\x{0644}" . $double . "\"" . $vowel . "\x{0627}" . $_, [ "\x{0644}\x{0627}" . $double, "\"" . $_ ],
2162             "\x{0644}" . $double . "\"" . $vowel . "\x{0627}\"" . $_, [ "\x{0644}\x{0627}" . $double, $_ ],
2163             "\x{0644}" . $double . $vowel . "\x{0627}\"" . $_, [ "\x{0644}\x{0627}" . $double . $vowel, $_ ],
2164              
2165             } "\x{064E}", "\x{064F}", "\x{0650}"
2166              
2167             } "\x{064E}", "\x{064F}", "\x{0650}"
2168              
2169             } "", "\x{0651}"
2170              
2171             ) : () ),
2172             ),
2173              
2174             # optional ligatures to enforce here
2175              
2176             ];
2177              
2178              
2179             # rules for the novocalize mode
2180              
2181 0         0 $demoder->[2] = [
2182              
2183             [
2184             'silent' => 0,
2185             ],
2186              
2187             "\"\x{0652}", "\x{0652}",
2188             "\"\x{064E}", "\x{064E}",
2189             "\"\x{064F}", "\x{064F}",
2190             "\"\x{0650}", "\x{0650}",
2191             "\"\x{064B}", "\x{064B}",
2192             "\"\x{064C}", "\x{064C}",
2193             "\"\x{064D}", "\x{064D}",
2194             "\"\x{0670}", "\x{0670}",
2195             "\"\x{0657}", "\x{0657}",
2196             "\"\x{0656}", "\x{0656}",
2197              
2198             "\x{0652}", "",
2199             "\x{064E}", "",
2200             "\x{064F}", "",
2201             "\x{0650}", "",
2202             "\x{064B}", "",
2203             "\x{064C}", "",
2204             "\x{064D}", "",
2205             "\x{0670}", "",
2206             "\x{0657}", "",
2207             "\x{0656}", "",
2208              
2209             "\"", "",
2210              
2211             # modern internal substitution with "fictitious" wa.sla .. lam + vowel + 'alif + vowel below
2212              
2213             # modern external substitution with "fictitious" wa.sla
2214              
2215             # laam + 'alif .. either enforce ligatures, or shuffle the diacritics
2216             (
2217             ( $option{'font-fixing'} ? (
2218              
2219             map {
2220              
2221 1 50       95 my $alif = $_;
2222              
2223 0         0 map {
2224              
2225 0         0 my $vowel = $_;
2226              
2227 0         0 map {
2228              
2229 0         0 "\x{0644}" . $_ . $vowel . $alif, "\x{0644}" . $alif . $_,
2230             "\x{0644}" . $_ . "\"" . $vowel . $alif, "\x{0644}" . $alif . $_ . $vowel,
2231              
2232             } "", "\x{0651}"
2233              
2234             } "\x{064E}", "\x{064F}", "\x{0650}",
2235             "\x{064B}", "\x{064C}", "\x{064D}",
2236             "\x{0652}"
2237              
2238             } "\x{0622}", "\x{0623}", "\x{0625}", "\x{0627}", "\x{0671}"
2239              
2240             ) : () ),
2241             ),
2242              
2243             # laam + vowel + 'alif + vowel .. internal substitution with wa.sla
2244              
2245             # optional ligatures to enforce here
2246              
2247             ];
2248              
2249              
2250             # rules for the noshadda mode
2251              
2252 1         707 $demoder->[1] = [
2253              
2254             [
2255             'silent' => 0,
2256             ],
2257              
2258             "\x{0651}", "",
2259              
2260 1         4 @{$demoder->[2]}[1 .. @{$demoder->[2]} - 1]
  1         7  
2261              
2262             ];
2263              
2264              
2265             # original no-quotes rules
2266              
2267 3         4 $demoder->[0] = [
2268              
2269             [
2270             'silent' => 0,
2271             ],
2272              
2273             # modern internal substitution with wa.sla .. lam + vowel + 'alif + vowel below
2274             (
2275             map {
2276              
2277 3         6 my $vowel = $_;
2278              
2279 9         49 map {
2280              
2281 3         4 $vowel . "\x{0627}" . $_, $vowel . "\x{0671}",
2282              
2283             } "\x{064E}", "\x{064F}", "\x{0650}"
2284              
2285             } "\x{064E}", "\x{064F}", "\x{0650}"
2286             ),
2287              
2288             # modern external substitution with wa.sla
2289             (
2290             map {
2291              
2292 0         0 my $vowel = $_;
2293              
2294 24         1007 map {
2295              
2296 3         5 "\x{064E}" . $_ . "\x{0627}" . $vowel, [ "\x{064E}" . $_, "\x{0671}" ],
2297             "\x{064F}" . $_ . "\x{0627}" . $vowel, [ "\x{064F}" . $_, "\x{0671}" ],
2298             "\x{0650}" . $_ . "\x{0627}" . $vowel, [ "\x{0650}" . $_, "\x{0671}" ],
2299              
2300             "\x{064E}\x{0627}" . $_ . "\x{0627}" . $vowel, [ "\x{064E}\x{0627}" . $_, "\x{0671}" ],
2301             "\x{064E}\x{0649}" . $_ . "\x{0627}" . $vowel, [ "\x{064E}\x{0649}" . $_, "\x{0671}" ],
2302             "\x{064F}\x{0648}" . $_ . "\x{0627}" . $vowel, [ "\x{064F}\x{0648}" . $_, "\x{0671}" ],
2303             "\x{0650}\x{064A}" . $_ . "\x{0627}" . $vowel, [ "\x{0650}\x{064A}" . $_, "\x{0671}" ],
2304              
2305             } "\x09", "\x0A", "\x0D", "\x20", "\x0D\x0A", "\x20\x20", "\x20\x20\x20", "\x20\x20\x20\x20"
2306              
2307             } "\x{064E}", "\x{064F}", "\x{0650}"
2308             ),
2309              
2310             # laam + 'alif .. either enforce ligatures, or shuffle the diacritics
2311             (
2312             ( $option{'font-fixing'} ? (
2313              
2314             map {
2315              
2316 0         0 my $alif = $_;
2317              
2318 0         0 map {
2319              
2320 0         0 my $vowel = $_;
2321              
2322 0         0 map {
2323              
2324 0         0 "\x{0644}" . $_ . $vowel . $alif,
2325             "\x{0644}" . $alif . $_ . $vowel,
2326              
2327             } "", "\x{0651}"
2328              
2329             } "\x{064E}", "\x{064F}", "\x{0650}",
2330             "\x{064B}", "\x{064C}", "\x{064D}",
2331             "\x{0652}"
2332              
2333             } "\x{0622}", "\x{0623}", "\x{0625}", "\x{0627}", "\x{0671}"
2334              
2335             ) : () ),
2336             ),
2337              
2338             # laam + vowel + 'alif + vowel .. internal substitution with wa.sla
2339             (
2340             ( $option{'font-fixing'} ? (
2341              
2342             map {
2343              
2344 1 50       8 my $double = $_;
    50          
2345              
2346 0         0 map {
2347              
2348 0         0 my $vowel = $_;
2349              
2350 0         0 map {
2351              
2352 0         0 "\x{0644}" . $double . $vowel . "\x{0627}" . $_,
2353             "\x{0644}" . "\x{0671}" . $double . $vowel,
2354              
2355             } "\x{064E}", "\x{064F}", "\x{0650}"
2356              
2357             } "\x{064E}", "\x{064F}", "\x{0650}"
2358              
2359             } "", "\x{0651}"
2360              
2361             ) : () ),
2362             ),
2363              
2364             # optional ligatures to enforce here
2365              
2366             ];
2367              
2368              
2369 4     4   34 no strict 'refs';
  4         5  
  4         1194  
2370              
2371 1         17 ${ $cls . '::decoder' }->[$mode + $delevel] = Encode::Mapper->compile(@{$demoder->[$mode]});
  1         10  
  1         48  
2372              
2373 1 50       6 ${ $cls . '::decoder' }->[$mode + $delevel]->describe('') if $option{'describe'};
  0         0  
2374              
2375 1         1 return ${ $cls . '::decoder' }->[$mode + $delevel];
  1         2192  
2376             }
2377              
2378              
2379             1;
2380              
2381             __END__