File Coverage

blib/lib/Mail/IMAPClient/Thread.pm
Criterion Covered Total %
statement 347 391 88.7
branch 100 212 47.1
condition 34 75 45.3
subroutine 19 20 95.0
pod 0 1 0.0
total 500 699 71.5


line stmt bran cond sub pod time code
1             package Mail::IMAPClient::Thread;
2 1     1   55209 use Parse::RecDescent;
  1         33891  
  1         7  
3             { my $ERRORS;
4              
5              
6             package Parse::RecDescent::Mail::IMAPClient::Thread;
7 1     1   51 use strict;
  1         2  
  1         20  
8 1     1   4 use vars qw($skip $AUTOLOAD );
  1         1  
  1         69  
9             @Parse::RecDescent::Mail::IMAPClient::Thread::ISA = ();
10             $skip = '\s*';
11              
12              
13             {
14             local $SIG{__WARN__} = sub {0};
15             # PRETEND TO BE IN Parse::RecDescent NAMESPACE
16             *Parse::RecDescent::Mail::IMAPClient::Thread::AUTOLOAD = sub
17             {
18 1     1   5 no strict 'refs';
  1         2  
  1         81  
19              
20 0     0   0 ${"AUTOLOAD"} =~ s/^Parse::RecDescent::Mail::IMAPClient::Thread/Parse::RecDescent/;
  0         0  
21 0         0 goto &{${"AUTOLOAD"}};
  0         0  
  0         0  
22             }
23             }
24              
25             push @Parse::RecDescent::Mail::IMAPClient::Thread::ISA, 'Parse::RecDescent';
26             # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args, $_itempos)
27             sub Parse::RecDescent::Mail::IMAPClient::Thread::thread
28             {
29 134     134   795 my $thisparser = $_[0];
30 1     1   5 use vars q{$tracelevel};
  1         2  
  1         856  
31 134   50     259 local $tracelevel = ($tracelevel||0)+1;
32 134         155 $ERRORS = 0;
33 134         175 my $thisrule = $thisparser->{"rules"}{"thread"};
34              
35 134 50       181 Parse::RecDescent::_trace(q{Trying rule: [thread]},
36             Parse::RecDescent::_tracefirst($_[1]),
37             q{thread},
38             $tracelevel)
39             if defined $::RD_TRACE;
40              
41            
42 134         143 my $err_at = @{$thisparser->{errors}};
  134         179  
43              
44 134         236 my $score;
45             my $score_return;
46 134         0 my $_tok;
47 134         151 my $return = undef;
48 134         154 my $_matched=0;
49 134         137 my $commit=0;
50 134         168 my @item = ();
51 134         159 my %item = ();
52 134         135 my $repeating = $_[2];
53 134         134 my $_noactions = $_[3];
54 134 50       211 my @arg = defined $_[4] ? @{ &{$_[4]} } : ();
  134         135  
  134         163  
55 134         168 my $_itempos = $_[5];
56 134 50       219 my %arg = ($#arg & 01) ? @arg : (@arg, undef);
57 134         231 my $text;
58             my $lastsep;
59 134         0 my $current_match;
60 134         249 my $expectation = new Parse::RecDescent::Expectation(q{'('});
61 134         643 $expectation->at($_[1]);
62            
63 134         424 my $thisline;
64 134         311 tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser;
65              
66            
67              
68 134   33     728 while (!$_matched && !$commit)
69             {
70            
71 134 50       227 Parse::RecDescent::_trace(q{Trying production: ['(' threadmember ')']},
72             Parse::RecDescent::_tracefirst($_[1]),
73             q{thread},
74             $tracelevel)
75             if defined $::RD_TRACE;
76 134         174 my $thisprod = $thisrule->{"prods"}[0];
77 134         166 $text = $_[1];
78 134         133 my $_savetext;
79 134         239 @item = (q{thread});
80 134         185 %item = (__RULE__ => q{thread});
81 134         163 my $repcount = 0;
82              
83              
84 134 50       206 Parse::RecDescent::_trace(q{Trying terminal: ['(']},
85             Parse::RecDescent::_tracefirst($text),
86             q{thread},
87             $tracelevel)
88             if defined $::RD_TRACE;
89 134         177 undef $lastsep;
90 134         236 $expectation->is(q{})->at($text);
91            
92              
93 134 100 33     1131 unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = "("; 1 } and
  134 100 66     518  
  134   66     182  
  134         500  
94             substr($text,0,length($_tok)) eq $_tok and
95 66         105 do { substr($text,0,length($_tok)) = ""; 1; }
  66         137  
96             )
97             {
98 68 50       142 $text = $lastsep . $text if defined $lastsep;
99            
100 68         167 $expectation->failed();
101 68 50       203 Parse::RecDescent::_trace(q{<>},
102             Parse::RecDescent::_tracefirst($text))
103             if defined $::RD_TRACE;
104 68         119 last;
105             }
106 66 50       119 Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [}
107             . $_tok . q{])},
108             Parse::RecDescent::_tracefirst($text))
109             if defined $::RD_TRACE;
110 66         136 push @item, $item{__STRING1__}=$_tok;
111            
112              
113 66 50       96 Parse::RecDescent::_trace(q{Trying repeated subrule: [threadmember]},
114             Parse::RecDescent::_tracefirst($text),
115             q{thread},
116             $tracelevel)
117             if defined $::RD_TRACE;
118 66         126 $expectation->is(q{threadmember})->at($text);
119            
120 66 50   170   529 unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::Thread::threadmember, 1, 100000000, $_noactions,$expectation,sub { \@arg },undef)))
  170         242  
