| 1 | # /=====================================================================\ # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # | LaTeXML::Core::Parameter | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # | Representation of a single Parameter for Control Sequences | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # |=====================================================================| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # | Part of LaTeXML: | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # | Public domain software, produced as part of work done by the | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # | United States Government & not subject to copyright in the US. | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # |---------------------------------------------------------------------| # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | Bruce Miller <bruce.miller@nist.gov> #_# | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # | http://dlmf.nist.gov/LaTeXML/ (o o) | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # \=========================================================ooo==U==ooo=/ # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | package LaTeXML::Core::Parameter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 5 | ▶ | use LaTeXML::Global; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 5 | ▶ | use LaTeXML::Common::Object; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 5 | ▶ | use LaTeXML::Common::Error; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 5 | ▶ | use LaTeXML::Core::Token; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 5 | ▶ | use LaTeXML::Core::Tokens; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 5 | ▶ | use base qw(LaTeXML::Common::Object); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # my ($class, $spec, %options) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | # return bless { spec => $spec, %options }, $class; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | # Create a parameter reading object for a specific type. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | # If either a declared entry or a function Read<Type> accessible from LaTeXML::Package::Pool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | # is defined. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=17 SCAR=57.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | my ($class, $type, $spec, %options) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my $descriptor = $STATE->lookupMapping('PARAMETER_TYPES', $type); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if (!defined $descriptor) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if ($type =~ /^Optional(.+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my $basetype = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if ($descriptor = $STATE->lookupMapping('PARAMETER_TYPES', $basetype)) { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ▶ | elsif (my $reader = checkReaderFunction("Read$type") || checkReaderFunction("Read$basetype")) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
checkReaderFunction("Read$type") || checkReaderFunction("Read$basetype")
MC/DC0%0/2
checkReaderFunction("Read$type") || checkReaderFunction("Read$basetype")
checkReaderFunction("Read$type")
checkReaderFunction("Read$basetype")
Truth table0%0/3
A || B
A= checkReaderFunction("Read$type")B= checkReaderFunction("Read$basetype")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | $descriptor = { reader => $reader }; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | $descriptor = { %$descriptor, optional => 1 } if $descriptor; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | elsif ($type =~ /^Skip(.+)$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | my $basetype = $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | if ($descriptor = $STATE->lookupMapping('PARAMETER_TYPES', $basetype)) { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ▶ | elsif (my $reader = checkReaderFunction($type) || checkReaderFunction("Read$basetype")) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
checkReaderFunction($type) || checkReaderFunction("Read$basetype")
MC/DC0%0/2
checkReaderFunction($type) || checkReaderFunction("Read$basetype")
checkReaderFunction($type)
checkReaderFunction("Read$basetype")
Truth table0%0/3
A || B
A= checkReaderFunction($type)B= checkReaderFunction("Read$basetype")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | $descriptor = { reader => $reader }; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | $descriptor = { %$descriptor, novalue => 1, optional => 1 } if $descriptor; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $reader = checkReaderFunction("Read$type"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | $descriptor = { reader => $reader } if $reader; } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | Fatal('misdefined', $type || 'no_type', undef, "Unrecognized parameter type in \"$spec\"") unless $descriptor; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$type || 'no_type'
MC/DC0%0/1
$type || 'no_type'
$type
Truth table0%0/2
A
A= $type
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # Convert semiverbatim to list of extra SPECIALS. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my %data = (%{$descriptor}, %options); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | $data{semiverbatim} = [] if $data{semiverbatim} && (ref $data{semiverbatim} ne 'ARRAY'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$data{"semiverbatim"} and ref $data{"semiverbatim"} ne "ARRAY"
MC/DC0%0/2
$data{"semiverbatim"} and ref $data{"semiverbatim"} ne "ARRAY"
$data{"semiverbatim"}
ref $data{"semiverbatim"} ne "ARRAY"
Truth table0%0/3
A and B
A= $data{"semiverbatim"}B= ref $data{"semiverbatim"} ne "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | return bless { spec => $spec, type => $type, %data }, $class; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # Check whether a reader function is accessible within LaTeXML::Package::Pool | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub checkReaderFunction { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
checkReaderFunction: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | my ($function) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | ▶ | if (defined $LaTeXML::Package::Pool::{$function}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | local *reader = $LaTeXML::Package::Pool::{$function}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if (defined &reader) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | return \&reader; } } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub stringify { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return $$self{spec}; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | sub setupCatcodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setupCatcodes: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if ($$self{semiverbatim}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | $STATE->beginSemiverbatim(@{ $$self{semiverbatim} }); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | return; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | sub revertCatcodes { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
revertCatcodes: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | if ($$self{semiverbatim}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $STATE->endSemiverbatim(); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | return; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub read { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read: not called CC=12 SCAR=48.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my ($self, $gullet, $fordefn) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | # For semiverbatim, I had messed with catcodes, but there are cases | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | # (eg. \caption(...\label{badchars}}) where you really need to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | # cleanup after the fact! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | # Hmmm, seem to still need it... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if ($$self{semiverbatim}) { # Open coded setupCatcodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | $STATE->beginSemiverbatim(@{ $$self{semiverbatim} }); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 5 | ▶ | no warnings 'recursion'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | my $value = &{ $$self{reader} }($gullet, @{ $$self{extra} || [] }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'extra'} || []
MC/DC0%0/1
$self->{'extra'} || []
$self->{'extra'}
Truth table0%0/2
A
A= $self->{'extra'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | $value = $value->neutralize(@{ $$self{semiverbatim} }) if $$self{semiverbatim} && (ref $value) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$self->{"semiverbatim"} and ref $value and $value->can("neutralize")
$self->{"semiverbatim"} and ref $value
MC/DC0%0/3
$self->{"semiverbatim"} and ref $value and $value->can("neutralize")
$self->{"semiverbatim"}
ref $value
$value->can("neutralize")
Truth table0%0/4
A and B and C
A= $self->{"semiverbatim"}B= ref $valueC= $value->can("neutralize")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | && $value->can('neutralize'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | if ($$self{semiverbatim}) { # Open coded revertCatcodes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $STATE->endSemiverbatim(); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | if ((!defined $value) && !$$self{optional}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined $value || $self->{'optional'}
MC/DC0%0/2
defined $value || $self->{'optional'}
defined $value
$self->{'optional'}
Truth table0%0/3
A || B
A= defined $valueB= $self->{'optional'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | Error('expected', $self, $gullet, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | "Missing argument " . Stringify($self) . " for " . Stringify($fordefn), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | "Ended at " . ToString($gullet->getLocator)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $value = T_OTHER('missing'); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | ▶ | elsif ($value && $$self{optional} && $$self{type} =~ /^OptionalMatch/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$value and $self->{"optional"} and $self->{"type"} =~ /^OptionalMatch/
$value and $self->{"optional"}
MC/DC0%0/3
$value and $self->{"optional"} and $self->{"type"} =~ /^OptionalMatch/
$value
$self->{"optional"}
$self->{"type"} =~ /^OptionalMatch/
Truth table0%0/4
A and B and C
A= $valueB= $self->{"optional"}C= $self->{"type"} =~ /^OptionalMatch/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | # experiment: skip spaces after a successful OptionalMatch read | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | $gullet->skipSpaces; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | return $value; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # This is needed by structured parameter types like KeyVals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # where the argument may already have been tokenized before the KeyVals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # (and the parameter types for the keys) had a chance to properly parse. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # Yuck! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | sub reparse { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reparse: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my ($self, $gullet, $tokens) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # Needs neutralization, since the keyvals may have been tokenized already??? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # perhaps a better test would involve whether $tokens is, in fact, Tokens? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | ▶ | if (($$self{type} eq 'Plain') || $$self{undigested}) { # Gack! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
$self->{"type"} eq "Plain" or $self->{"undigested"}
MC/DC0%0/2
$self->{"type"} eq "Plain" or $self->{"undigested"}
$self->{"type"} eq "Plain"
$self->{"undigested"}
Truth table0%0/3
A or B
A= $self->{"type"} eq "Plain"B= $self->{"undigested"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | return $tokens; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | elsif ($$self{semiverbatim}) { # Needs neutralization | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | return $tokens->neutralize(@{ $$self{semiverbatim} }); } # but maybe specific to catcodes | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | return $gullet->readingFromMouth(LaTeXML::Core::Mouth->new(), sub { # start with empty mouth | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my ($gulletx) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my @tokens = $tokens->unlist; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if (@tokens # Strip outer braces from dimensions & friends | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
@tokens and $self->{"type"} =~ /^(?:Number|Dimension|Glue|MuDimension|MuGlue)$/ and $tokens[0]->getCatcode == 1 and $tokens[-1]->getCatcode == 2
@tokens and $self->{"type"} =~ /^(?:Number|Dimension|Glue|MuDimension|MuGlue)$/ and $tokens[0]->getCatcode == 1
@tokens and $self->{"type"} =~ /^(?:Number|Dimension|Glue|MuDimension|MuGlue)$/
MC/DC0%0/4
@tokens and $self->{"type"} =~ /^(?:Number|Dimension|Glue|MuDimension|MuGlue)$/ and $tokens[0]->getCatcode == 1 and $tokens[-1]->getCatcode == 2
@tokens
$self->{"type"} =~ /^(?:Number|Dimension|Glue|MuDimension|MuGlue)$/
$tokens[0]->getCatcode == 1
$tokens[-1]->getCatcode == 2
Truth table0%0/5
A and B and C and D
A= @tokensB= $self->{"type"} =~ /^(?:Number|Dimension|Glue|MuDimension|MuGlue)$/C= $tokens[0]->getCatcode == 1D= $tokens[-1]->getCatcode == 2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | && ($$self{type} =~ /^(?:Number|Dimension|Glue|MuDimension|MuGlue)$/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | && ($tokens[0]->getCatcode == CC_BEGIN) && ($tokens[-1]->getCatcode == CC_END)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | shift(@tokens); pop(@tokens); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $gulletx->unread(@tokens); # but put back tokens to be read | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | my $value = $self->read($gulletx); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $gulletx->skipSpaces; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | return $value; }); } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | ▶ | sub digest { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
digest: not called CC=9 SCAR=43.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 5 | ▶ | no warnings 'recursion'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | my ($self, $stomach, $value, $fordefn) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # If semiverbatim, Expand (before digest), so tokens can be neutralized; BLECH!!!! | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | if ($$self{semiverbatim}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $STATE->beginSemiverbatim(@{ $$self{semiverbatim} }); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | if ((ref $value eq 'LaTeXML::Core::Token') || (ref $value eq 'LaTeXML::Core::Tokens')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $value eq "LaTeXML::Core::Token" or ref $value eq "LaTeXML::Core::Tokens"
MC/DC0%0/2
ref $value eq "LaTeXML::Core::Token" or ref $value eq "LaTeXML::Core::Tokens"
ref $value eq "LaTeXML::Core::Token"
ref $value eq "LaTeXML::Core::Tokens"
Truth table0%0/3
A or B
A= ref $value eq "LaTeXML::Core::Token"B= ref $value eq "LaTeXML::Core::Tokens"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | $stomach->getGullet->readingFromMouth(LaTeXML::Core::Mouth->new(), sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my ($igullet) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $igullet->unread($value); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | my @tokens = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | while (defined(my $token = $igullet->getPendingComment || $igullet->readXToken(1))) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$igullet->getPendingComment || $igullet->readXToken(1)
MC/DC0%0/2
$igullet->getPendingComment || $igullet->readXToken(1)
$igullet->getPendingComment
$igullet->readXToken(1)
Truth table0%0/3
A || B
A= $igullet->getPendingCommentB= $igullet->readXToken(1)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | push(@tokens, $token); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $value = Tokens(@tokens); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $value = $value->neutralize; }); } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if (my $pre = $$self{beforeDigest}) { # Done for effect only. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | &$pre($stomach); } # maybe pass extras? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | $value = $value->beDigested($stomach) if (ref $value) && !$$self{undigested}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
ref $value and not $self->{"undigested"}
MC/DC0%0/2
ref $value and not $self->{"undigested"}
ref $value
not $self->{"undigested"}
Truth table0%0/3
A and not(B)
A= ref $valueB= not $self->{"undigested"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | ▶ | if (my $post = $$self{afterDigest}) { # Done for effect only. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | &$post($stomach); } # maybe pass extras? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | $STATE->endSemiverbatim() if $$self{semiverbatim}; # Corner case? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | return $value; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | ▶ | sub revert { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
revert: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my ($self, $value) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if (my $reverter = $$self{reversion}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | return &$reverter($value, @{ $$self{extra} || [] }); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'extra'} || []
MC/DC0%0/1
$self->{'extra'} || []
$self->{'extra'}
Truth table0%0/2
A
A= $self->{'extra'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | return Revert($value); } } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | #====================================================================== | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||