Branch Coverage

blib/lib/WWW/Shopify/Liquid/Lexer.pm
Criterion Covered Total %
branch 208 258 80.6


line true false branch
51 0 0 if ($action eq 'render')
52 0 0 unless $pipeline->make_method_calls
54 0 0 $self->is_processed($_) ? :
55 0 0 $self->is_processed($self->{'self'}) ? :
56 0 0 $self->is_processed($self->{'method'}) ? :
57 0 0 unless $inner_self and &blessed($inner_self) and not ref $method
78 33 3038 if (ref $part eq 'WWW::Shopify::Liquid::Token::Variable::Processing') { }
82 1617 1421 $self->is_processed($part) ? :
84 0 3038 unless defined $key and $key ne ''
85 265 2773 if $self->is_processed($key) and $action eq 'optimize'
86 2947 91 if (defined $place)
87 2 2945 if (&blessed($place) and $place->isa('WWW::Shopify::Liquid::Resolver')) { }
2747 198 elsif (&reftype($place) and &reftype($place) eq 'HASH' and exists $place->{$key}) { }
21 177 elsif (&reftype($place) and &reftype($place) eq 'ARRAY' and &looks_like_number($key) and defined $place->[$key]) { }
0 177 elsif ($pipeline->make_method_calls and &blessed($place) and $place->can($key)) { }
103 177 2047 if $unprocessed
104 1 2046 if &blessed($place) and $place->isa('WWW::Shopify::Liquid::Resolver')
111 0 0 $self->is_processed($_) ? :
120 0 0 $self->is_processed($_) ? :
122 0 0 $reference ? :
129 0 33 unless $self->is_processed($argument)
131 0 33 unless $self->is_processed($result)
166 10 6 if $_ % 2 == 0
167 6 10 if $_ % 2 == 1
0 7 unless int grep({$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') if $_ % 2 == 0;} 0 .. $#members) == 0 and int grep({not $members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') or $members[$_]{'core'} ne ',' if $_ % 2 == 1;} 0 .. $#members) == 0
181 0 3 if ($action eq 'optimize')
199 8 24 $_->isa('WWW::Shopify::Liquid::Token::Variable::Named') ? :
202 28 20 if $_ % 2 == 0
205 48 0 unless $_ % 4 == 1 and !$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]{'core'} ne ':'
207 0 14 unless int grep({$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') if $_ % 2 == 0;} 0 .. $#members) == 0 and int grep({$_ % 4 == 3 and !$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]{'core'} ne ',' unless $_ % 4 == 1 and !$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]{'core'} ne ':';} 0 .. $#members) == 0 and int(grep {not $_->isa('WWW::Shopify::Liquid::Token::Separator');} @members) % 2 == 0
219 0 4 if ($action eq 'optimize')
231 372 425 if not defined $_[2] or $_[2] =~ /^\s*$/
259 7 454 if defined $_[1]
260 1 285 if defined $_[1]
264 170 1631 if $package->is_enclosing and $package->inner_halt_lexing
268 680 4546 if $package->transparent
276 0 2741 unless defined $token
278 704 2037 if $self->operators->{$token}
279 285 1752 if $token =~ /^'(.*)'$/s or $token =~ /^"(.*)"$/s
281 284 1 if ($self->parse_escaped_characters)
288 276 1476 if &looks_like_number($token)
289 11 1465 if $token eq '' or $token eq 'null'
290 64 1280 if $token eq ':' or $token eq ',' or $token eq '.'
291 3 1277 if $token eq '[]'
292 6 1271 if $token eq '{}'
302 1863 0 unless ($squot or $dquot)
303 61 1802 if $sym and $sym eq ']'
304 11 1852 if $sym and $sym eq '}'
305 1773 34 if ($sym eq '.' || $sym eq ']' || $sym eq '[' || $sym eq '{' || $sym eq '}' || !$sym and $open_square_bracket == 0 and $open_curly_bracket == 0)
308 1743 30 if (defined $contents and not $contents =~ /^\s*$/)
310 1677 66 if (not $sym or $sym eq '.' or $sym eq '[') { }
58 8 elsif ($sym eq ']') { }
8 0 elsif ($sym eq '}') { }
311 37 1640 $self->transparent_filters->{$contents} ? :
315 4 54 if int @parts == 0
319 8 0 if int @parts == 0
321 1731 0 if (int @variables > 0)
322 1718 13 if (int @variables == 1) { }
331 1761 34 if $sym ne '"' and $sym ne q['] and not $open_curly_bracket and not $open_square_bracket
332 61 1790 if $sym and $sym eq '['
333 11 1840 if $sym and $sym eq '{'
336 0 1851 if $token eq q[']
337 0 1851 if $token eq '"'
346 423 1035 if not defined $exp or $exp eq ''
358 48 21 if $nword_op and $nword_op eq '-' and $rs > 0 and substr($exp, $rs - 1, 1) ne ' ' and not substr($exp, 0, $rs) =~ /\b\d+$/
359 4932 264 unless ($squot or $dquot)
360 79 4853 if $rc eq '(' and $level++ == 0
361 64 4868 if $rc eq '[' and $sq_level++ == 0
362 18 4914 if $rc eq '{' and $hsh_level++ == 0
364 72 7 if ($rc eq ')' and --$level == 0 and $sq_level == 0 and $hsh_level == 0)
368 65 4867 if $rc eq ']'
369 19 4913 if $rc eq '}'
370 4462 232 if ($level == 0 || $rc eq '(' && $level == 1 and $sq_level == 0 and $hsh_level == 0)
372 3958 432 if ($rc eq '(' or defined $whitespace or $nword_op)
373 4030 0 if (defined $start_space)
375 2015 2015 unless $contents =~ /^\s*$/
377 726 3304 if $nword_op
382 376 5352 if $rc eq q['] and not $dquot
383 290 5438 if $rc eq '"' and not $squot
385 0 1035 unless $level == 0
389 5 189 if $tokens[$_]->isa('WWW::Shopify::Liquid::Token::Number') and $tokens[$_ - 1]->isa('WWW::Shopify::Liquid::Token::Operator') and $tokens[$_ - 1]{'core'} eq '-'
398 18 390 if $_ == 2 || !$tokens[$_ - 3]->isa('WWW::Shopify::Liquid::Token::Operator') || $tokens[$_ - 3]{'core'} ne '|' and $tokens[$_ - 2]->isa('WWW::Shopify::Liquid::Token::Variable') and int @{$tokens[$_ - 2]{'core'};} == 1 and $tokens[$_ - 2]{'core'}[0]->isa('WWW::Shopify::Liquid::Token::String') and $tokens[$_ - 1]->isa('WWW::Shopify::Liquid::Token::Separator') and $tokens[$_ - 1]{'core'} eq ':'
408 0 362 unless defined $text
440 541 777 if ($accumulator ne '')
445 952 366 if $start_control_tag
446 366 952 if $start_output_tag
449 23 934 if int @tokens > 0 and $tokens[-1]{'strip_right'}
450 36 1282 if $strip_left
451 511 807 if ($accumulator ne '')
456 0 1318 if $text eq ''
464 1318 625 if (not $open_single_quote || $open_double_quote and $end_output_tag || $end_control_tag) { }
467 367 951 if ($end_output_tag) { }
468 1 366 if $open_control_tag
472 0 951 if $open_output_tag
473 0 951 unless $accumulator =~ /^\s*(\w+)\s*(.*?)\s*$/s
475 11 940 if $self->{'lexing_halters'}{$1}
482 18 607 if ($newline)
486 318 307 if $single_quote and not $open_double_quote
487 248 377 if $double_quote and not $open_single_quote
492 11 1306 if ($lexing_halter)
495 12 11 if ($3) { }
501 10 1 if $accumulator ne ''
510 0 361 if $open_single_quote
511 0 361 if $open_double_quote
512 0 361 if $lexing_halter
513 0 361 if $open_control_tag
514 0 361 if $open_output_tag
516 14 346 if int @tokens > 0 and $tokens[-1]{'strip_right'}
517 40 321 if $accumulator ne ''
523 0 507 unless defined $token
524 0 507 if $token eq ''
525 1 0 unless &blessed($token) or &looks_like_number($token)
526 0 506 unless &blessed($token)
527 5 501 if $token->isa('WWW::Shopify::Liquid::Token::NULL')
528 1 500 if $token->isa('WWW::Shopify::Liquid::Token::Hash')
529 0 500 if $token->isa('WWW::Shopify::Liquid::Token::Array')
536 2 248 $_->isa('WWW::Shopify::Liquid::Token::Variable::Processing') ? :
1 250 $_->isa('WWW::Shopify::Liquid::Token::Variable') ? :
251 22 !$self->is_processed($_) ? :
541 1 499 if $token->isa('WWW::Shopify::Liquid::Token::Variable::Named')
542 214 285 if $token->isa('WWW::Shopify::Liquid::Token::Variable')
543 1 284 if $token->isa('WWW::Shopify::Liquid::Token::Grouping')
544 70 214 if $token->isa('WWW::Shopify::Liquid::Token::String')
550 64 439 $_ eq ':' || $_ eq ',' ? :
557 350 104 $self->unparse_spaces ? :
558 26 428 if $self->is_processed($token)
559 151 277 if ($token->isa('WWW::Shopify::Liquid::Token::Tag'))
560 54 97 if not $token->{'arguments'} or int @{$token->{'arguments'};} == 0
563 24 253 if $token->isa('WWW::Shopify::Liquid::Token::Output')