121             {
122 0 0       0 Parse::RecDescent::_trace(q{<>},
123             Parse::RecDescent::_tracefirst($text),
124             q{thread},
125             $tracelevel)
126             if defined $::RD_TRACE;
127 0         0 last;
128             }
129 66 50       683 Parse::RecDescent::_trace(q{>>Matched repeated subrule: [threadmember]<< (}
130             . @$_tok . q{ times)},
131              
132             Parse::RecDescent::_tracefirst($text),
133             q{thread},
134             $tracelevel)
135             if defined $::RD_TRACE;
136 66         104 $item{q{threadmember(s)}} = $_tok;
137 66         85 push @item, $_tok;
138            
139              
140              
141 66 50       88 Parse::RecDescent::_trace(q{Trying terminal: [')']},
142             Parse::RecDescent::_tracefirst($text),
143             q{thread},
144             $tracelevel)
145             if defined $::RD_TRACE;
146 66         80 undef $lastsep;
147 66         120 $expectation->is(q{')'})->at($text);
148            
149              
150 66 50 33     490 unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and do { $_tok = ")"; 1 } and
  66 50 33     267  
  66   33     83  
  66         216  
151             substr($text,0,length($_tok)) eq $_tok and
152 66         104 do { substr($text,0,length($_tok)) = ""; 1; }
  66         130  
153             )
154             {
155 0 0       0 $text = $lastsep . $text if defined $lastsep;
156            
157 0         0 $expectation->failed();
158 0 0       0 Parse::RecDescent::_trace(q{<>},
159             Parse::RecDescent::_tracefirst($text))
160             if defined $::RD_TRACE;
161 0         0 last;
162             }
163 66 50       117 Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [}
164             . $_tok . q{])},
165             Parse::RecDescent::_tracefirst($text))
166             if defined $::RD_TRACE;
167 66         101 push @item, $item{__STRING2__}=$_tok;
168            
169              
170 66 50       105 Parse::RecDescent::_trace(q{Trying action},
171             Parse::RecDescent::_tracefirst($text),
172             q{thread},
173             $tracelevel)
174             if defined $::RD_TRACE;
175            
176              
177 66 50       89 $_tok = ($_noactions) ? 0 : do {
178 66   50     119 $return = $item{'threadmember(s)'}||undef;
179             };
180 66 50       104 unless (defined $_tok)
181             {
182 0 0       0 Parse::RecDescent::_trace(q{<> (return value: [undef])})
183             if defined $::RD_TRACE;
184 0         0 last;
185             }
186 66 50       94 Parse::RecDescent::_trace(q{>>Matched action<< (return value: [}
187             . $_tok . q{])},
188             Parse::RecDescent::_tracefirst($text))
189             if defined $::RD_TRACE;
190 66         79 push @item, $_tok;
191 66         89 $item{__ACTION1__}=$_tok;
192            
193              
194 66 50       83 Parse::RecDescent::_trace(q{>>Matched production: ['(' threadmember ')']<<},
195             Parse::RecDescent::_tracefirst($text),
196             q{thread},
197             $tracelevel)
198             if defined $::RD_TRACE;
199              
200              
201              
202 66         82 $_matched = 1;
203 66         102 last;
204             }
205              
206              
207 134 100 66     287 unless ( $_matched || defined($score) )
208             {
209            
210              
211 68         91 $_[1] = $text; # NOT SURE THIS IS NEEDED
212 68 50       95 Parse::RecDescent::_trace(q{<>},
213             Parse::RecDescent::_tracefirst($_[1]),
214             q{thread},
215             $tracelevel)
216             if defined $::RD_TRACE;
217 68         246 return undef;
218             }
219 66 50 33     103 if (!defined($return) && defined($score))
220             {
221 0 0       0 Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "",
222             q{thread},
223             $tracelevel)
224             if defined $::RD_TRACE;
225 0         0 $return = $score_return;
226             }
227 66         74 splice @{$thisparser->{errors}}, $err_at;
  66         103  
