lib/LaTeXML/Core/Mouth.pm

filter: Statementstmt 14.4% 39 / 270 Branchbran 0.0% 0 / 150 Conditioncond 0.0% 0 / 129 MC/DCmcdc 0.0% 0 / 67 Subroutinesub 25.0% 11 / 44 Podpod 38.1% 8 / 21 totaltotal 8.5% 58 / 681 CC 122 SCAR 60.6
CC
122
Cov
7%
readToken
1640.0
getNextChar
132.0
isEOL
132.0
CRAP 429.8
« lib/LaTeXML/Common/Font.pm ↑ Summary lib/LaTeXML/Core/Rewrite.pm »
1 # /=====================================================================\ #
2 # | LaTeXML::Core::Mouth | #
3 # | Analog of TeX's Mouth: Tokenizes strings & files | #
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::Mouth;
13 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 5 ▶use LaTeXML::Global;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 5 ▶use LaTeXML::Common::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 5 ▶use LaTeXML::Common::Locator;
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 LaTeXML::Util::Pathname;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 5 ▶use Encode qw(decode);
Subroutine BEGIN: called CC=1 SCAR=0.0
23 5 ▶use base qw(LaTeXML::Common::Object);
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 5 our $READLINE_PROGRESS_QUANTUM = 25;
26  
27 # Factory method;
28 # Create an appropriate Mouth
29 # options are
30 # quiet,
31 # atletter,
32 # content
33 sub create {
34 0 ▶ my ($class, $source, %options) = @_;
Subroutine create: not called CC=5 SCAR=34.0
Pod documented
35 0 ▶ if ($options{content}) { # we've cached the content of this source
Branch: 3 branches
BranchTrueFalseTotal
if ($options{'content'}) { } 0 0 0
elsif ($source =~ s/^literal://) { } 0 0 0
elsif (not defined $source) { } 0 0 0
36 0 my ($dir, $name, $ext) = pathname_split($source);
37 0 $options{source} = $source;
38 0 $options{shortsource} = "$name.$ext";
39 0 return $class->new($options{content}, %options); }
40 elsif ($source =~ s/^literal://) { # we've supplied literal data
41 0 $options{source} = ''; # the source does not have a corresponding file name
42 0 return $class->new($source, %options); }
43 elsif (!defined $source) {
44 0 return $class->new('', %options); }
45 else {
46 0 my $type = pathname_protocol($source);
47 0 my $newclass = "LaTeXML::Core::Mouth::$type";
48 0 ▶ if (!$newclass->can('new')) { # not already defined somewhere?
Branch: 1 branch
BranchTrueFalseTotal
unless ($newclass->can("new")) 0 0 0
49 0 require "LaTeXML/Core/Mouth/$type.pm"; } # Load it!
50 0 return $newclass->new($source, %options); } }
51  
52 sub new {
53 0 ▶ my ($class, $string, %options) = @_;
Subroutine new: not called CC=4 SCAR=30.0
Pod documented
54 0 ▶ $string = q{} unless defined $string;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $string 0 0 0
55 #$options{source} = "Anonymous String" unless defined $options{source};
56 #$options{shortsource} = "String" unless defined $options{shortsource};
57 my $self = bless { source => $options{source},
58 shortsource => $options{shortsource},
59 fordefinitions => ($options{fordefinitions} ? 1 : 0),
60 0 ▶ notes => ($options{notes} ? 1 : 0),
Branch: 2 branches
BranchTrueFalseTotal
$options{'fordefinitions'} ? : 0 0 0
$options{'notes'} ? : 0 0 0
61 }, $class;
62 0 $self->openString($string);
63 0 $self->initialize;
64 0 return $self; }
65  
66 sub openString {
67 0 ▶ my ($self, $string) = @_;
Subroutine openString: not called CC=6 SCAR=37.4
Pod undocumented
68 # if (0){
69 0 ▶ if (defined $string) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $string) 0 0 0
70 0 ▶ if (utf8::is_utf8($string)) { } # If already utf7
Branch: 2 branches
BranchTrueFalseTotal
if (utf8::is_utf8($string)) { } 0 0 0
elsif (my $encoding = $LaTeXML::Core::Mouth::STATE->lookupValue('PERL_INPUT_ENCODING')) { } 0 0 0
71 elsif (my $encoding = $STATE->lookupValue('PERL_INPUT_ENCODING')) {
72 # Note that if chars in the input cannot be decoded, they are replaced by \x{FFFD}
73 # I _think_ that for TeX's behaviour we actually should turn such un-decodeable chars in to space(?).
74 0 $string = decode($encoding, $string, Encode::FB_DEFAULT);
75 0 ▶ if ($string =~ s/\x{FFFD}/ /g) { # Just remove the replacement chars, and warn (or Info?)
Branch: 1 branch
BranchTrueFalseTotal
if ($string =~ s/\x{FFFD}/ /g) 0 0 0
76 0 Info('misdefined', $encoding, $self, "input isn't valid under encoding $encoding"); } } }
77  
78 0 $$self{string} = $string;
79 0 ▶ $$self{buffer} = [(defined $string ? splitLines($string) : ())];
Branch: 1 branch
BranchTrueFalseTotal
defined $string ? : 0 0 0
80 0 return; }
81  
82 sub initialize {
83 0 ▶ my ($self) = @_;
Subroutine initialize: not called CC=6 SCAR=37.4
Pod undocumented
84 0 $$self{lineno} = 0;
85 0 $$self{colno} = 0;
86 0 $$self{chars} = [];
87 0 $$self{nchars} = 0;
88 0 ▶ if ($$self{notes}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"notes"}) 0 0 0
89 0 ▶ my $source = defined($$self{source}) ? ($$self{source} || 'Literal String') : 'Anonymous String';
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{'source'} ? : 0 0 0
Condition0%0/2
$self->{"source"} or "Literal String"
l!l
00
MC/DC0%0/1
$self->{"source"} or "Literal String"
$self->{"source"}
Truth table0%0/2
A
A= $self->{"source"}
Aresult
11
00
90 0 ▶ $$self{note_message} = "Processing " . ($$self{fordefinitions} ? "definitions" : "content")
Branch: 1 branch
BranchTrueFalseTotal
$self->{'fordefinitions'} ? : 0 0 0
91 . " " . $source;
92 0 ProgressSpinup($$self{note_message}); }
93 0 ▶ if ($$self{fordefinitions}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"fordefinitions"}) 0 0 0
94 0 $$self{saved_at_cc} = $STATE->lookupCatcode('@');
95 0 $$self{SAVED_INCLUDE_COMMENTS} = $STATE->lookupValue('INCLUDE_COMMENTS');
96 0 $STATE->assignCatcode('@' => CC_LETTER);
97 0 $STATE->assignValue(INCLUDE_COMMENTS => 0); }
98 0 return; }
99  
100 sub finish {
101 0 ▶ my ($self) = @_;
Subroutine finish: not called CC=4 SCAR=30.0
Pod undocumented
102 0 ▶ return if $$self{finished};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"finished"} 0 0 0
103 0 $$self{finished} = 1;
104 0 $$self{buffer} = [];
105 0 $$self{lineno} = 0;
106 0 $$self{colno} = 0;
107 0 $$self{chars} = [];
108 0 $$self{nchars} = 0;
109  
110 0 ▶ if ($$self{fordefinitions}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"fordefinitions"}) 0 0 0
111 0 $STATE->assignCatcode('@' => $$self{saved_at_cc});
112 0 $STATE->assignValue(INCLUDE_COMMENTS => $$self{SAVED_INCLUDE_COMMENTS}); }
113 0 ▶ if ($$self{notes}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"notes"}) 0 0 0
114 0 ProgressSpindown($$self{note_message}); }
115 0 return; }
116  
117 # This is (hopefully) a platform independent way of splitting a string
118 # into "lines" ending with CRLF, CR or LF (DOS, Mac or Unix).
119 # Note that TeX considers newlines to be \r, ie CR, ie ^^M
120 sub splitLines {
121 0 ▶ my ($string) = @_;
Subroutine splitLines: not called CC=3 SCAR=24.8
Pod undocumented
122 0 my @lines = split(/\r\n|\r|\n/s, $string, -1);
123 # split returns an extra empty string if $string ends with an EOL
124 # this must be removed
125 0 ▶ if (@lines && $lines[-1] eq '') { pop(@lines); }
Branch: 1 branch
BranchTrueFalseTotal
if (@lines and $lines[-1] eq "") 0 0 0
Condition0%0/3
@lines and $lines[-1] eq ""
!ll&&!rl&&r
000
MC/DC0%0/2
@lines and $lines[-1] eq ""
@lines $lines[-1] eq ""
Truth table0%0/3
A and B
A= @linesB= $lines[-1] eq ""
ABresult
0X0
100
111
126 0 return @lines; }
127  
128 # This is (hopefully) a correct way to split a line into "chars",
129 # or what is probably more desired is "Grapheme clusters" (even "extended")
130 # These are unicode characters that include any following combining chars, accents & such.
131 # I am thinking that when we deal with unicode this may be the most correct way?
132 # If it's not the way XeTeX does it, perhaps, it must be that ALL combining chars
133 # have to be converted to the proper accent control sequences!
134 sub splitChars {
135 0 ▶ my ($line) = @_;
Subroutine splitChars: not called CC=1 SCAR=6.9
Pod undocumented
136 0 return [$line =~ m/\X/g]; }
137  
138 sub getNextLine {
139 0 ▶ my ($self) = @_;
Subroutine getNextLine: not called CC=2 SCAR=17.9
Pod undocumented
140 0 ▶ return unless scalar(@{ $$self{buffer} });
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$self->{"buffer"};} 0 0 0
141 0 my $line = shift(@{ $$self{buffer} });
142 0 return $line; }
143  
144 sub hasMoreInput {
145 0 ▶ my ($self) = @_;
Subroutine hasMoreInput: not called CC=2 SCAR=17.9
Pod documented
146 0 ▶ return !$self->isEOL || scalar(@{ $$self{buffer} }); }
Condition0%0/2
!$self->isEOL || scalar @{$self->{'buffer'};}
l!l
00
MC/DC0%0/1
!$self->isEOL || scalar @{$self->{'buffer'};}
!$self->isEOL
Truth table0%0/2
not(A)
A= !$self->isEOL
Aresult
11
00
147  
148 # Get the next character & it's catcode from the input,
149 # handling TeX's "^^" encoding.
150 # Note that this is the only place where catcode lookup is done,
151 # and that it is somewhat `inlined'.
152 sub getNextChar {
153 0 ▶ my ($self) = @_;
Subroutine getNextChar: not called CC=11 SCAR=48.8
Pod undocumented
154 0 ▶ if ($$self{colno} < $$self{nchars}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'colno'} < $self->{'nchars'}) { } 0 0 0
155 0 my $ch = $$self{chars}[$$self{colno}++];
156 0 ▶ my $cc = $$STATE{catcode}{$ch}[0] // CC_OTHER; # $STATE->lookupCatcode($ch); OPEN CODED!
Condition0%0/2
$LaTeXML::Core::Mouth::STATE->{"catcode"}{$ch}[0] // 12
l!l
00
MC/DC0%0/1
$LaTeXML::Core::Mouth::STATE->{"catcode"}{$ch}[0] // 12
$LaTeXML::Core::Mouth::STATE->{"catcode"}{$ch}[0]
Truth table0%0/2
A
A= $LaTeXML::Core::Mouth::STATE->{"catcode"}{$ch}[0]
Aresult
11
00
157 0 ▶ if (($cc == CC_SUPER) # Possible convert ^^x
Branch: 1 branch
BranchTrueFalseTotal
if ($cc == 7 and $self->{"colno"} + 1 < $self->{"nchars"} and $ch eq $self->{"chars"}[$self->{"colno"}]) 0 0 0
Condition0%0/6
$cc == 7 and $self->{"colno"} + 1 < $self->{"nchars"} and $ch eq $self->{"chars"}[$self->{"colno"}]
!ll&&!rl&&r
000
$cc == 7 and $self->{"colno"} + 1 < $self->{"nchars"}
!ll&&!rl&&r
000
MC/DC0%0/3
$cc == 7 and $self->{"colno"} + 1 < $self->{"nchars"} and $ch eq $self->{"chars"}[$self->{"colno"}]
$cc == 7 $self->{"colno"} + 1 < $self->{"nchars"} $ch eq $self->{"chars"}[$self->{"colno"}]
Truth table0%0/4
A and B and C
A= $cc == 7B= $self->{"colno"} + 1 < $self->{"nchars"}C= $ch eq $self->{"chars"}[$self->{"colno"}]
ABCresult
0XX0
10X0
1100
1111
158 && ($$self{colno} + 1 < $$self{nchars}) && ($ch eq $$self{chars}[$$self{colno}])) {
159 0 my ($c1, $c2);
160 0 ▶ if (($$self{colno} + 2 < $$self{nchars}) # ^^ followed by TWO LOWERCASE Hex digits???
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{'colno'} + 2 < $self->{'nchars'} and ($c1 = $self->{'chars'}[$self->{'colno'} + 1]) =~ /^[0-9a-f]$/ and ($c2 = $self->{'chars'}[$self->{'colno'} + 2]) =~ /^[0-9a-f]$/) { } 0 0 0
Condition0%0/6
$self->{"colno"} + 2 < $self->{"nchars"} and ($c1 = $self->{"chars"}[$self->{"colno"} + 1]) =~ /^[0-9a-f]$/ and ($c2 = $self->{"chars"}[$self->{"colno"} + 2]) =~ /^[0-9a-f]$/
!ll&&!rl&&r
000
$self->{"colno"} + 2 < $self->{"nchars"} and ($c1 = $self->{"chars"}[$self->{"colno"} + 1]) =~ /^[0-9a-f]$/
!ll&&!rl&&r
000
MC/DC0%0/3
$self->{"colno"} + 2 < $self->{"nchars"} and ($c1 = $self->{"chars"}[$self->{"colno"} + 1]) =~ /^[0-9a-f]$/ and ($c2 = $self->{"chars"}[$self->{"colno"} + 2]) =~ /^[0-9a-f]$/
$self->{"colno"} + 2 < $self->{"nchars"} ($c1 = $self->{"chars"}[$self->{"colno"} + 1]) =~ /^[0-9a-f]$/ ($c2 = $self->{"chars"}[$self->{"colno"} + 2]) =~ /^[0-9a-f]$/
Truth table0%0/4
A and B and C
A= $self->{"colno"} + 2 < $self->{"nchars"}B= ($c1 = $self->{"chars"}[$self->{"colno"} + 1]) =~ /^[0-9a-f]$/C= ($c2 = $self->{"chars"}[$self->{"colno"} + 2]) =~ /^[0-9a-f]$/
ABCresult
0XX0
10X0
1100
1111
161 && (($c1 = $$self{chars}[$$self{colno} + 1]) =~ /^[0-9a-f]$/)
162 && (($c2 = $$self{chars}[$$self{colno} + 2]) =~ /^[0-9a-f]$/)) {
163 0 $ch = chr(hex($c1 . $c2));
164 0 splice(@{ $$self{chars} }, $$self{colno} - 1, 4, $ch);
165 0 $$self{nchars} -= 3; }
166 else { # OR ^^ followed by a SINGLE Control char type code???
167 0 my $c = $$self{chars}[$$self{colno} + 1];
168 0 my $cn = ord($c);
169 0 ▶ $ch = chr($cn + ($cn >= 64 ? -64 : 64));
Branch: 1 branch
BranchTrueFalseTotal
$cn >= 64 ? : 0 0 0
170 0 splice(@{ $$self{chars} }, $$self{colno} - 1, 3, $ch);
171 0 $$self{nchars} -= 2; }
172 0 ▶ $cc = $STATE->lookupCatcode($ch) // CC_OTHER; }
Condition0%0/2
$LaTeXML::Core::Mouth::STATE->lookupCatcode($ch) // 12
l!l
00
MC/DC0%0/1
$LaTeXML::Core::Mouth::STATE->lookupCatcode($ch) // 12
$LaTeXML::Core::Mouth::STATE->lookupCatcode($ch)
Truth table0%0/2
A
A= $LaTeXML::Core::Mouth::STATE->lookupCatcode($ch)
Aresult
11
00
173 0 return ($ch, $cc); }
174 else {
175 0 return (undef, undef); } }
176  
177 sub stringify {
178 0 ▶ my ($self) = @_;
Subroutine stringify: not called CC=1 SCAR=6.9
Pod documented
179 0 return "Mouth[<string>\@$$self{lineno}x$$self{colno}]"; }
180  
181 #**********************************************************************
182 sub getLocator {
183 0 ▶ my ($self) = @_;
Subroutine getLocator: not called CC=4 SCAR=30.0
Pod documented
184 0 my ($toLine, $toCol, $fromLine, $fromCol) = ($$self{lineno}, $$self{colno});
185 0 ▶ my $maxCol = ($$self{nchars} ? $$self{nchars} - 1 : 0); #There is always a trailing EOL char
Branch: 1 branch
BranchTrueFalseTotal
$self->{'nchars'} ? : 0 0 0
186 0 ▶ if ((defined $toCol) && ($toCol >= $maxCol)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $toCol and $toCol >= $maxCol) { } 0 0 0
Condition0%0/3
defined $toCol and $toCol >= $maxCol
!ll&&!rl&&r
000
MC/DC0%0/2
defined $toCol and $toCol >= $maxCol
defined $toCol $toCol >= $maxCol
Truth table0%0/3
A and B
A= defined $toColB= $toCol >= $maxCol
ABresult
0X0
100
111
187 0 $fromLine = $toLine;
188 0 $fromCol = 0; }
189 else {
190 0 $fromLine = $toLine;
191 0 $fromCol = $toCol; }
192 0 return LaTeXML::Common::Locator->new($$self{source}, $fromLine, $fromCol, $toLine, $toCol); }
193  
194 sub getSource {
195 0 ▶ my ($self) = @_;
Subroutine getSource: not called CC=1 SCAR=6.9
Pod undocumented
196 0 return $$self{source}; }
197  
198 #**********************************************************************
199 # See The TeXBook, Chapter 8, The Characters You Type, pp.46--47.
200 #**********************************************************************
201  
202 sub handle_escape { # Read control sequence
203 0 ▶ my ($self) = @_;
Subroutine handle_escape: not called CC=8 SCAR=42.8
Pod undocumented
204 # NOTE: We're using control sequences WITH the \ prepended!!!
205 0 my ($ch, $cc) = getNextChar($self);
206 # Knuth, p.46 says that Newlines are converted to spaces,
207 # Bit I believe that he does NOT mean within control sequences
208 0 my $cs = "\\" . $ch; # I need this standardized to be able to lookup tokens (A better way???)
209 0 ▶ if ((defined $cc) && ($cc == CC_LETTER)) { # For letter, read more letters for csname.
Branch: 1 branch
BranchTrueFalseTotal
if (defined $cc and $cc == 11) 0 0 0
Condition0%0/3
defined $cc and $cc == 11
!ll&&!rl&&r
000
MC/DC0%0/2
defined $cc and $cc == 11
defined $cc $cc == 11
Truth table0%0/3
A and B
A= defined $ccB= $cc == 11
ABresult
0X0
100
111
210 0 ▶ while ((($ch, $cc) = getNextChar($self)) && $ch && ($cc == CC_LETTER)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = getNextChar($self) and $ch and $cc == 11) 0 0 0
Condition0%0/6
() = getNextChar($self) and $ch and $cc == 11
!ll&&!rl&&r
000
() = getNextChar($self) and $ch
!ll&&!rl&&r
000
MC/DC0%0/3
() = getNextChar($self) and $ch and $cc == 11
() = getNextChar($self) $ch $cc == 11
Truth table0%0/4
A and B and C
A= () = getNextChar($self)B= $chC= $cc == 11
ABCresult
0XX0
10X0
1100
1111
211 0 $cs .= $ch; }
212 # We WILL skip spaces, but not till next token is read (in case catcode changes!!!!)
213 0 $$self{skipping_spaces} = 1;
214 0 ▶ $$self{colno}-- if (defined $cc) && ($cc != CC_LETTER); }
Branch: 1 branch
BranchTrueFalseTotal
if defined $cc and $cc != 11 0 0 0
Condition0%0/3
defined $cc and $cc != 11
!ll&&!rl&&r
000
MC/DC0%0/2
defined $cc and $cc != 11
defined $cc $cc != 11
Truth table0%0/3
A and B
A= defined $ccB= $cc != 11
ABresult
0X0
100
111
215 0 return T_CS($cs); }
216  
217 sub handle_EOL {
218 0 ▶ my ($self) = @_;
Subroutine handle_EOL: not called CC=3 SCAR=24.8
Pod undocumented
219 # Note that newines should be converted to space (with " " for content)
220 # but it makes nicer XML with occasional \n. Hopefully, this is harmless?
221 0 ▶ my $token = ($$self{colno} == 1
Branch: 2 branches
BranchTrueFalseTotal
$self->{'colno'} == 1 ? : 0 0 0
$LaTeXML::Core::Mouth::STATE->lookupValue('PRESERVE_NEWLINES') ? : 0 0 0
222 ? T_CS('\par')
223 : ($STATE->lookupValue('PRESERVE_NEWLINES') ? Token("\n", CC_SPACE) : T_SPACE));
224 0 $$self{colno} = $$self{nchars}; # Ignore any remaining characters after EOL
225 0 return $token; }
226  
227 sub handle_space {
228 0 ▶ my ($self) = @_;
Subroutine handle_space: not called CC=7 SCAR=40.3
Pod undocumented
229 0 my ($ch, $cc);
230 # Skip any following spaces!
231 0 ▶ while ((($ch, $cc) = getNextChar($self)) && (defined $ch) && (($cc == CC_SPACE) || ($cc == CC_EOL))) { }
Branch: 1 branch
BranchTrueFalseTotal
if (() = getNextChar($self) and defined $ch and $cc == 10 || $cc == 5) 0 0 0
Condition0%0/9
() = getNextChar($self) and defined $ch and $cc == 10 || $cc == 5
!ll&&!rl&&r
000
() = getNextChar($self) and defined $ch
!ll&&!rl&&r
000
$cc == 10 or $cc == 5
l!l&&r!l&&!r
000
MC/DC0%0/4
() = getNextChar($self) and defined $ch and $cc == 10 || $cc == 5
() = getNextChar($self) defined $ch $cc == 10 $cc == 5
Truth table0%0/5
A and B and C or D
A= () = getNextChar($self)B= defined $chC= $cc == 10D= $cc == 5
ABCDresult
0XXX0
10XX0
11000
111X1
11011
232 0 ▶ $$self{colno}-- if ($$self{colno} <= $$self{nchars}) && (defined $ch); # backup at nonspace/eol
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"colno"} <= $self->{"nchars"} and defined $ch 0 0 0
Condition0%0/3
$self->{"colno"} <= $self->{"nchars"} and defined $ch
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"colno"} <= $self->{"nchars"} and defined $ch
$self->{"colno"} <= $self->{"nchars"} defined $ch
Truth table0%0/3
A and B
A= $self->{"colno"} <= $self->{"nchars"}B= defined $ch
ABresult
0X0
100
111
233 0 return T_SPACE; }
234  
235 sub handle_comment {
236 0 ▶ my ($self) = @_;
Subroutine handle_comment: not called CC=5 SCAR=34.0
Pod undocumented
237 0 my $n = $$self{colno};
238 0 $$self{colno} = $$self{nchars};
239 0 my $comment = join('', @{ $$self{chars} }[$n .. $$self{nchars} - 1]);
240 0 $comment =~ s/^\s+//; $comment =~ s/\s+$//;
241 0 ▶ if ($comment && $STATE->lookupValue('INCLUDE_COMMENTS')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($comment and $LaTeXML::Core::Mouth::STATE->lookupValue('INCLUDE_COMMENTS')) { } 0 0 0
elsif (($LaTeXML::Core::Mouth::STATE->lookupValue('PRESERVE_NEWLINES') || 0) > 1) { } 0 0 0
Condition0%0/3
$comment and $LaTeXML::Core::Mouth::STATE->lookupValue("INCLUDE_COMMENTS")
!ll&&!rl&&r
000
MC/DC0%0/2
$comment and $LaTeXML::Core::Mouth::STATE->lookupValue("INCLUDE_COMMENTS")
$comment $LaTeXML::Core::Mouth::STATE->lookupValue("INCLUDE_COMMENTS")
Truth table0%0/3
A and B
A= $commentB= $LaTeXML::Core::Mouth::STATE->lookupValue("INCLUDE_COMMENTS")
ABresult
0X0
100
111
242 0 return T_COMMENT($comment); }
243 ▶ elsif (($STATE->lookupValue('PRESERVE_NEWLINES') || 0) > 1) {
Condition0%0/2
$LaTeXML::Core::Mouth::STATE->lookupValue('PRESERVE_NEWLINES') || 0
l!l
00
MC/DC0%0/1
$LaTeXML::Core::Mouth::STATE->lookupValue('PRESERVE_NEWLINES') || 0
$LaTeXML::Core::Mouth::STATE->lookupValue('PRESERVE_NEWLINES')
Truth table0%0/2
A
A= $LaTeXML::Core::Mouth::STATE->lookupValue('PRESERVE_NEWLINES')
Aresult
11
00
244 0 return T_MARKER('EOL'); } # Required EOL during \read
245 else {
246 0 return; } }
247  
248 # These cache the (presumably small) set of distinct letters, etc
249 # converted to Tokens.
250 # Note that this gets filled during runtime and carries over to through Daemon frames.
251 # However, since the values don't depend on any particular document, bindings, etc,
252 # they should be safe.
253 5 my %LETTER = ();
254 5 my %OTHER = ();
255 5 my %ACTIVE = ();
256  
257 # # Dispatch table for catcodes.
258  
259 # Possibly want to think about caching (common) letters, etc to keep from
260 # creating tokens like crazy... or making them more compact... or ???
261 my @DISPATCH = ( # [CONSTANT]
262 \&handle_escape, # T_ESCAPE
263 0 ▶ sub { ($_[1] eq '{' ? T_BEGIN : Token($_[1], CC_BEGIN)) }, # T_BEGIN
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[1] eq '{' ? : 0 0 0
264 0 ▶ sub { ($_[1] eq '}' ? T_END : Token($_[1], CC_END)) }, # T_END
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[1] eq '}' ? : 0 0 0
265 0 ▶ sub { ($_[1] eq '$' ? T_MATH : Token($_[1], CC_MATH)) }, # T_MATH
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[1] eq '$' ? : 0 0 0
266 0 ▶ sub { ($_[1] eq '&' ? T_ALIGN : Token($_[1], CC_ALIGN)) }, # T_ALIGN
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[1] eq '&' ? : 0 0 0
267 \&handle_EOL, # T_EOL
268 0 ▶ sub { ($_[1] eq '#' ? T_PARAM : Token($_[1], CC_PARAM)) }, # T_PARAM
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[1] eq '#' ? : 0 0 0
269 0 ▶ sub { ($_[1] eq '^' ? T_SUPER : Token($_[1], CC_SUPER)) }, # T_SUPER
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[1] eq '^' ? : 0 0 0
270 0 ▶ sub { ($_[1] eq '_' ? T_SUB : Token($_[1], CC_SUB)) }, # T_SUB
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_[1] eq '_' ? : 0 0 0
271 0 ▶ sub { undef; }, # T_IGNORE (we'll read next token)
Subroutine __ANON__: not called CC=1 SCAR=6.9
272 \&handle_space, # T_SPACE
273 0 ▶ sub { $LETTER{ $_[1] } || ($LETTER{ $_[1] } = T_LETTER($_[1])); }, # T_LETTER
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$LETTER{$_[1]} or $LETTER{$_[1]} = T_LETTER($_[1]) 0 0 0
274 0 ▶ sub { $OTHER{ $_[1] } || ($OTHER{ $_[1] } = T_OTHER($_[1])); }, # T_OTHER
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$OTHER{$_[1]} or $OTHER{$_[1]} = T_OTHER($_[1]) 0 0 0
275 0 ▶ sub { $ACTIVE{ $_[1] } || ($ACTIVE{ $_[1] } = T_ACTIVE($_[1])); }, # T_ACTIVE
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$ACTIVE{$_[1]} or $ACTIVE{$_[1]} = T_ACTIVE($_[1]) 0 0 0
276 \&handle_comment, # T_COMMENT
277 0 ▶ sub { T_OTHER($_[1]); } # T_INVALID (we could get unicode!)
Subroutine __ANON__: not called CC=1 SCAR=6.9
278 5 );
279  
280 # Read the next token, or undef if exhausted.
281 # Note that this also returns COMMENT tokens containing source comments,
282 # and also locator comments (file, line# info).
283 # LaTeXML::Core::Gullet intercepts them and passes them on at appropriate times.
284 sub readToken {
285 0 ▶ my ($self) = @_;
Subroutine readToken: not called CC=40 SCAR=74.0
Pod documented
286 0 while (1) { # Iterate till we find a token, or run out. (use return)
287 # ===== Get next line, if we need to.
288 0 ▶ if ($$self{colno} >= $$self{nchars}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"colno"} >= $self->{"nchars"}) 0 0 0
289 0 $$self{lineno}++;
290 0 $$self{colno} = 0;
291 0 my $line = $self->getNextLine;
292 # For \read, we have to return something for EOL, and handle implicit final newline
293 0 ▶ my $read_mode = (($STATE->lookupValue('PRESERVE_NEWLINES') || 0) > 1);
Condition0%0/2
$LaTeXML::Core::Mouth::STATE->lookupValue('PRESERVE_NEWLINES') || 0
l!l
00
MC/DC0%0/1
$LaTeXML::Core::Mouth::STATE->lookupValue('PRESERVE_NEWLINES') || 0
$LaTeXML::Core::Mouth::STATE->lookupValue('PRESERVE_NEWLINES')
Truth table0%0/2
A
A= $LaTeXML::Core::Mouth::STATE->lookupValue('PRESERVE_NEWLINES')
Aresult
11
00
294 0 my $eolch = "\r";
295 0 ▶ if (my $eol = $STATE->lookupDefinition(T_CS('\endlinechar'))) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $eol = $LaTeXML::Core::Mouth::STATE->lookupDefinition(T_CS("\\endlinechar"))) 0 0 0
296 0 $eol = $eol->valueOf()->valueOf;
297 0 ▶ $eolch = (($eol > 0) && ($eol <= 255) ? chr($eol) : undef); }
Branch: 1 branch
BranchTrueFalseTotal
$eol > 0 && $eol <= 255 ? : 0 0 0
Condition0%0/3
$eol > 0 and $eol <= 255
!ll&&!rl&&r
000
MC/DC0%0/2
$eol > 0 and $eol <= 255
$eol > 0 $eol <= 255
Truth table0%0/3
A and B
A= $eol > 0B= $eol <= 255
ABresult
0X0
100
111
298 0 ▶ if (!defined $line) { # Exhausted the input.
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $line) 0 0 0
299 0 ▶ my $eolcc = ((defined $eolch) && $STATE->lookupCatcode($eolch)) // CC_OTHER;
Condition0%0/5
defined $eolch && $LaTeXML::Core::Mouth::STATE->lookupCatcode($eolch) // 12
l!l
00
defined $eolch and $LaTeXML::Core::Mouth::STATE->lookupCatcode($eolch)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $eolch && $LaTeXML::Core::Mouth::STATE->lookupCatcode($eolch) // 12
defined $eolch $LaTeXML::Core::Mouth::STATE->lookupCatcode($eolch)
Truth table0%0/3
A and B
A= defined $eolchB= $LaTeXML::Core::Mouth::STATE->lookupCatcode($eolch)
ABresult
111
0X0
100
300 my $eoftoken = $read_mode && (defined $eolch) && !$$self{at_eof} && $$self{source}
301 0 ▶ && ($eolcc == CC_EOL ? T_CS('\par')
Branch: 1 branch
BranchTrueFalseTotal
$eolcc == 5 ? : 0 0 0
Condition0%0/12
$read_mode && defined $eolch && !$self->{'at_eof'} && $self->{'source'} && ($eolcc == 5 ? T_CS('\\par') : Token($eolch, $eolcc))
!ll&&!rl&&r
000
$read_mode and defined $eolch and not $self->{"at_eof"} and $self->{"source"}
!ll&&!rl&&r
000
$read_mode and defined $eolch and not $self->{"at_eof"}
!ll&&!rl&&r
000
$read_mode and defined $eolch
!ll&&!rl&&r
000
MC/DC0%0/5
$read_mode && defined $eolch && !$self->{'at_eof'} && $self->{'source'} && ($eolcc == 5 ? T_CS('\\par') : Token($eolch, $eolcc))
$read_mode defined $eolch not $self->{"at_eof"} $self->{"source"} ($eolcc == 5 ? T_CS('\\par') : Token($eolch, $eolcc))
Truth table0%0/6
A and B and not(C) and D && E
A= $read_modeB= defined $eolchC= not $self->{"at_eof"}D= $self->{"source"}E= ($eolcc == 5 ? T_CS('\\par') : Token($eolch, $eolcc))
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
302 : Token($eolch, $eolcc));
303 0 $$self{at_eof} = 1;
304 0 $$self{chars} = [];
305 0 $$self{nchars} = 0;
306 0 ▶ return $eoftoken if $eoftoken;
Branch: 1 branch
BranchTrueFalseTotal
if $eoftoken 0 0 0
307 0 return; }
308 # Remove trailing spaces from external sources
309 0 ▶ if ($$self{source}) { $line =~ s/ *$//s; }
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"source"}) 0 0 0
310 # Then append the appropriate \endlinechar, or "\r";
311 0 ▶ $line .= $eolch if defined $eolch;
Branch: 1 branch
BranchTrueFalseTotal
if defined $eolch 0 0 0
312  
313 0 $$self{chars} = splitChars($line);
314 0 $$self{nchars} = scalar(@{ $$self{chars} });
315 # In state N, skip spaces
316 0 ▶ while (($$self{colno} < $$self{nchars})
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"colno"} < $self->{"nchars"} and ($LaTeXML::Core::Mouth::STATE->{"catcode"}{$self->{"chars"}[$self->{"colno"}]}[0] || 12) == 10) 0 0 0
Condition0%0/5
$self->{"colno"} < $self->{"nchars"} and ($LaTeXML::Core::Mouth::STATE->{"catcode"}{$self->{"chars"}[$self->{"colno"}]}[0] || 12) == 10
!ll&&!rl&&r
000
$LaTeXML::Core::Mouth::STATE->{'catcode'}{$self->{'chars'}[$self->{'colno'}]}[0] || 12
l!l
00
MC/DC0%0/2
$self->{"colno"} < $self->{"nchars"} and ($LaTeXML::Core::Mouth::STATE->{"catcode"}{$self->{"chars"}[$self->{"colno"}]}[0] || 12) == 10
$self->{"colno"} < $self->{"nchars"} $LaTeXML::Core::Mouth::STATE->{'catcode'}{$self->{'chars'}[$self->{'colno'}]}[0]
Truth table0%0/3
A and B
A= $self->{"colno"} < $self->{"nchars"}B= $LaTeXML::Core::Mouth::STATE->{'catcode'}{$self->{'chars'}[$self->{'colno'}]}[0]
ABresult
0X0
100
111
317 # DIRECT ACCESS to $STATE's catcode table!!!
318 && (($$STATE{catcode}{ $$self{chars}[$$self{colno}] }[0] || CC_OTHER) == CC_SPACE)) {
319 0 $$self{colno}++; }
320 # If upcoming line is empty, and there is no recognizable EOL, fake one
321 return T_MARKER('EOL') if $read_mode
322 0 ▶ && ($$self{colno} >= $$self{nchars}) && ((!defined $eolch) || ($eolch ne "\r"));
Branch: 1 branch
BranchTrueFalseTotal
if $read_mode and $self->{"colno"} >= $self->{"nchars"} and !defined($eolch) || $eolch ne "\r" 0 0 0
Condition0%0/9
$read_mode and $self->{"colno"} >= $self->{"nchars"} and !defined($eolch) || $eolch ne "\r"
!ll&&!rl&&r
000
$read_mode and $self->{"colno"} >= $self->{"nchars"}
!ll&&!rl&&r
000
not defined $eolch or $eolch ne "\r"
l!l&&r!l&&!r
000
MC/DC0%0/4
$read_mode and $self->{"colno"} >= $self->{"nchars"} and !defined($eolch) || $eolch ne "\r"
$read_mode $self->{"colno"} >= $self->{"nchars"} not defined $eolch $eolch ne "\r"
Truth table0%0/5
A and B and not(C) or D
A= $read_modeB= $self->{"colno"} >= $self->{"nchars"}C= not defined $eolchD= $eolch ne "\r"
ABCDresult
0XXX0
10XX0
11000
111X1
11011
323 # Sneak a comment out, every so often.
324 0 ▶ if ((($$self{lineno} % $READLINE_PROGRESS_QUANTUM) == 0) && $STATE->lookupValue('INCLUDE_COMMENTS')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"lineno"} % $LaTeXML::Core::Mouth::READLINE_PROGRESS_QUANTUM == 0 and $LaTeXML::Core::Mouth::STATE->lookupValue("INCLUDE_COMMENTS")) 0 0 0
Condition0%0/3
$self->{"lineno"} % $LaTeXML::Core::Mouth::READLINE_PROGRESS_QUANTUM == 0 and $LaTeXML::Core::Mouth::STATE->lookupValue("INCLUDE_COMMENTS")
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"lineno"} % $LaTeXML::Core::Mouth::READLINE_PROGRESS_QUANTUM == 0 and $LaTeXML::Core::Mouth::STATE->lookupValue("INCLUDE_COMMENTS")
$self->{"lineno"} % $LaTeXML::Core::Mouth::READLINE_PROGRESS_QUANTUM == 0 $LaTeXML::Core::Mouth::STATE->lookupValue("INCLUDE_COMMENTS")
Truth table0%0/3
A and B
A= $self->{"lineno"} % $LaTeXML::Core::Mouth::READLINE_PROGRESS_QUANTUM == 0B= $LaTeXML::Core::Mouth::STATE->lookupValue("INCLUDE_COMMENTS")
ABresult
0X0
100
111
325 0 ▶ return T_COMMENT("**** " . ($$self{shortsource} || 'String') . " Line $$self{lineno} ****"); }
Condition0%0/2
$self->{'shortsource'} || 'String'
l!l
00
MC/DC0%0/1
$self->{'shortsource'} || 'String'
$self->{'shortsource'}
Truth table0%0/2
A
A= $self->{'shortsource'}
Aresult
11
00
326 }
327 0 ▶ if ($$self{skipping_spaces}) { # In state S, skip spaces
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"skipping_spaces"}) 0 0 0
328 0 my ($ch, $cc);
329 0 ▶ while ((($ch, $cc) = getNextChar($self)) && (defined $ch) && ($cc == CC_SPACE)) { }
Branch: 1 branch
BranchTrueFalseTotal
if (() = getNextChar($self) and defined $ch and $cc == 10) 0 0 0
Condition0%0/6
() = getNextChar($self) and defined $ch and $cc == 10
!ll&&!rl&&r
000
() = getNextChar($self) and defined $ch
!ll&&!rl&&r
000
MC/DC0%0/3
() = getNextChar($self) and defined $ch and $cc == 10
() = getNextChar($self) defined $ch $cc == 10
Truth table0%0/4
A and B and C
A= () = getNextChar($self)B= defined $chC= $cc == 10
ABCresult
0XX0
10X0
1100
1111
330 0 ▶ $$self{colno}-- if ($$self{colno} <= $$self{nchars}) && (defined $cc) && ($cc != CC_SPACE);
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"colno"} <= $self->{"nchars"} and defined $cc and $cc != 10 0 0 0
Condition0%0/6
$self->{"colno"} <= $self->{"nchars"} and defined $cc and $cc != 10
!ll&&!rl&&r
000
$self->{"colno"} <= $self->{"nchars"} and defined $cc
!ll&&!rl&&r
000
MC/DC0%0/3
$self->{"colno"} <= $self->{"nchars"} and defined $cc and $cc != 10
$self->{"colno"} <= $self->{"nchars"} defined $cc $cc != 10
Truth table0%0/4
A and B and C
A= $self->{"colno"} <= $self->{"nchars"}B= defined $ccC= $cc != 10
ABCresult
0XX0
10X0
1100
1111
331 0 ▶ if ((defined $cc) && ($cc == CC_EOL)) { # If we've got an EOL
Branch: 1 branch
BranchTrueFalseTotal
if (defined $cc and $cc == 5) 0 0 0
Condition0%0/3
defined $cc and $cc == 5
!ll&&!rl&&r
000
MC/DC0%0/2
defined $cc and $cc == 5
defined $cc $cc == 5
Truth table0%0/3
A and B
A= defined $ccB= $cc == 5
ABresult
0X0
100
111
332 0 getNextChar($self);
333 0 ▶ $$self{colno}-- if ($$self{colno} < $$self{nchars}); }
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"colno"} < $self->{"nchars"} 0 0 0
334 0 $$self{skipping_spaces} = 0; }
335  
336 # ==== Extract next token from line.
337 0 my ($ch, $cc) = getNextChar($self);
338 0 ▶ my $token = (defined $cc ? $DISPATCH[$cc] : undef);
Branch: 1 branch
BranchTrueFalseTotal
defined $cc ? : 0 0 0
339 0 ▶ $token = &$token($self, $ch) if ref $token eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $token eq "CODE" 0 0 0
340 0 ▶ return $token if defined $token; # Else, repeat till we get something or run out.
Branch: 1 branch
BranchTrueFalseTotal
if defined $token 0 0 0
341  
342 }
343 0 return; }
344  
345 #**********************************************************************
346 # Read all tokens until a token equal to $until (if given), or until exhausted.
347 # Returns an empty Tokens list, if there is no input
348  
349 sub readTokens {
350 0 ▶ my ($self) = @_;
Subroutine readTokens: not called CC=4 SCAR=30.0
Pod documented
351 0 my @tokens = ();
352 0 ▶ while (defined(my $token = $self->readToken())) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $token = $self->readToken)) 0 0 0
353 0 push(@tokens, $token); }
354 0 ▶ while (@tokens && $tokens[-1]->getCatcode == CC_SPACE) { # Remove trailing space
Branch: 1 branch
BranchTrueFalseTotal
if (@tokens and $tokens[-1]->getCatcode == 10) 0 0 0
Condition0%0/3
@tokens and $tokens[-1]->getCatcode == 10
!ll&&!rl&&r
000
MC/DC0%0/2
@tokens and $tokens[-1]->getCatcode == 10
@tokens $tokens[-1]->getCatcode == 10
Truth table0%0/3
A and B
A= @tokensB= $tokens[-1]->getCatcode == 10
ABresult
0X0
100
111
355 0 pop(@tokens); }
356 0 return Tokens(@tokens); }
357  
358 #**********************************************************************
359 # Read a raw line; there are so many variants of how it should end,
360 # that the Mouth API is left as simple as possible.
361 # Alas: $noread true means NOT to read a new line, but only return
362 # the remainder of the current line, if any. This is useful when combining
363 # with previously peeked tokens from the Gullet.
364 sub readRawLine {
365 0 ▶ my ($self, $noread) = @_;
Subroutine readRawLine: not called CC=4 SCAR=30.0
Pod documented
366 0 my $line;
367 0 ▶ if ($$self{colno} < $$self{nchars}) {
Branch: 2 branches
BranchTrueFalseTotal
if ($self->{'colno'} < $self->{'nchars'}) { } 0 0 0
elsif ($noread) { } 0 0 0
368 0 $line = join('', @{ $$self{chars} }[$$self{colno} .. $$self{nchars} - 1]);
369 # strip the final carriage return, if it has been added back
370 0 $line =~ s/\r$//s;
371 0 $$self{colno} = $$self{nchars}; }
372 elsif ($noread) {
373 0 $line = ''; }
374 else {
375 0 $line = $self->getNextLine;
376 0 ▶ if (!defined $line) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $line) { } 0 0 0
377 0 $$self{at_eof} = 1;
378 0 $$self{chars} = []; $$self{nchars} = 0; $$self{colno} = 0; }
379 else {
380 0 $line =~ s/ *$//s;
381 0 $$self{lineno}++;
382 0 $$self{chars} = splitChars($line);
383 0 $$self{nchars} = scalar(@{ $$self{chars} });
384 0 $$self{colno} = $$self{nchars}; } }
385 0 return $line; }
386  
387 sub isEOL {
388 0 ▶ my ($self) = @_;
Subroutine isEOL: not called CC=11 SCAR=48.8
Pod undocumented
389 0 my $savecolno = $$self{colno};
390 # We have to peek past any to-be-skipped spaces!!!!
391 0 ▶ if ($$self{skipping_spaces}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"skipping_spaces"}) 0 0 0
392 0 my ($ch, $cc);
393 0 ▶ while ((($ch, $cc) = getNextChar($self)) && (defined $ch) && ($cc == CC_SPACE)) { }
Branch: 1 branch
BranchTrueFalseTotal
if (() = getNextChar($self) and defined $ch and $cc == 10) 0 0 0
Condition0%0/6
() = getNextChar($self) and defined $ch and $cc == 10
!ll&&!rl&&r
000
() = getNextChar($self) and defined $ch
!ll&&!rl&&r
000
MC/DC0%0/3
() = getNextChar($self) and defined $ch and $cc == 10
() = getNextChar($self) defined $ch $cc == 10
Truth table0%0/4
A and B and C
A= () = getNextChar($self)B= defined $chC= $cc == 10
ABCresult
0XX0
10X0
1100
1111
394 0 ▶ $$self{colno}-- if ($$self{colno} <= $$self{nchars}) && (defined $cc) && ($cc != CC_SPACE);
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"colno"} <= $self->{"nchars"} and defined $cc and $cc != 10 0 0 0
Condition0%0/6
$self->{"colno"} <= $self->{"nchars"} and defined $cc and $cc != 10
!ll&&!rl&&r
000
$self->{"colno"} <= $self->{"nchars"} and defined $cc
!ll&&!rl&&r
000
MC/DC0%0/3
$self->{"colno"} <= $self->{"nchars"} and defined $cc and $cc != 10
$self->{"colno"} <= $self->{"nchars"} defined $cc $cc != 10
Truth table0%0/4
A and B and C
A= $self->{"colno"} <= $self->{"nchars"}B= defined $ccC= $cc != 10
ABCresult
0XX0
10X0
1100
1111
395 0 ▶ if ((defined $cc) && ($cc == CC_EOL)) { # If we've got an EOL
Branch: 1 branch
BranchTrueFalseTotal
if (defined $cc and $cc == 5) 0 0 0
Condition0%0/3
defined $cc and $cc == 5
!ll&&!rl&&r
000
MC/DC0%0/2
defined $cc and $cc == 5
defined $cc $cc == 5
Truth table0%0/3
A and B
A= defined $ccB= $cc == 5
ABresult
0X0
100
111
396 0 getNextChar($self);
397 0 ▶ $$self{colno}-- if ($$self{colno} < $$self{nchars}); } }
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"colno"} < $self->{"nchars"} 0 0 0
398 0 my $eol = $$self{colno} >= $$self{nchars};
399 0 $$self{colno} = $savecolno;
400 0 return $eol; }
401 #======================================================================
402 5 1;
403  
404 __END__
« lib/LaTeXML/Common/Font.pm ↑ Summary lib/LaTeXML/Core/Rewrite.pm »