lib/LaTeXML/Core/Parameters.pm

filter: Statementstmt 34.2% 25 / 73 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 44.4% 8 / 18 Podpod 66.6% 6 / 9 totaltotal 30.9% 39 / 126 CC 15 SCAR 21.9
CC
15
Cov
27%
stringify
20.0
equals
12.0
getNumArgs
12.0
CRAP 8.9
« lib/LaTeXML/Post/PictureImages.pm ↑ Summary lib/LaTeXML/Post/MathImages.pm »
1 # /=====================================================================\ #
2 # | LaTeXML::Core::Parameters | #
3 # | Representation of Parameters 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 package LaTeXML::Core::Parameters;
13 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use LaTeXML::Global;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 4 ▶use LaTeXML::Common::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 4 ▶use LaTeXML::Common::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 4 ▶use LaTeXML::Core::Parameter;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 4 ▶use LaTeXML::Core::Tokens;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 4 ▶use base qw(LaTeXML::Common::Object);
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 sub new {
23 0 ▶ my ($class, @paramspecs) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
24 0 return bless [@paramspecs], $class; }
25  
26 sub getParameters {
27 0 ▶ my ($self) = @_;
Subroutine getParameters: not called CC=1 SCAR=6.9
Pod documented
28 0 return @$self; }
29  
30 sub stringify {
31 0 ▶ my ($self) = @_;
Subroutine stringify: not called CC=4 SCAR=30.0
Pod documented
32 0 my $string = '';
33 0 foreach my $parameter (@$self) {
34 0 my $s = $parameter->stringify;
35 0 ▶ $string .= ' ' if ($string =~ /\w$/) && ($s =~ /^\w/);
Branch: 1 branch
BranchTrueFalseTotal
if $string =~ /\w$/ and $s =~ /^\w/ 0 0 0
Condition0%0/3
$string =~ /\w$/ and $s =~ /^\w/
!ll&&!rl&&r
000
MC/DC0%0/2
$string =~ /\w$/ and $s =~ /^\w/
$string =~ /\w$/ $s =~ /^\w/
Truth table0%0/3
A and B
A= $string =~ /\w$/B= $s =~ /^\w/
ABresult
0X0
100
111
36 0 $string .= $s; }
37 0 return $string; }
38  
39 sub equals {
40 0 ▶ my ($self, $other) = @_;
Subroutine equals: not called CC=3 SCAR=24.8
Pod documented
41 0 ▶ return (defined $other)
Condition0%0/6
defined $other && ref $self eq ref $other && $self->stringify eq $other->stringify
!ll&&!rl&&r
000
defined $other and ref $self eq ref $other
!ll&&!rl&&r
000
MC/DC0%0/3
defined $other && ref $self eq ref $other && $self->stringify eq $other->stringify
defined $other ref $self eq ref $other $self->stringify eq $other->stringify
Truth table0%0/4
A and B && C
A= defined $otherB= ref $self eq ref $otherC= $self->stringify eq $other->stringify
ABCresult
0XX0
10X0
1100
1111
42 && ((ref $self) eq (ref $other)) && ($self->stringify eq $other->stringify); }
43  
44 sub getNumArgs {
45 0 ▶ my ($self) = @_;
Subroutine getNumArgs: not called CC=3 SCAR=24.8
Pod undocumented
46 0 my $n = 0;
47 0 foreach my $parameter (@$self) {
48 0 ▶ $n++ unless $$parameter{novalue}; }
Branch: 1 branch
BranchTrueFalseTotal
unless $parameter->{"novalue"} 0 0 0
49 0 return $n; }
50  
51 sub revertArguments {
52 0 ▶ my ($self, @args) = @_;
Subroutine revertArguments: not called CC=3 SCAR=24.8
Pod documented
53 0 my @tokens = ();
54 0 foreach my $parameter (@$self) {
55 0 ▶ next if $$parameter{novalue};
Branch: 1 branch
BranchTrueFalseTotal
if $parameter->{"novalue"} 0 0 0
56 0 push(@tokens, $parameter->revert(shift(@args))); }
57 0 return @tokens; }
58  
59 sub readArguments {
60 0 ▶ my ($self, $gullet, $fordefn) = @_;
Subroutine readArguments: not called CC=3 SCAR=24.8
Pod documented
61 0 my @args = ();
62 0 foreach my $parameter (@$self) {
63 0 my $value = $parameter->read($gullet, $fordefn);
64 0 ▶ push(@args, $value) unless $$parameter{novalue}; }
Branch: 1 branch
BranchTrueFalseTotal
unless $parameter->{"novalue"} 0 0 0
65 0 return @args; }
66  
67 sub readArgumentsAndDigest {
68 0 ▶ my ($self, $stomach, $fordefn) = @_;
Subroutine readArgumentsAndDigest: not called CC=3 SCAR=24.8
Pod documented
69 0 my @args = ();
70 0 my $gullet = $stomach->getGullet;
71 0 foreach my $parameter (@$self) {
72 0 my $value = $parameter->read($gullet, $fordefn);
73 0 ▶ if (!$$parameter{novalue}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($parameter->{"novalue"}) 0 0 0
74 0 $value = $parameter->digest($stomach, $value, $fordefn);
75 0 push(@args, $value); } }
76 0 return @args; }
77  
78 sub reparseArgument {
79 0 ▶ my ($self, $gullet, $tokens) = @_;
Subroutine reparseArgument: not called CC=2 SCAR=17.9
Pod undocumented
80 0 ▶ if (defined $tokens) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $tokens) { } 0 0 0
81 return $gullet->readingFromMouth(LaTeXML::Core::Mouth->new(), sub { # start with empty mouth
82 0 ▶ my ($gulletx) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
83 0 $gulletx->unread($tokens); # but put back tokens to be read
84 0 my @values = $self->readArguments($gulletx);
85 0 $gulletx->skipSpaces;
86 0 return @values; }); }
87 else {
88 0 return (); } }
89  
90 #======================================================================
91 4 1;
92  
93 __END__
« lib/LaTeXML/Post/PictureImages.pm ↑ Summary lib/LaTeXML/Post/MathImages.pm »