228 66 50       107 $return = $item[$#item] unless defined $return;
229 66 50       90 if (defined $::RD_TRACE)
230             {
231 0         0 Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} .
232             $return . q{])}, "",
233             q{thread},
234             $tracelevel);
235 0         0 Parse::RecDescent::_trace(q{(consumed: [} .
236             Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])},
237             Parse::RecDescent::_tracefirst($text),
238             , q{thread},
239             $tracelevel)
240             }
241 66         97 $_[1] = $text;
242 66         251 return $return;
243             }
244              
245             # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args, $_itempos)
246             sub Parse::RecDescent::Mail::IMAPClient::Thread::threadmember
247             {
248 170     170   2219 my $thisparser = $_[0];
249 1     1   6 use vars q{$tracelevel};
  1         2  
  1         256  
250 170   50     301 local $tracelevel = ($tracelevel||0)+1;
251 170         182 $ERRORS = 0;
252 170         211 my $thisrule = $thisparser->{"rules"}{"threadmember"};
253              
254 170 50       230 Parse::RecDescent::_trace(q{Trying rule: [threadmember]},
255             Parse::RecDescent::_tracefirst($_[1]),
256             q{threadmember},
257             $tracelevel)
258             if defined $::RD_TRACE;
259              
260            
261 170         184 my $err_at = @{$thisparser->{errors}};
  170         218  
262              
263 170         289 my $score;
264             my $score_return;
265 170         0 my $_tok;
266 170         200 my $return = undef;
267 170         175 my $_matched=0;
268 170         171 my $commit=0;
269 170         237 my @item = ();
270 170         182 my %item = ();
271 170         173 my $repeating = $_[2];
272 170         172 my $_noactions = $_[3];
273 170 50       267 my @arg = defined $_[4] ? @{ &{$_[4]} } : ();
  170         207  
  170         211  
274 170         241 my $_itempos = $_[5];
275 170 50       277 my %arg = ($#arg & 01) ? @arg : (@arg, undef);
276 170         292 my $text;
277             my $lastsep;
278 170         0 my $current_match;
279 170         337 my $expectation = new Parse::RecDescent::Expectation(q{NUMBER, or thread});
280 170         855 $expectation->at($_[1]);
281            
282 170         523 my $thisline;
283 170         395 tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser;
284              
285            
286              
287 170   33     962 while (!$_matched && !$commit)
288             {
289            
290 170 50       277 Parse::RecDescent::_trace(q{Trying production: [NUMBER]},
291             Parse::RecDescent::_tracefirst($_[1]),
292             q{threadmember},
293             $tracelevel)
294             if defined $::RD_TRACE;
295 170         237 my $thisprod = $thisrule->{"prods"}[0];
296 170         210 $text = $_[1];
297 170         179 my $_savetext;
298 170         246 @item = (q{threadmember});
299 170         239 %item = (__RULE__ => q{threadmember});
300 170         187 my $repcount = 0;
301              
302              
303 170 50       238 Parse::RecDescent::_trace(q{Trying subrule: [NUMBER]},
304             Parse::RecDescent::_tracefirst($text),
305             q{threadmember},
306             $tracelevel)
307             if defined $::RD_TRACE;
308 1     1   6 if (1) { no strict qw{refs};
  1         1  
  1         280  
  170         180  
309 170         274 $expectation->is(q{})->at($text);
310 170 100   170   1140 unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::Thread::NUMBER($thisparser,$text,$repeating,$_noactions,sub { \@arg },undef)))
  170         242  
311             {
312            
313 84 50       128 Parse::RecDescent::_trace(q{<>},
314             Parse::RecDescent::_tracefirst($text),
315             q{threadmember},
316             $tracelevel)
317             if defined $::RD_TRACE;
318 84         159 $expectation->failed();
319 84         224 last;
320             }
321 86 50       202 Parse::RecDescent::_trace(q{>>Matched subrule: [NUMBER]<< (return value: [}
322             . $_tok . q{]},
323              
324             Parse::RecDescent::_tracefirst($text),
325             q{threadmember},
326             $tracelevel)
327             if defined $::RD_TRACE;
328 86         124 $item{q{NUMBER}} = $_tok;
329 86         128 push @item, $_tok;
330            
331             }
332              
333 86 50       116 Parse::RecDescent::_trace(q{Trying action},
334             Parse::RecDescent::_tracefirst($text),
335             q{threadmember},
336             $tracelevel)
337             if defined $::RD_TRACE;
338            
339              
340 86 50       110 $_tok = ($_noactions) ? 0 : do { $return = $item{NUMBER} ; };
  86         131  
341 86 50       142 unless (defined $_tok)
342             {
343 0 0       0 Parse::RecDescent::_trace(q{<> (return value: [undef])})
344             if defined $::RD_TRACE;
345 0         0 last;
346             }
347 86 50       133 Parse::RecDescent::_trace(q{>>Matched action<< (return value: [}
348             . $_tok . q{])},
349             Parse::RecDescent::_tracefirst($text))
350             if defined $::RD_TRACE;
351 86         113 push @item, $_tok;
352 86         117 $item{__ACTION1__}=$_tok;
353            
354              
355 86 50       132 Parse::RecDescent::_trace(q{>>Matched production: [NUMBER]<<},
356             Parse::RecDescent::_tracefirst($text),
357             q{threadmember},
358             $tracelevel)
359             if defined $::RD_TRACE;
360              
361              
362              
363 86         104 $_matched = 1;
364 86         107 last;
365             }
366              
367              
368 170   66     413 while (!$_matched && !$commit)
369             {
370            
371 84 50       119 Parse::RecDescent::_trace(q{Trying production: [thread]},
372             Parse::RecDescent::_tracefirst($_[1]),
373             q{threadmember},
374             $tracelevel)
375             if defined $::RD_TRACE;
376 84         108 my $thisprod = $thisrule->{"prods"}[1];
377 84         113 $text = $_[1];
378 84         97 my $_savetext;
379 84         138 @item = (q{threadmember});
380 84         169 %item = (__RULE__ => q{threadmember});
381 84         93 my $repcount = 0;
382              
383              
384 84 50       126 Parse::RecDescent::_trace(q{Trying subrule: [thread]},
385             Parse::RecDescent::_tracefirst($text),
386             q{threadmember},
387             $tracelevel)
388             if defined $::RD_TRACE;
389 1     1   6 if (1) { no strict qw{refs};
  1         1  
  1         431  
  84         89  
390 84         137 $expectation->is(q{})->at($text);
391 84 100   84   633 unless (defined ($_tok = Parse::RecDescent::Mail::IMAPClient::Thread::thread($thisparser,$text,$repeating,$_noactions,sub { \@arg },undef)))
  84         122  
392             {
393            
394 66 50       117 Parse::RecDescent::_trace(q{<>},
395             Parse::RecDescent::_tracefirst($text),
396             q{threadmember},
397             $tracelevel)
398             if defined $::RD_TRACE;
399 66         145 $expectation->failed();
400 66         181 last;
401             }
402 18 50       41 Parse::RecDescent::_trace(q{>>Matched subrule: [thread]<< (return value: [}
403             . $_tok . q{]},
404              
405             Parse::RecDescent::_tracefirst($text),
406             q{threadmember},
407             $tracelevel)
408             if defined $::RD_TRACE;
409 18         28 $item{q{thread}} = $_tok;
410 18         23 push @item, $_tok;
411            
412             }
413              
414 18 50       27 Parse::RecDescent::_trace(q{Trying action},
415             Parse::RecDescent::_tracefirst($text),
416             q{threadmember},
417             $tracelevel)
418             if defined $::RD_TRACE;
419            
420              
421 18 50       24 $_tok = ($_noactions) ? 0 : do { $return = $item{thread} ; };
  18         25  
422 18 50       28 unless (defined $_tok)
423             {
424 0 0       0 Parse::RecDescent::_trace(q{<> (return value: [undef])})
425             if defined $::RD_TRACE;
426 0         0 last;
427             }
428 18 50       27 Parse::RecDescent::_trace(q{>>Matched action<< (return value: [}
429             . $_tok . q{])},
430             Parse::RecDescent::_tracefirst($text))
431             if defined $::RD_TRACE;
432 18         21 push @item, $_tok;
433 18         24 $item{__ACTION1__}=$_tok;
434            
435              
436 18 50       28 Parse::RecDescent::_trace(q{>>Matched production: [thread]<<},
437             Parse::RecDescent::_tracefirst($text),
438             q{threadmember},
439             $tracelevel)
440             if defined $::RD_TRACE;
441              
442              
443              
444 18         19 $_matched = 1;
445 18         22 last;
446             }
447              
448              
449 170 100 66     406 unless ( $_matched || defined($score) )
450             {
451            
452              
453 66         94 $_[1] = $text; # NOT SURE THIS IS NEEDED
454 66 50       97 Parse::RecDescent::_trace(q{<>},
455             Parse::RecDescent::_tracefirst($_[1]),
456             q{threadmember},
457             $tracelevel)
458             if defined $::RD_TRACE;
459 66         212 return undef;
460             }
461 104 50 33     194 if (!defined($return) && defined($score))
462             {
463 0 0       0 Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "",
464             q{threadmember},
465             $tracelevel)
466             if defined $::RD_TRACE;
467 0         0 $return = $score_return;
468             }
469 104         107 splice @{$thisparser->{errors}}, $err_at;
  104         145  
470 104 50       158 $return = $item[$#item] unless defined $return;
471 104 50       151 if (defined $::RD_TRACE)
472             {
473 0         0 Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} .
474             $return . q{])}, "",
475             q{threadmember},
476             $tracelevel);
477 0         0 Parse::RecDescent::_trace(q{(consumed: [} .
478             Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])},
479             Parse::RecDescent::_tracefirst($text),
480             , q{threadmember},
481             $tracelevel)
482             }
483 104         166 $_[1] = $text;
484 104         383 return $return;
485             }
486              
487             # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args, $_itempos)
488             sub Parse::RecDescent::Mail::IMAPClient::Thread::NUMBER
489             {
490 170     170   250 my $thisparser = $_[0];
491 1     1   6 use vars q{$tracelevel};
  1         2  
  1         583  
492 170   50     287 local $tracelevel = ($tracelevel||0)+1;
493 170         178 $ERRORS = 0;
494 170         227 my $thisrule = $thisparser->{"rules"}{"NUMBER"};
495              
496 170 50       256 Parse::RecDescent::_trace(q{Trying rule: [NUMBER]},
497             Parse::RecDescent::_tracefirst($_[1]),
498             q{NUMBER},
499             $tracelevel)
500             if defined $::RD_TRACE;
501              
502            
503 170         180 my $err_at = @{$thisparser->{errors}};
  170         223  
504              
505 170         292 my $score;
506             my $score_return;
507 170         0 my $_tok;
508 170         218 my $return = undef;
509 170         173 my $_matched=0;
510 170         174 my $commit=0;
511 170         211 my @item = ();
512 170         189 my %item = ();
513 170         190 my $repeating = $_[2];
514 170         173 my $_noactions = $_[3];
515 170 50       252 my @arg = defined $_[4] ? @{ &{$_[4]} } : ();
  170         177  
  170         216  
516 170         225 my $_itempos = $_[5];
517 170 50       272 my %arg = ($#arg & 01) ? @arg : (@arg, undef);
518 170         289 my $text;
519             my $lastsep;
520 170         0 my $current_match;
521 170         293 my $expectation = new Parse::RecDescent::Expectation(q{/\\d+/});
522 170         755 $expectation->at($_[1]);
523            
524 170         549 my $thisline;
525 170         325 tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser;
526              
527            
528              
529 170   33     946 while (!$_matched && !$commit)
530             {
531            
532 170 50       239 Parse::RecDescent::_trace(q{Trying production: [/\\d+/]},
533             Parse::RecDescent::_tracefirst($_[1]),
534             q{NUMBER},
535             $tracelevel)
536             if defined $::RD_TRACE;
537 170         226 my $thisprod = $thisrule->{"prods"}[0];
538 170         224 $text = $_[1];
539 170         175 my $_savetext;
540 170         238 @item = (q{NUMBER});
541 170         235 %item = (__RULE__ => q{NUMBER});
542 170         198 my $repcount = 0;
543              
544              
545 170 50       231 Parse::RecDescent::_trace(q{Trying terminal: [/\\d+/]}, Parse::RecDescent::_tracefirst($text),
546             q{NUMBER},
547             $tracelevel)
548             if defined $::RD_TRACE;
549 170         220 undef $lastsep;
550 170         297 $expectation->is(q{})->at($text);
551            
552              
553 170 100 66     1445 unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:\d+)/)
  170 100       1050  
554             {
555 84 50       201 $text = $lastsep . $text if defined $lastsep;
556 84         200 $expectation->failed();
557 84 50       254 Parse::RecDescent::_trace(q{<>},
558             Parse::RecDescent::_tracefirst($text))
559             if defined $::RD_TRACE;
560              
561 84         127 last;
562             }
563 86         316 $current_match = substr($text, $-[0], $+[0] - $-[0]);
564 86         212 substr($text,0,length($current_match),q{});
565 86 50       134 Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [}
566             . $current_match . q{])},
567             Parse::RecDescent::_tracefirst($text))
568             if defined $::RD_TRACE;
569 86         163 push @item, $item{__PATTERN1__}=$current_match;
570            
571              
572 86 50       131 Parse::RecDescent::_trace(q{>>Matched production: [/\\d+/]<<},
573             Parse::RecDescent::_tracefirst($text),
574             q{NUMBER},
575             $tracelevel)
576             if defined $::RD_TRACE;
577              
578              
579              
580 86         99 $_matched = 1;
581 86         128 last;
582             }
583              
584              
585 170 100 66     389 unless ( $_matched || defined($score) )
586             {
587            
588              
589 84         121 $_[1] = $text; # NOT SURE THIS IS NEEDED
590 84 50       115 Parse::RecDescent::_trace(q{<>},
591             Parse::RecDescent::_tracefirst($_[1]),
592             q{NUMBER},
593             $tracelevel)
594             if defined $::RD_TRACE;
595 84         313 return undef;
596             }
597 86 50 33     209 if (!defined($return) && defined($score))
598             {
599 0 0       0 Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "",
600             q{NUMBER},
601             $tracelevel)
602             if defined $::RD_TRACE;
603 0         0 $return = $score_return;
604             }
605 86         96 splice @{$thisparser->{errors}}, $err_at;
  86         134  
