lib/Encode/Arabic/ArabTeX/RE.pm

filter: Statementstmt 22.9% 42 / 183 Branchbran 5.0% 2 / 40 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 66.6% 12 / 18 Podpod 33.3% 2 / 6 totaltotal 22.1% 58 / 262 CC 28 SCAR 39.1
CC
28
Cov
19%
encode
118.7
decode
90.0
enmode
13.3
CRAP 50.0
« lib/Encode/Mapper.pm ↑ Summary lib/Encode/Arabic/Buckwalter.pm »
1 # ################################################################### Otakar Smrz, 2003/01/23
2 #
3 # Encoding of Arabic: ArabTeX Notation by Klaus Lagally #####################################
4  
5 package Encode::Arabic::ArabTeX::RE;
6  
7 2 our $VERSION = '14.1';
8  
9 2 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 ▶use Scalar::Util 'blessed';
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 2 ▶use Encode::Encoding;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶use base 'Encode::Encoding';
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 2 __PACKAGE__->Define('ArabTeX-RE');
20  
21  
22 2 our (%encode_used, %decode_used, @shams, @qamar);
23  
24 2 our $enmode;
25 2 our $demode;
26  
27 2 our %modemap = (
28  
29 'default' => 3,
30 'undef' => 0,
31  
32 'fullvocalize' => 4,
33 'full' => 4,
34  
35 'vocalize' => 3,
36 'nosukuun' => 3,
37  
38 'novocalize' => 2,
39 'novowels' => 2,
40 'none' => 2,
41  
42 'noshadda' => 1,
43 'noneplus' => 1,
44 );
45  
46  
47 2 ▶sub import { # perform import as if Encode were used one level before this module
Subroutine import: called CC=2 SCAR=6.9
48 2 require Encode;
49 2 ▶ push @Encode::ISA, 'Exporter' unless Encode->can('export_to_level');
Branch: 1 branch
BranchTrueFalseTotal
unless "Encode"->can("export_to_level") 1 1 2
50 2 Encode->export_to_level(1, @_);
51 }
52  
53  
54 0 ▶sub encode ($$;$) {
Subroutine encode: not called CC=11 SCAR=47.8
Pod documented
55 0 my ($cls, $text, $check) = @_;
56  
57 0 ▶ $_[1] = '' if $check; # this is what in-place edit needs
Branch: 1 branch
BranchTrueFalseTotal
if $check 0 0 0
58  
59 0 ▶ $cls->initialize_encode() unless %encode_used;
Branch: 1 branch
BranchTrueFalseTotal
unless %Encode::Arabic::ArabTeX::RE::encode_used 0 0 0
60  
61 0 ▶ $text = join '', map { exists $encode_used{$_} ? $encode_used{$_} : $_ } split '', $text;
Branch: 1 branch
BranchTrueFalseTotal
exists $Encode::Arabic::ArabTeX::RE::encode_used{$_} ? : 0 0 0
62  
63 0 $text =~ s/([\_\.\^]?\w)\\shadda\{\}/$1$1/g;
64 0 $text =~ s/(\\ham\{.\})\\shadda\{\}/$1$1/g;
65  
66 0 $text =~ s/([\=\s\-\%])\\alif\{\}\\vow\{a\}l/$1"al-/g;
67 0 $text =~ s/([\=\s\-\%])\\alif\{\}l/$1al-/g;
68 0 $text =~ s/(b\\vow\{i\})\\alif\{\}l/$1-al-/g;
69 0 $text =~ s/([\=\s\-\%])\\alif\{\}\\vow\{([ui])\}/$1"$2/g;
70 0 $text =~ s/([\=\s\-\%])\\alif\{\}/$1i/g;
71 0 $text =~ s/(\\vow\{aN\})\\alif\{\}/$1/g;
72 0 $text =~ s/\\alif\{\}(\\vow\{aN\})/$1/g;
73 0 $text =~ s/\\vow\{a\}\\alif\{\}/\\vow{A}/g;
74 0 $text =~ s/\\alif\{\}/\\aux{A}/g;
75  
76 0 $text =~ s/\\madda\{\}/'A/g;
77  
78 0 $text =~ s/\\vow\{a\}\\maq\{\}/\\vow{Y}/g;
79 0 $text =~ s/\\maq\{\}(\\vow\{aN\})/\\vow{aNY}/g;
80 0 $text =~ s/\\vow\{aN\}\\maq\{\}/\\vow{aNY}/g;
81 0 $text =~ s/\\maq\{\}/\\aux{Y}/g;
82  
83 0 $text =~ s/i(}?)y([^aiuAIUY])/I$1$2/g; # produces \ham{I}, too
84 0 $text =~ s/u(}?)w([^aiuAIUY])/U$1$2/g;
85  
86 0 $text =~ s/([iIuU]})(\\ham\{a\})/$1-$2/g;
87 0 $text =~ s/([\-\s])\\ham\{a\}([^\\])/$1'\\aux{a}$2/g;
88 0 $text =~ s/([^\}\s])\\ham\{a\}/$1\\aux{a}'/g;
89  
90 0 $text =~ s/([^\-\s])(\\ham\{i\})/$1-$2/g;
91 0 $text =~ s/\\ham\{i\}([^\\])/'\\aux{i}$1/g;
92  
93 0 $text =~ s/([^\}])(\\ham\{w\})/$1\\aux{u}$2/g;
94 0 $text =~ s/(\\ham\{w\})([^\\])/$1\\aux{u}$2/g;
95  
96 0 $text =~ s/([^\}])(\\ham\{y\})/$1\\aux{i}$2/g;
97 0 $text =~ s/(\\ham\{y\})([^\\])/$1\\aux{i}$2/g;
98  
99 0 $text =~ s/\\ham\{[aiwy]\}/'/g;
100 0 $text =~ s/\\ham\{I\}/'I/g;
101  
102 0 $text =~ s/(?<![^\=\s\-\%])\\aux\{A\}/\\aux{i}/g;
103  
104  
105 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
106  
107 0 ▶ if (defined ${ $cls . '::enmode' } and ${ $cls . '::enmode' } == 3) {
Branch: 3 branches
BranchTrueFalseTotal
if (defined ${$cls . '::enmode';} and ${$cls . '::enmode';} == 3) { } 0 0 0
elsif (defined ${$cls . '::enmode';} and ${$cls . '::enmode';} == 2) { } 0 0 0
elsif (defined ${$cls . '::enmode';} and ${$cls . '::enmode';} == 4) { } 0 0 0
Condition0%0/3
defined ${$cls . '::enmode';} and ${$cls . '::enmode';} == 3
!ll&&!rl&&r
000
MC/DC0%0/2
defined ${$cls . '::enmode';} and ${$cls . '::enmode';} == 3
defined ${$cls . '::enmode';} ${$cls . '::enmode';} == 3
Truth table0%0/3
A and B
A= defined ${$cls . '::enmode';}B= ${$cls . '::enmode';} == 3
ABresult
0X0
100
111
108  
109 0 $text =~ s/\\vow\{(.+?)\}/$1/g;
110 0 $text =~ s/\\aux\{(.+?)\}/"$1/g;
111 0 $text =~ s/\\sukun\{\}/"/g;
112 }
113 0 ▶ elsif (defined ${ $cls . '::enmode' } and ${ $cls . '::enmode' } == 2) {
Condition0%0/3
defined ${$cls . '::enmode';} and ${$cls . '::enmode';} == 2
!ll&&!rl&&r
000
MC/DC0%0/2
defined ${$cls . '::enmode';} and ${$cls . '::enmode';} == 2
defined ${$cls . '::enmode';} ${$cls . '::enmode';} == 2
Truth table0%0/3
A and B
A= defined ${$cls . '::enmode';}B= ${$cls . '::enmode';} == 2
ABresult
0X0
100
111
114  
115 0 $text =~ s/\\vow\{(.+?)\}/"$1/g;
116 0 $text =~ s/\\aux\{(.+?)\}/$1/g;
117 0 $text =~ s/\\sukun\{\}/"/g;
118 }
119 0 ▶ elsif (defined ${ $cls . '::enmode' } and ${ $cls . '::enmode' } == 4) {
Condition0%0/3
defined ${$cls . '::enmode';} and ${$cls . '::enmode';} == 4
!ll&&!rl&&r
000
MC/DC0%0/2
defined ${$cls . '::enmode';} and ${$cls . '::enmode';} == 4
defined ${$cls . '::enmode';} ${$cls . '::enmode';} == 4
Truth table0%0/3
A and B
A= defined ${$cls . '::enmode';}B= ${$cls . '::enmode';} == 4
ABresult
0X0
100
111
120  
121 0 $text =~ s/\\vow\{(.+?)\}/$1/g;
122 0 $text =~ s/\\aux\{(.+?)\}/$1/g;
123 0 $text =~ s/\\sukun\{\}//g;
124 }
125  
126 0 ▶ $text = Encode::encode "utf8", $text if Encode::is_utf8($text);
Branch: 1 branch
BranchTrueFalseTotal
if &Encode::is_utf8($text) 0 0 0
127  
128 0 return $text;
129 }
130  
131  
132 0 ▶sub decode ($$;$) {
Subroutine decode: not called CC=9 SCAR=45.0
Pod documented
133 0 my ($cls, $text, $check) = @_;
134 0 my $one;
135  
136 0 ▶ $_[1] = '' if $check; # this is what in-place edit needs
Branch: 1 branch
BranchTrueFalseTotal
if $check 0 0 0
137  
138 0 ▶ $text = Encode::decode "utf8", $text unless Encode::is_utf8($text);
Branch: 1 branch
BranchTrueFalseTotal
unless &Encode::is_utf8($text) 0 0 0
139  
140 0 ▶ $cls->initialize_decode() unless %decode_used;
Branch: 1 branch
BranchTrueFalseTotal
unless %Encode::Arabic::ArabTeX::RE::decode_used 0 0 0
141  
142 0 $text = "\n" . $text . "\n";
143  
144 0 $text =~ s/_a/a/g; # is there any special character for the defective fatha?
145 0 $text =~ s/_U/U/g; # _U only affects the pronunciation, not the spelling
146  
147 0 foreach $one (@shams, '\\\'', @qamar) {
148  
149 0 $text =~ s/(?<![\_\.\^])($one)(?![aiuAIUY\-T]|$one)/$1\\O{}/g; #
150 0 $text =~ s/(?<![\_\.\^])($one)$one/$1\\D{}/g;
151 # alas! using $one in the replacing expression produces extra \\
152 }
153  
154 0 $text =~ s/([\s\-])([aiu])/$1\\L{}$2/gs;
155  
156 0 $text =~ s/([\s\-])'([auUY])/$1\\H{a}$2/gs;
157 0 $text =~ s/([\s\-])'([iI])/$1\\H{i}$2/gs;
158 0 $text =~ s/([\s\-])'A/$1\\M{}/gs;
159  
160 0 $text =~ s/(I|y\\O\{\})'(aN[AY]?[\s\-])/$1\\H{y}$2/gs;
161 0 $text =~ s/a'(|\\D\{\})(|[au]N?)([\s\-])/a\\H{a}$1$2$3/gs;
162 0 $text =~ s/a'(|\\D\{\})(iN?)([\s\-])/a\\H{i}$1$2$3/gs;
163 0 $text =~ s/i'(|\\D\{\})(|[aiu]N?)([\s\-])/i\\H{y}$1$2$3/gs;
164 0 $text =~ s/u'(|\\D\{\})(|[aiu]N?)([\s\-])/u\\H{w}$1$2$3/gs;
165 0 $text =~ s/'(|\\D\{\})(|[aiu]N?)([\s\-])/\\H{}$1$2$3/gs;
166  
167 0 $text =~ s/([iI]|y\\O\{\})'(|\\D\{\})/$1\\H{y}$2/g;
168 0 $text =~ s/'(|\\D\{\})([iI])/\\H{y}$1$2/g;
169 0 $text =~ s/([uU])'(|\\D\{\})/$1\\H{w}$2/g;
170 0 $text =~ s/'(|\\D\{\})([uU])/\\H{w}$1$2/g;
171 0 $text =~ s/A'(|\\D\{\})/A\\H{}$1/g; # how do you write <rA''AsuN>?
172 0 $text =~ s/a'(\\D\{\})/a\\H{a}$1/g; # how do you write <ra''AsuN>?
173 0 $text =~ s/'A/\\M{}/g;
174 0 $text =~ s/'a/\\H{a}a/g;
175 0 $text =~ s/'Y/\\H{a}Y/g;
176  
177 0 $text =~ s/'/\\H{a}a/g; # final resort
178  
179 0 foreach $one (@shams) { $text =~ s/($one)\-$one/l$1\\D{}/g; }
180 0 foreach $one ('\\\\', @qamar) { $text =~ s/l\-($one)/l\\O{}$1/g; }
181 # alas! using $one in the replacing expression produces extra \\
182  
183 0 $text =~ s/aNY/\\V{aN}\\Q{}/g;
184 0 $text =~ s/(?<=A\\H\{\}|\\H\{a\})aN/\\V{aN}/g;
185 0 $text =~ s/(?<=T)aN/\\V{aN}/g;
186  
187 0 $text =~ s/(?<!{)aNA?/\\V{aN}\\L{}/g;
188 0 $text =~ s/(?<!{)iN/\\V{iN}/g;
189 0 $text =~ s/(?<!{)uN/\\V{uN}/g;
190  
191 0 $text =~ s/UA/\\V{u}w\\L{}/g;
192 0 $text =~ s/aWA?/\\V{a}w\\O{}\\L{}/g;
193  
194 0 $text =~ s/([^{])a/$1\\V{a}/g;
195 0 $text =~ s/([^{])i/$1\\V{i}/g;
196 0 $text =~ s/([^{])u/$1\\V{u}/g;
197  
198 0 $text =~ s/A/\\V{a}\\L{}/g;
199 0 $text =~ s/Iy/\\V{i}y\\D{}/g;
200 0 $text =~ s/I/\\V{i}y/g;
201 0 $text =~ s/Uw/\\V{u}w\\D{}/g;
202 0 $text =~ s/U/\\V{u}w/g;
203 0 $text =~ s/Y/\\V{a}\\Q{}/g;
204  
205 0 $text =~ s/\-//g;
206  
207 0 $text =~ s/l((\\V\{[aiu]\}|\\D\{\}|\\O\{\})+)(\\L\{\}|\\H\{[ai]\}|\\M\{\})/l$3$1/g;
208  
209 0 foreach $one (keys %decode_used) { # risky .. the order matters and negative lookahead \{ is just right
210  
211 0 ▶ while ($text =~ s/(?<![\_\.\^\{])$one/$decode_used{$one}/) { } # /g does not generally work well
Branch: 1 branch
BranchTrueFalseTotal
if ($text =~ s/(?<![\_\.\^\{])$one/$Encode::Arabic::ArabTeX::RE::decode_used{$one}/) 0 0 0
212 }
213  
214 0 $text = substr $text, 1, -1; # remove additional "\n"s
215  
216 0 return $text;
217 }
218  
219  
220 0 ▶sub initialize_encode ($) {
Subroutine initialize_encode: not called CC=2 SCAR=12.2
Pod undocumented
221 0 my $cls = shift @_;
222  
223 0 %encode_used = (
224 # "p", # 81 #"\201",
225 # "^c", # 8D #"\215",
226 # "^z", # 8E #"\216",
227 # "\217", # 8F #"\217",
228 # "g", # 90 #"\220",
229 "\x{060C}", ",", # A1 "\241", '\\,', # 161 "\xA1", # "\xD8\x8C" right-to-left-comma
230 # "\\lq ", # AB #"\253",
231 "\x{061B}", ";", # BA "\272", '\\;', # 186 "\xBA", # "\xD8\x9B" right-to-left-semicolon
232 # "\\rq", # BB #"\273",
233 "\x{061F}", "?", # BF "\277", '\\?', # 191 "\xBF", # "\xD8\x9F" right-to-left-question-mark
234 "\x{0621}", "'", # C1 "\301", '\\\\H{}', # 193 "\xC1", # "\xD8\xA1" hamza-on-the-line
235 "\x{0622}", "\\madda{}", # C2 "\302", '\\\\M{}', # 194 "\xC2", # "\xD8\xA2" madda-over-'alif
236 "\x{0623}", "\\ham{a}", # C3 "\303", '\\\\H{a}', # 195 "\xC3", # "\xD8\xA3" hamza-over-'alif
237 "\x{0624}", "\\ham{w}", # C4 "\304", '\\\\H{w}', # 196 "\xC4", # "\xD8\xA4" hamza-over-waaw
238 "\x{0625}", "\\ham{i}", # C5 "\305", '\\\\H{i}', # 197 "\xC5", # "\xD8\xA5" hamza-under-'alif
239 "\x{0626}", "\\ham{y}", # C6 "\306", '\\\\H{y}', # 198 "\xC6", # "\xD8\xA6" hamza-over-yaa'
240 "\x{0627}", "\\alif{}", # C7 "\307", '\\\\L{}', # 199 "\xC7", # "\xD8\xA7" bare 'alif
241 "\x{0628}", "b", # C8 "\310", 'b', # 200 "\xC8", # "\xD8\xA8" <b>
242 "\x{0629}", "T", # C9 "\311", 'T', # 201 "\xC9", # "\xD8\xA9" <T>
243 "\x{062A}", "t", # CA "\312", 't', # 202 "\xCA", # "\xD8\xAA" <t>
244 "\x{062B}", "_t", # CB "\313", '\\_t', # 203 "\xCB", # "\xD8\xAB" <_t>
245 "\x{062C}", "^g", # CC "\314", '\\^g', # 204 "\xCC", # "\xD8\xAC" <^g>
246 "\x{062D}", ".h", # CD "\315", '\\.h', # 205 "\xCD", # "\xD8\xAD" <.h>
247 "\x{062E}", "_h", # CE "\316", '\\_h', # 206 "\xCE", # "\xD8\xAE" <_h>
248 "\x{062F}", "d", # CF "\317", 'd', # 207 "\xCF", # "\xD8\xAF" <d>
249 "\x{0630}", "_d", # D0 "\320", '\\_d', # 208 "\xD0", # "\xD8\xB0" <_d>
250 "\x{0631}", "r", # D1 "\321", 'r', # 209 "\xD1", # "\xD8\xB1" <r>
251 "\x{0632}", "z", # D2 "\322", 'z', # 210 "\xD2", # "\xD8\xB2" <z>
252 "\x{0633}", "s", # D3 "\323", 's', # 211 "\xD3", # "\xD8\xB3" <s>
253 "\x{0634}", "^s", # D4 "\324", '\\^s', # 212 "\xD4", # "\xD8\xB4" <^s>
254 "\x{0635}", ".s", # D5 "\325", '\\.s', # 213 "\xD5", # "\xD8\xB5" <.s>
255 "\x{0636}", ".d", # D6 "\326", '\\.d', # 214 "\xD6", # "\xD8\xB6" <.d>
256 # "\327", # D7 #"\327",
257 "\x{0637}", ".t", # D8 "\330", '\\.t', # 216 "\xD8", # "\xD8\xB7" <.t>
258 "\x{0638}", ".z", # D9 "\331", '\\.z', # 217 "\xD9", # "\xD8\xB8" <.z>
259 "\x{0639}", "`", # DA "\332", '\\`', # 218 "\xDA", # "\xD8\xB9" <`>
260 "\x{063A}", ".g", # DB "\333", '\\.g', # 219 "\xDB", # "\xD8\xBA" <.g>
261 "\x{0640}", "-", # DC "\334", '--', # 220 "\xDC", # "\xD9\x80" ta.twiil
262 "\x{0641}", "f", # DD "\335", 'f', # 221 "\xDD", # "\xD9\x81" <f>
263 "\x{0642}", "q", # DE "\336", 'q', # 222 "\xDE", # "\xD9\x82" <q>
264 "\x{0643}", "k", # DF "\337", 'k', # 223 "\xDF", # "\xD9\x83" <k>
265 # "\340", # E0 #"\340",
266 "\x{0644}", "l", # E1 "\341", 'l', # 225 "\xE1", # "\xD9\x84" <l>
267 # "\342", # E2 #"\342",
268 "\x{0645}", "m", # E3 "\343", 'm', # 227 "\xE3", # "\xD9\x85" <m>
269 "\x{0646}", "n", # E4 "\344", 'n', # 228 "\xE4", # "\xD9\x86" <n>
270 "\x{0647}", "h", # E5 "\345", 'h', # 229 "\xE5", # "\xD9\x87" <h>
271 "\x{0648}", "w", # E6 "\346", 'w', # 230 "\xE6", # "\xD9\x88" <w>
272 "\x{0649}", "\\maq{}", # EC "\354", '\\\\Q{}', # 236 "\xEC", # "\xD9\x89" 'alif maq.suura
273 "\x{064A}", "y", # ED "\355", 'y', # 237 "\xED", # "\xD9\x8A" <y>
274 "\x{064B}", "\\vow{aN}", # F0 "\360", '\\\\V{aN}', # 240 "\xF0", # "\xD9\x8B" <aN>
275 "\x{064C}", "\\vow{uN}", # F1 "\361", '\\\\V{uN}', # 241 "\xF1", # "\xD9\x8C" <uN>
276 "\x{064D}", "\\vow{iN}", # F2 "\362", '\\\\V{iN}', # 242 "\xF2", # "\xD9\x8D" <iN>
277 "\x{064E}", "\\vow{a}", # F3 "\363", '\\\\V{a}', # 243 "\xF3", # "\xD9\x8E" <a>
278 "\x{064F}", "\\vow{u}", # F5 "\365", '\\\\V{u}', # 245 "\xF5", # "\xD9\x8F" <u>
279 "\x{0650}", "\\vow{i}", # F6 "\366", '\\\\V{i}', # 246 "\xF6", # "\xD9\x90" <i>
280 "\x{0651}", "\\shadda{}", # F8 "\370", '\\\\D{}', # 248 "\xF8", # "\xD9\x91" ^sadda
281 "\x{0652}", "\\sukun{}", # FA "\372", '\\\\O{}', # 250 "\xFA", # "\xD9\x92" sukuun
282 "\x{0670}", # '\\\\A{}', # 243 "\xF3", # "\xD9\xB0" <_a> -> <a>
283 "\x{0671}", # '\\\\W{}', # 199 "\xC7", # "\xD9\xB1" wa.sla-on-'alif -> bare 'alif
284 );
285  
286  
287 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
288  
289 0 ▶ $cls->enmode(defined ${ $cls . '::enmode' } ? ${ $cls . '::enmode' } : 'default');
Branch: 1 branch
BranchTrueFalseTotal
defined ${$cls . '::enmode';} ? : 0 0 0
290 }
291  
292  
293 0 ▶sub initialize_decode ($) {
Subroutine initialize_decode: not called CC=2 SCAR=13.0
Pod undocumented
294 0 my $cls = shift @_;
295  
296 0 @shams = ('t', '\\_t', 'd', '\\_d', 'r', 'z', 's', '\\^s', '\\.s', '\\.d', '\\.t', '\\.z', 'l', 'n');
297 0 @qamar = ('b', '\\^g', '\\.h', '\\_h', '\\`', '\\.g', 'f', 'q', 'k', 'm', 'h', 'w', 'y');
298  
299 0 %decode_used = (
300 # 'p', # 129 "\x81",
301 # '\\^c', # 141 "\x8D",
302 # '\\^z', # 142 "\x8E",
303 # 'g', # 144 "\x90",
304 '\\,', "\x{060C}", # 161 "\xA1", # "\xD8\x8C" right-to-left-comma
305 '\\;', "\x{061B}", # 186 "\xBA", # "\xD8\x9B" right-to-left-semicolon
306 '\\?', "\x{061F}", # 191 "\xBF", # "\xD8\x9F" right-to-left-question-mark
307 '\\\\H{}', "\x{0621}", # 193 "\xC1", # "\xD8\xA1" hamza-on-the-line
308 '\\\\M{}', "\x{0622}", # 194 "\xC2", # "\xD8\xA2" madda-over-'alif
309 '\\\\H{a}', "\x{0623}", # 195 "\xC3", # "\xD8\xA3" hamza-over-'alif
310 '\\\\H{w}', "\x{0624}", # 196 "\xC4", # "\xD8\xA4" hamza-over-waaw
311 '\\\\H{i}', "\x{0625}", # 197 "\xC5", # "\xD8\xA5" hamza-under-'alif
312 '\\\\H{y}', "\x{0626}", # 198 "\xC6", # "\xD8\xA6" hamza-over-yaa'
313 '\\\\L{}', "\x{0627}", # 199 "\xC7", # "\xD8\xA7" bare 'alif
314 'b', "\x{0628}", # 200 "\xC8", # "\xD8\xA8" <b>
315 'T', "\x{0629}", # 201 "\xC9", # "\xD8\xA9" <T>
316 't', "\x{062A}", # 202 "\xCA", # "\xD8\xAA" <t>
317 '\\_t', "\x{062B}", # 203 "\xCB", # "\xD8\xAB" <_t>
318 '\\^g', "\x{062C}", # 204 "\xCC", # "\xD8\xAC" <^g>
319 '\\.h', "\x{062D}", # 205 "\xCD", # "\xD8\xAD" <.h>
320 '\\_h', "\x{062E}", # 206 "\xCE", # "\xD8\xAE" <_h>
321 'd', "\x{062F}", # 207 "\xCF", # "\xD8\xAF" <d>
322 '\\_d', "\x{0630}", # 208 "\xD0", # "\xD8\xB0" <_d>
323 'r', "\x{0631}", # 209 "\xD1", # "\xD8\xB1" <r>
324 'z', "\x{0632}", # 210 "\xD2", # "\xD8\xB2" <z>
325 's', "\x{0633}", # 211 "\xD3", # "\xD8\xB3" <s>
326 '\\^s', "\x{0634}", # 212 "\xD4", # "\xD8\xB4" <^s>
327 '\\.s', "\x{0635}", # 213 "\xD5", # "\xD8\xB5" <.s>
328 '\\.d', "\x{0636}", # 214 "\xD6", # "\xD8\xB6" <.d>
329 '\\.t', "\x{0637}", # 216 "\xD8", # "\xD8\xB7" <.t>
330 '\\.z', "\x{0638}", # 217 "\xD9", # "\xD8\xB8" <.z>
331 '\\`', "\x{0639}", # 218 "\xDA", # "\xD8\xB9" <`>
332 '\\.g', "\x{063A}", # 219 "\xDB", # "\xD8\xBA" <.g>
333 '--', "\x{0640}", # 220 "\xDC", # "\xD9\x80" ta.twiil
334 'f', "\x{0641}", # 221 "\xDD", # "\xD9\x81" <f>
335 'q', "\x{0642}", # 222 "\xDE", # "\xD9\x82" <q>
336 'k', "\x{0643}", # 223 "\xDF", # "\xD9\x83" <k>
337 'l', "\x{0644}", # 225 "\xE1", # "\xD9\x84" <l>
338 'm', "\x{0645}", # 227 "\xE3", # "\xD9\x85" <m>
339 'n', "\x{0646}", # 228 "\xE4", # "\xD9\x86" <n>
340 'h', "\x{0647}", # 229 "\xE5", # "\xD9\x87" <h>
341 'w', "\x{0648}", # 230 "\xE6", # "\xD9\x88" <w>
342 '\\\\Q{}', "\x{0649}", # 236 "\xEC", # "\xD9\x89" 'alif maq.suura
343 'y', "\x{064A}", # 237 "\xED", # "\xD9\x8A" <y>
344 '\\\\V{aN}', "\x{064B}", # 240 "\xF0", # "\xD9\x8B" <aN>
345 '\\\\V{uN}', "\x{064C}", # 241 "\xF1", # "\xD9\x8C" <uN>
346 '\\\\V{iN}', "\x{064D}", # 242 "\xF2", # "\xD9\x8D" <iN>
347 '\\\\V{a}', "\x{064E}", # 243 "\xF3", # "\xD9\x8E" <a>
348 '\\\\V{u}', "\x{064F}", # 245 "\xF5", # "\xD9\x8F" <u>
349 '\\\\V{i}', "\x{0650}", # 246 "\xF6", # "\xD9\x90" <i>
350 '\\\\D{}', "\x{0651}", # 248 "\xF8", # "\xD9\x91" ^sadda
351 '\\\\O{}', "\x{0652}", # 250 "\xFA", # "\xD9\x92" sukuun
352 '\\\\A{}', "\x{0670}", # 243 "\xF3", # "\xD9\xB0" <_a> -> <a>
353 '\\\\W{}', "\x{0671}", # 199 "\xC7", # "\xD9\xB1" wa.sla-on-'alif -> bare 'alif
354 );
355  
356  
357 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
358  
359 0 ▶ $cls->demode(defined ${ $cls . '::demode' } ? ${ $cls . '::demode' } : 'default');
Branch: 1 branch
BranchTrueFalseTotal
defined ${$cls . '::demode';} ? : 0 0 0
360 }
361  
362  
363 0 ▶sub enmode ($$) {
Subroutine enmode: not called CC=4 SCAR=25.8
Pod undocumented
364 0 my ($cls, $mode) = @_;
365  
366 0 ▶ $cls = blessed $cls if ref $cls;
Branch: 1 branch
BranchTrueFalseTotal
if ref $cls 0 0 0
367  
368 0 ▶ $mode = 'undef' unless defined $mode;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mode 0 0 0
369 0 ▶ $mode = $modemap{$mode} if exists $modemap{$mode};
Branch: 1 branch
BranchTrueFalseTotal
if exists $Encode::Arabic::ArabTeX::RE::modemap{$mode} 0 0 0
370  
371 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
372  
373 0 my $return = ${ $cls . '::enmode' };
374  
375 0 ${ $cls . '::enmode' } = $mode;
376  
377 0 return $return;
378 }
379  
380  
381 0 ▶sub demode ($$) {
Subroutine demode: not called CC=4 SCAR=25.8
Pod undocumented
382 0 my ($cls, $mode) = @_;
383  
384 0 ▶ $cls = blessed $cls if ref $cls;
Branch: 1 branch
BranchTrueFalseTotal
if ref $cls 0 0 0
385  
386 0 ▶ $mode = 'undef' unless defined $mode;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $mode 0 0 0
387 0 ▶ $mode = $modemap{$mode} if exists $modemap{$mode};
Branch: 1 branch
BranchTrueFalseTotal
if exists $Encode::Arabic::ArabTeX::RE::modemap{$mode} 0 0 0
388  
389 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
390  
391 0 my $return = ${ $cls . '::demode' };
392  
393 0 ${ $cls . '::demode' } = $mode;
394  
395 0 return $return;
396 }
397  
398  
399 2 1;
400  
401 __END__
« lib/Encode/Mapper.pm ↑ Summary lib/Encode/Arabic/Buckwalter.pm »