606 86 50       157 $return = $item[$#item] unless defined $return;
607 86 50       137 if (defined $::RD_TRACE)
608             {
609 0         0 Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} .
610             $return . q{])}, "",
611             q{NUMBER},
612             $tracelevel);
613 0         0 Parse::RecDescent::_trace(q{(consumed: [} .
614             Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])},
615             Parse::RecDescent::_tracefirst($text),
616             , q{NUMBER},
617             $tracelevel)
618             }
619 86         119 $_[1] = $text;
620 86         359 return $return;
621             }
622              
623             # ARGS ARE: ($parser, $text; $repeating, $_noactions, \@args, $_itempos)
624             sub Parse::RecDescent::Mail::IMAPClient::Thread::start
625             {
626 2     2   1520 my $thisparser = $_[0];
627 1     1   6 use vars q{$tracelevel};
  1         2  
  1         1200  
628 2   50     8 local $tracelevel = ($tracelevel||0)+1;
629 2         4 $ERRORS = 0;
630 2         4 my $thisrule = $thisparser->{"rules"}{"start"};
631              
632 2 50       6 Parse::RecDescent::_trace(q{Trying rule: [start]},
633             Parse::RecDescent::_tracefirst($_[1]),
634             q{start},
635             $tracelevel)
636             if defined $::RD_TRACE;
637              
638            
639 2         2 my $err_at = @{$thisparser->{errors}};
  2         6  
640              
641 2         5 my $score;
642             my $score_return;
643 2         0 my $_tok;
644 2         3 my $return = undef;
645 2         3 my $_matched=0;
646 2         2 my $commit=0;
647 2         4 my @item = ();
648 2         3 my %item = ();
649 2         3 my $repeating = $_[2];
650 2         3 my $_noactions = $_[3];
651 2 50       4 my @arg = defined $_[4] ? @{ &{$_[4]} } : ();
  2         4  
  2         5  
652 2         8 my $_itempos = $_[5];
653 2 50       5 my %arg = ($#arg & 01) ? @arg : (@arg, undef);
654 2         6 my $text;
655             my $lastsep;
656 2         0 my $current_match;
657 2         9 my $expectation = new Parse::RecDescent::Expectation(q{/^\\* THREAD /i});
658 2         15 $expectation->at($_[1]);
659            
660 2         12 my $thisline;
661 2         9 tie $thisline, q{Parse::RecDescent::LineCounter}, \$text, $thisparser;
662              
663            
664              
665 2   33     18 while (!$_matched && !$commit)
666             {
667            
668 2 50       5 Parse::RecDescent::_trace(q{Trying production: [/^\\* THREAD /i thread]},
669             Parse::RecDescent::_tracefirst($_[1]),
670             q{start},
671             $tracelevel)
672             if defined $::RD_TRACE;
673 2         6 my $thisprod = $thisrule->{"prods"}[0];
674 2         4 $text = $_[1];
675 2         11 my $_savetext;
676 2         5 @item = (q{start});
677 2         5 %item = (__RULE__ => q{start});
678 2         3 my $repcount = 0;
679              
680              
681 2 50       5 Parse::RecDescent::_trace(q{Trying terminal: [/^\\* THREAD /i]}, Parse::RecDescent::_tracefirst($text),
682             q{start},
683             $tracelevel)
684             if defined $::RD_TRACE;
685 2         4 undef $lastsep;
686 2         6 $expectation->is(q{})->at($text);
687            
688              
689 2 50 33     31 unless ($text =~ s/\A($skip)/$lastsep=$1 and ""/e and $text =~ m/\A(?:^\* THREAD )/i)
  2 50       20  
690             {
691 0 0       0 $text = $lastsep . $text if defined $lastsep;
692 0         0 $expectation->failed();
693 0 0       0 Parse::RecDescent::_trace(q{<>},
694             Parse::RecDescent::_tracefirst($text))
695             if defined $::RD_TRACE;
696              
697 0         0 last;
698             }
699 2         12 $current_match = substr($text, $-[0], $+[0] - $-[0]);
700 2         7 substr($text,0,length($current_match),q{});
701 2 50       4 Parse::RecDescent::_trace(q{>>Matched terminal<< (return value: [}
702             . $current_match . q{])},
703             Parse::RecDescent::_tracefirst($text))
704             if defined $::RD_TRACE;
705 2         12 push @item, $item{__PATTERN1__}=$current_match;
706            
707              
708 2 50       5 Parse::RecDescent::_trace(q{Trying repeated subrule: [thread]},
709             Parse::RecDescent::_tracefirst($text),
710             q{start},
711             $tracelevel)
712             if defined $::RD_TRACE;
713 2         5 $expectation->is(q{thread})->at($text);
714            
715 2 50   50   23 unless (defined ($_tok = $thisparser->_parserepeat($text, \&Parse::RecDescent::Mail::IMAPClient::Thread::thread, 0, 100000000, $_noactions,$expectation,sub { \@arg },undef)))
  50         72  
716             {
717 0 0       0 Parse::RecDescent::_trace(q{<>},
718             Parse::RecDescent::_tracefirst($text),
719             q{start},
720             $tracelevel)
721             if defined $::RD_TRACE;
722 0         0 last;
723             }
724 2 50       33 Parse::RecDescent::_trace(q{>>Matched repeated subrule: [thread]<< (}
725             . @$_tok . q{ times)},
726              
727             Parse::RecDescent::_tracefirst($text),
728             q{start},
729             $tracelevel)
730             if defined $::RD_TRACE;
731 2         4 $item{q{thread(s?)}} = $_tok;
732 2         4 push @item, $_tok;
733            
734              
735              
736 2 50       11 Parse::RecDescent::_trace(q{Trying action},
737             Parse::RecDescent::_tracefirst($text),
738             q{start},
739             $tracelevel)
740             if defined $::RD_TRACE;
741            
742              
743 2 50       5 $_tok = ($_noactions) ? 0 : do {
744 2   50     6 $return=$item{'thread(s?)'}||undef;
745             };
746 2 50       6 unless (defined $_tok)
747             {
748 0 0       0 Parse::RecDescent::_trace(q{<> (return value: [undef])})
749             if defined $::RD_TRACE;
750 0         0 last;
751             }
752 2 50       4 Parse::RecDescent::_trace(q{>>Matched action<< (return value: [}
753             . $_tok . q{])},
754             Parse::RecDescent::_tracefirst($text))
755             if defined $::RD_TRACE;
756 2         4 push @item, $_tok;
757 2         2 $item{__ACTION1__}=$_tok;
758            
759              
760 2 50       4 Parse::RecDescent::_trace(q{>>Matched production: [/^\\* THREAD /i thread]<<},
761             Parse::RecDescent::_tracefirst($text),
762             q{start},
763             $tracelevel)
764             if defined $::RD_TRACE;
765              
766              
767              
768 2         3 $_matched = 1;
769 2         3 last;
770             }
771              
772              
773 2 50 33     6 unless ( $_matched || defined($score) )
774             {
775            
776              
777 0         0 $_[1] = $text; # NOT SURE THIS IS NEEDED
778 0 0       0 Parse::RecDescent::_trace(q{<>},
779             Parse::RecDescent::_tracefirst($_[1]),
780             q{start},
781             $tracelevel)
782             if defined $::RD_TRACE;
783 0         0 return undef;
784             }
785 2 50 33     6 if (!defined($return) && defined($score))
786             {
787 0 0       0 Parse::RecDescent::_trace(q{>>Accepted scored production<<}, "",
788             q{start},
789             $tracelevel)
790             if defined $::RD_TRACE;
791 0         0 $return = $score_return;
792             }
793 2         3 splice @{$thisparser->{errors}}, $err_at;
  2         4  
794 2 50       5 $return = $item[$#item] unless defined $return;
795 2 50       4 if (defined $::RD_TRACE)
796             {
797 0         0 Parse::RecDescent::_trace(q{>>Matched rule<< (return value: [} .
798             $return . q{])}, "",
799             q{start},
800             $tracelevel);
801 0         0 Parse::RecDescent::_trace(q{(consumed: [} .
802             Parse::RecDescent::_tracemax(substr($_[1],0,-length($text))) . q{])},
803             Parse::RecDescent::_tracefirst($text),
804             , q{start},
805             $tracelevel)
806             }
807 2         4 $_[1] = $text;
808 2         13 return $return;
809             }
810             }
811 1     1 0 146 package Mail::IMAPClient::Thread; sub new { my $self = bless( {
812             '_AUTOTREE' => undef,
813             '_AUTOACTION' => undef,
814             'namespace' => 'Parse::RecDescent::Mail::IMAPClient::Thread',
815             'startcode' => '',
816             'rules' => {
817             'thread' => bless( {
818             'calls' => [
819             'threadmember'
820             ],
821             'prods' => [
822             bless( {
823             'error' => undef,
824             'actcount' => 1,
825             'uncommit' => undef,
826             'line' => undef,
827             'items' => [
828             bless( {
829             'line' => 10,
830             'pattern' => '(',
831             'lookahead' => 0,
832             'hashname' => '__STRING1__',
833             'description' => '\'(\''
834             }, 'Parse::RecDescent::InterpLit' ),
835             bless( {
836             'lookahead' => 0,
837             'subrule' => 'threadmember',
838             'line' => 10,
839             'max' => 100000000,
840             'min' => 1,
841             'argcode' => undef,
842             'expected' => undef,
843             'matchrule' => 0,
844             'repspec' => 's'
845             }, 'Parse::RecDescent::Repetition' ),
846             bless( {
847             'pattern' => ')',
848             'line' => 10,
849             'lookahead' => 0,
850             'hashname' => '__STRING2__',
851             'description' => '\')\''
852             }, 'Parse::RecDescent::InterpLit' ),
853             bless( {
854             'hashname' => '__ACTION1__',
855             'code' => '{
856             $return = $item{\'threadmember(s)\'}||undef;
857             }',
858             'line' => 11,
859             'lookahead' => 0
860             }, 'Parse::RecDescent::Action' )
861             ],
862             'dircount' => 0,
863             'strcount' => 2,
864             'number' => 0,
865             'patcount' => 0
866             }, 'Parse::RecDescent::Production' )
867             ],
868             'line' => 10,
869             'impcount' => 0,
870             'changed' => 0,
871             'vars' => '',
872             'opcount' => 0,
873             'name' => 'thread'
874             }, 'Parse::RecDescent::Rule' ),
875             'threadmember' => bless( {
876             'line' => 5,
877             'prods' => [
878             bless( {
879             'error' => undef,
880             'strcount' => 0,
881             'dircount' => 0,
882             'items' => [
883             bless( {
884             'matchrule' => 0,
885             'argcode' => undef,
886             'lookahead' => 0,
887             'subrule' => 'NUMBER',
888             'implicit' => undef,
889             'line' => 7
890             }, 'Parse::RecDescent::Subrule' ),
891             bless( {
892             'hashname' => '__ACTION1__',
893             'code' => '{ $return = $item{NUMBER} ; }',
894             'line' => 7,
895             'lookahead' => 0
896             }, 'Parse::RecDescent::Action' )
897             ],
898             'line' => undef,
899             'patcount' => 0,
900             'number' => 0,
901             'actcount' => 1,
902             'uncommit' => undef
903             }, 'Parse::RecDescent::Production' ),
904             bless( {
905             'error' => undef,
906             'actcount' => 1,
907             'uncommit' => undef,
908             'strcount' => 0,
909             'dircount' => 0,
910             'items' => [
911             bless( {
912             'matchrule' => 0,
913             'argcode' => undef,
914             'lookahead' => 0,
915             'line' => 8,
916             'implicit' => undef,
917             'subrule' => 'thread'
918             }, 'Parse::RecDescent::Subrule' ),
919             bless( {
920             'lookahead' => 0,
921             'line' => 8,
922             'hashname' => '__ACTION1__',
923             'code' => '{ $return = $item{thread} ; }'
924             }, 'Parse::RecDescent::Action' )
925             ],
926             'line' => 7,
927             'patcount' => 0,
928             'number' => 1
929             }, 'Parse::RecDescent::Production' )
930             ],
931             'calls' => [
932             'NUMBER',
933             'thread'
934             ],
935             'impcount' => 0,
936             'changed' => 0,
937             'vars' => '',
938             'opcount' => 0,
939             'name' => 'threadmember'
940             }, 'Parse::RecDescent::Rule' ),
941             'NUMBER' => bless( {
942             'line' => 1,
943             'prods' => [
944             bless( {
945             'line' => undef,
946             'items' => [
947             bless( {
948             'ldelim' => '/',
949             'mod' => '',
950             'description' => '/\\\\d+/',
951             'rdelim' => '/',
952             'pattern' => '\\d+',
953             'line' => 3,
954             'lookahead' => 0,
955             'hashname' => '__PATTERN1__'
956             }, 'Parse::RecDescent::Token' )
957             ],
958             'dircount' => 0,
959             'strcount' => 0,
960             'number' => 0,
961             'patcount' => 1,
962             'actcount' => 0,
963             'uncommit' => undef,
964             'error' => undef
965             }, 'Parse::RecDescent::Production' )
966             ],
967             'calls' => [],
968             'opcount' => 0,
969             'name' => 'NUMBER',
970             'impcount' => 0,
971             'changed' => 0,
972             'vars' => ''
973             }, 'Parse::RecDescent::Rule' ),
974             'start' => bless( {
975             'opcount' => 0,
976             'name' => 'start',
977             'impcount' => 0,
978             'changed' => 0,
979             'vars' => '',
980             'calls' => [
981             'thread'
982             ],
983             'prods' => [
984             bless( {
985             'error' => undef,
986             'actcount' => 1,
987             'uncommit' => undef,
988             'strcount' => 0,
989             'line' => undef,
990             'items' => [
991             bless( {
992             'ldelim' => '/',
993             'mod' => 'i',
994             'description' => '/^\\\\* THREAD /i',
995             'rdelim' => '/',
996             'pattern' => '^\\* THREAD ',
997             'line' => 16,
998             'lookahead' => 0,
999             'hashname' => '__PATTERN1__'
1000             }, 'Parse::RecDescent::Token' ),
1001             bless( {
1002             'lookahead' => 0,
1003             'subrule' => 'thread',
1004             'line' => 16,
1005             'max' => 100000000,
1006             'min' => 0,
1007             'argcode' => undef,
1008             'expected' => undef,
1009             'matchrule' => 0,
1010             'repspec' => 's?'
1011             }, 'Parse::RecDescent::Repetition' ),
1012             bless( {
1013             'lookahead' => 0,
1014             'line' => 16,
1015             'code' => '{
1016             $return=$item{\'thread(s?)\'}||undef;
1017             }',
1018             'hashname' => '__ACTION1__'
1019             }, 'Parse::RecDescent::Action' )
1020             ],
1021             'dircount' => 0,
1022             'patcount' => 1,
1023             'number' => 0
1024             }, 'Parse::RecDescent::Production' )
1025             ],
1026             'line' => 15
1027             }, 'Parse::RecDescent::Rule' )
1028             },
1029             '_check' => {
1030             'thisoffset' => '',
1031             'prevcolumn' => '',
1032             'prevline' => '',
1033             'itempos' => '',
1034             'thiscolumn' => '',
1035             'prevoffset' => ''
1036             },
1037             'localvars' => ''
1038             }, 'Parse::RecDescent' );
1039             }