M4/Impl/Default.pm

filter: Statementstmt 82.9% 4423 / 5331 Branchbran 43.1% 978 / 2266 Conditioncond 42.8% 137 / 320 MC/DCmcdc 18.0% 34 / 188 Subroutinesub 92.4% 918 / 993 Podpod n/a totaltotal 71.3% 6490 / 9098 CC 1297 SCAR 32.5
CC
1297
Cov
70%
__ANON__
380.0
impl_parseIncrementalFile
366.5
_trigger_param_can_be_macro
206.8
CRAP 25.8
« M4/Impl/Parser.pm ↑ Summary M4/Impl/Input.pm »
1 3 ▶use Moops;
Subroutine __ANON__: called CC=1 SCAR=0.0
2 3 ▶use MarpaX::Languages::M4::Impl::Parser;
Subroutine __ANON__: called CC=1 SCAR=0.0
3  
4 # PODNAME: MarpaX::Languages::M4::Impl::Default
5  
6 # ABSTRACT: M4 pre-processor - default implementation
7  
8 #
9 # General note: having API'sed M4 introduce a difficulty when dealing
10 # with diversions: M4 is primilarly designed to act as a command-line
11 # and thus have a clear distinction between its internal buffer that is
12 # constantly being rewriten, and the stdout.
13 # But in the API version, undiverting number 0 (i.e. stdout) should go
14 # to the internal buffer, /without/ rescanning what has been undiverted.
15 #
16 # Therefore the position in variable output can be changed by undiverting number 0
17 # without rescanning.
18 #
19 # This is achieved in the parser implementation, that is maintaining itself
20 # the next position for scanning.
21 #
22 #
23 # Note: GNU-like extension but with different semantics:
24 # ------------------------------------------------------
25 # format Perl sprintf implementation
26 # incr C.f. policy_integer_type, defaults to a 32 bits integer. "native" policy uses int, like GNU.
27 # decr C.f. policy_integer_type, defaults to a 32 bits integer. "native" policy uses int, like GNU.
28 #
29 # Ah... if you wonder why there is (?#) when I do ar// on a variable, this is because,
30 # a per perldoc perlop:
31 #
32 # The empty pattern //
33 # If the PATTERN evaluates to the empty string, the last successfully matched regular expression is used
34 # instead. In this case, only the "g" and "c" flags on the empty pattern is honoured - the other flags are
35 # taken from the original pattern. If no match has previously succeeded, this will (silently) act instead
36 # as a genuine empty pattern (which will always match).
37 #
38 3  
39 3 ▶class MarpaX::Languages::M4::Impl::Default {
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.3
Subroutine BEGIN: called CC=1 SCAR=0.3
40 2 extends 'MarpaX::Languages::M4::Impl::Parser';
41  
42 2 our $VERSION = '0.020'; # VERSION
43  
44 2 our $AUTHORITY = 'cpan:JDDPAUSE'; # AUTHORITY
45  
46 3 ▶ use Bit::Vector;
Subroutine __ANON__: called CC=1 SCAR=0.0
47 3 ▶ use Encode::Locale;
Subroutine __ANON__: called CC=1 SCAR=0.0
48 3 ▶ use Encode;
Subroutine __ANON__: called CC=1 SCAR=0.0
49 3 ▶ use Env::Path qw/M4PATH/;
Subroutine __ANON__: called CC=1 SCAR=0.0
50 3 ▶ use Errno;
Subroutine __ANON__: called CC=1 SCAR=0.0
51 3 ▶ use File::Find;
Subroutine __ANON__: called CC=1 SCAR=0.0
52 3 ▶ use File::Spec;
Subroutine __ANON__: called CC=1 SCAR=0.0
53 3 ▶ use File::Temp;
Subroutine __ANON__: called CC=1 SCAR=0.0
54 3 ▶ use IO::CaptureOutput qw/capture_exec/;
Subroutine __ANON__: called CC=1 SCAR=0.0
55 3 ▶ use IO::Handle;
Subroutine __ANON__: called CC=1 SCAR=0.0
56 3 ▶ use IO::File;
Subroutine __ANON__: called CC=1 SCAR=0.0
57 3 ▶ use IO::Interactive qw/is_interactive/;
Subroutine __ANON__: called CC=1 SCAR=0.0
58 3 ▶ use IO::Scalar;
Subroutine __ANON__: called CC=1 SCAR=0.0
59 3 ▶ use MarpaX::Languages::M4::Impl::Default::BaseConversion;
Subroutine __ANON__: called CC=1 SCAR=0.0
60 3 ▶ use MarpaX::Languages::M4::Impl::Default::Eval;
Subroutine __ANON__: called CC=1 SCAR=0.0
61 3 ▶ use MarpaX::Languages::M4::Impl::Macros;
Subroutine __ANON__: called CC=1 SCAR=0.0
62 3 ▶ use MarpaX::Languages::M4::Impl::Macro;
Subroutine __ANON__: called CC=1 SCAR=0.0
63 3 ▶ use MarpaX::Languages::M4::Impl::Regexp;
Subroutine __ANON__: called CC=1 SCAR=0.0
64 3 ▶ use MarpaX::Languages::M4::Role::Impl;
Subroutine __ANON__: called CC=1 SCAR=0.0
65 3 ▶ use MarpaX::Languages::M4::Type::Macro -all;
Subroutine __ANON__: called CC=1 SCAR=0.0
66 3 ▶ use MarpaX::Languages::M4::Type::Impl -all;
Subroutine __ANON__: called CC=1 SCAR=0.0
67 3 ▶ use MarpaX::Languages::M4::Type::Regexp -all;
Subroutine __ANON__: called CC=1 SCAR=0.0
68 3 ▶ use MarpaX::Languages::M4::Type::Token -all;
Subroutine __ANON__: called CC=1 SCAR=0.0
69 2 ▶ use Marpa::R2;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
70 2 ▶ use MooX::HandlesVia;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
71 2 ▶ use Scalar::Util qw/blessed/;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
72 2 ▶ use Throwable::Factory ImplException => undef;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
73 2 ▶ use MooX::Options 4.103 protect_argv => 0, flavour => [qw/require_order/];
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
74 2 ▶ use MooX::Role::Logger;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
75 2 ▶ use POSIX qw/EXIT_SUCCESS EXIT_FAILURE/;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
76 2 ▶ use Perl::OSType ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
77 2 ▶ use Types::Common::Numeric -all;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
78  
79 # -----------------------------------------------------------------
80 # The list of GNU-like extensions is known in advanced and is fixed
81 # -----------------------------------------------------------------
82 2 our %Default_EXTENSIONS = (
83  
84 # __file__ => 1, # TO DO
85 # __line__ => 1, # TO DO
86 __program__ => 1,
87 builtin => 1,
88 changeword => 1,
89 debugmode => 1,
90 debugfile => 1,
91 esyscmd => 1,
92 format => 1,
93 indir => 1,
94 patsubst => 1,
95 regexp => 1,
96 __gnu__ => 1,
97 __os2__ => 1,
98 os2 => 1,
99 __unix__ => 1,
100 unix => 1,
101 __windows__ => 1,
102 windows => 1,
103 );
104  
105 #
106 # Comments are recognized in preference to macros.
107 # Comments are recognized in preference to argument collection.
108 # Macros are recognized in preference to the begin-quote string.
109 # Quotes are recognized in preference to argument collection.
110 #
111  
112 #
113 # Eval: constants for radix and the grammar
114 #
115 2 our @nums = ( 0 .. 9, 'a' .. 'z', 'A' .. 'Z' );
116 2 our %nums = map { $nums[$_] => $_ } 0 .. $#nums;
117 2 our $EVAL_G = Marpa::R2::Scanless::G->new(
118 { source => \<<EVAL_GRAMMAR
119 :default ::= action => ::first
120 :start ::= eval
121 eval ::= Expression action => _eval
122  
123 Expression ::=
124 Number
125 | ('(') Expression (')') assoc => group
126 # Catch common invalid operations for a nice error message
127 # Uncatched stuff will have the Marpa native exception.
128 || '++' (Expression) action => _invalidOp
129 | (Expression) '+=' (Expression) action => _invalidOp
130 | (Expression) '--' (Expression) action => _invalidOp
131 | (Expression) '-=' (Expression) action => _invalidOp
132 | (Expression) '*=' (Expression) action => _invalidOp
133 | (Expression) '/=' (Expression) action => _invalidOp
134 | (Expression) '%=' (Expression) action => _invalidOp
135 | (Expression) '>>=' (Expression) action => _invalidOp
136 | (Expression) '<<=' (Expression) action => _invalidOp
137 | (Expression) '^=' (Expression) action => _invalidOp
138 | (Expression) '&=' (Expression) action => _invalidOp
139 | (Expression) '|=' (Expression) action => _invalidOp
140 || '+' Expression action => _noop
141 | '-' Expression action => _neg
142 | '~' Expression action => _bneg
143 | '!' Expression action => _lneg
144 || Expression '**' Expression assoc => right action => _exp
145 || Expression '*' Expression action => _mul
146 | Expression '/' Expression action => _div
147 | Expression '%' Expression action => _mod
148 || Expression '+' Expression action => _add
149 | Expression '-' Expression action => _sub
150 || Expression '<<' Expression action => _left
151 | Expression '>>' Expression action => _right
152 || Expression '>' Expression action => _gt
153 | Expression '>=' Expression action => _ge
154 | Expression '<' Expression action => _lt
155 | Expression '<=' Expression action => _le
156 || Expression '==' Expression action => _eq
157 # Special case of '=' aliased to '=='
158 | Expression '=' Expression action => _eq2
159 | Expression '!=' Expression action => _ne
160 || Expression '&' Expression action => _band
161 || Expression '^' Expression action => _bxor
162 || Expression '|' Expression action => _bor
163 || Expression '&&' Expression action => _land
164 || Expression '||' Expression action => _lor
165  
166 Number ::= decimalNumber action => _decimal
167 | octalNumber action => _octal
168 | hexaNumber action => _hex
169 | binaryNumber action => _binary
170 | radixNumber action => _radix
171  
172 _DECDIGITS ~ [0-9]+
173 _OCTDIGITS ~ [0-7]+
174 _HEXDIGITS ~ [0-9a-fA-F]+
175 _BINDIGITS ~ [0-1]+
176 _RADIXDIGITS ~ [0-9a-zA-Z]+
177 _RADIX ~ '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'
178 | '10' | '11' | '12' | '13' | '14' | '15' | '16' | '17' | '18' | '19'
179 | '20' | '21' | '22' | '23' | '24' | '25' | '26' | '27' | '28' | '29'
180 | '30' | '31' | '32' | '33' | '34' | '35' | '36'
181  
182 decimalNumber ~ _DECDIGITS
183 :lexeme ~ <octalNumber> priority => 1 # An octal number is ambiguous v.s. decimal, and wins
184 octalNumber ~ '0' _OCTDIGITS
185 hexaNumber ~ '0x' _HEXDIGITS
186 binaryNumber ~ '0b' _BINDIGITS
187 radixNumber ~ '0r' _RADIX ':' _RADIXDIGITS
188  
189 _WS_many ~ [\\s]+
190 :discard ~ _WS_many
191 EVAL_GRAMMAR
192 }
193 );
194  
195 # ------------------------
196 # PROCESS OPTIONS IN ORDER
197 # ------------------------
198 2 ▶ around new_with_options {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine new_with_options: called CC=7 SCAR=25.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 140 0 140
@_ ? : 140 0 140
199 #
200 # $self is in reality a $class
201 #
202 140 my $class = $self;
203 140 $self = $class->${^NEXT}(@_);
204 #
205 # Because this is done before caller got the returned value:
206 # in the logger callback he gan get the $self value using
207 # this localized variable
208 #
209 140 local $MarpaX::Languages::M4::SELF = $self;
210 140 ▶ while (@ARGV) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ARGV) 0 140 140
211 #
212 # Process this non-option
213 #
214 0 my $file = shift(@ARGV);
215 0 ▶ if ( Undef->check($file) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($file)) 0 0 0
216 0 next;
217 }
218 0 $self->impl_parseIncrementalFile($file);
219 #
220 # Merge next option values
221 #
222 0 my %nextOpts = $class->parse_options();
223 0 foreach ( keys %nextOpts ) {
224 #
225 # Look to options. I made sure all ArrayRef options
226 # have an 'elements' handle named: xxx_elements.
227 #
228 0 ▶ if ( ArrayRef->check( $nextOpts{$_} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&ArrayRef()->check($nextOpts{$_})) { } 0 0 0
229 0 my $elementsMethod = $_ . '_elements';
230 $self->$_(
231 0 [ $self->$elementsMethod, @{ $nextOpts{$_} } ] );
232 }
233 else {
234 0 $self->$_( $nextOpts{$_} );
235 }
236 }
237 }
238 140 return $self;
239 }
240  
241 # ---------------------------------------------------------------
242 # OPTIONS
243 # ---------------------------------------------------------------
244 # * Options always have triggers
245 # * If an option xxx maps to an internal attribute _xxx,
246 # this attribute is always rwp + lazy + builder
247 #
248 # Exception are:
249 # --reload-state: option have order 0 to be seen first, but it is processed explicitely
250 # only before options D, U and t.
251 # --freeze-state: it is implemented at end-of-input
252 # ---------------------------------------------------------------
253  
254 # =========================
255 # --reload-state
256 # =========================
257 2 option reload_state => (
258 is => 'rw',
259 isa => Str,
260 trigger => 1,
261 format => 's',
262 short => 'R',
263 doc =>
264 q{Before execution starts, recover the internal state from the specified frozen file. The options -D, -U, and -t take effect after state is reloaded, but before the input files are read. This option is always processed first. GNU autoconf likes to check the help searching for reload-state... So here it is -;}
265 );
266  
267 2 has _stateReloaded => ( is => 'rwp', isa => Bool, default => false );
268  
269 0 ▶ method _trigger_reload_state (Str $reloadState, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_reload_state: not called CC=7 SCAR=29.3
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($reloadState) or _failed_check(9, "Str", $reloadState, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
270 0 $self->impl_reloadState;
271 0 return;
272 }
273  
274 # =========================
275 # --freeze-state
276 # =========================
277 2 option freeze_state => (
278 is => 'rw',
279 isa => Str,
280 default => '',
281 format => 's',
282 short => 'F',
283 doc =>
284 q{Once execution is finished, write out the frozen state on the specified file. It is conventional, but not required, for file to end in ‘.m4f’. This is implemented at object destruction and is executed once.}
285 );
286  
287 2 has _stateFreezed => ( is => 'rwp', isa => Bool, default => false );
288  
289 # =========================
290 # --cmdtounix
291 # =========================
292 2 option cmdtounix => (
293 is => 'rw',
294 isa => Bool,
295 negativable => 1,
296 trigger => 1,
297 doc =>
298 q{Convert any command output from platform's native end-of-line character set to Unix style (LF). Default to a false value. Option is negativable with '--no-' prefix.}
299 );
300 2 has _cmdtounix => ( is => 'rwp', isa => Bool, lazy => 1, builder => 1 );
301  
302 2 ▶ method _trigger_cmdtounix (Bool $cmdtounix, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger_cmdtounix: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 140 0 140
if @_ < 1 0 140 140
$#_ >= 0 ? : 140 0 140
if ($#_ >= 0) 140 0 140
Type::Tiny::XS::Bool($cmdtounix) or _failed_check(3, "Bool", $cmdtounix, "exception_class", "Error::TypeTiny::Assertion") 140 0 140
$#_ >= 1 ? : 0 140 140
303 140 $self->_set__cmdtounix($cmdtounix);
304 140 return;
305 }
306  
307 0 ▶ method _build__cmdtounix {false}
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine _build__cmdtounix: not called CC=2 SCAR=8.0
Subroutine __ANON__: called CC=1 SCAR=0.6
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
308  
309 # =======================================
310 # --changeword-is-character-per-character
311 # =======================================
312 2 option changeword_is_character_per_character => (
313 is => 'rw',
314 isa => Bool,
315 negativable => 1,
316 trigger => 1,
317 doc =>
318 q{Default behaviour is to construct a word character at a time. I.e. is a regular expression accepts 'foo', it must also accept 'f' and 'fo'. This flag can disable such behaviour. Default to a true value. Option is negativable with '--no-' prefix.}
319 );
320 2 has _changeword_is_character_per_character =>
321 ( is => 'rwp', isa => Bool, lazy => 1, builder => 1 );
322  
323 2 ▶ method _trigger_changeword_is_character_per_character (Bool $changeword_is_character_per_character, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger_changeword_is_character_per_character: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 2 0 2
if @_ < 1 0 2 2
$#_ >= 0 ? : 2 0 2
if ($#_ >= 0) 2 0 2
Type::Tiny::XS::Bool($changeword_is_character_per_character) or _failed_check(3, "Bool", $changeword_is_character_per_character, "exception_class", "Error::TypeTiny::Assertion") 2 0 2
$#_ >= 1 ? : 0 2 2
324 2 $self->_set__changeword_is_character_per_character(
325 $changeword_is_character_per_character);
326 2 return;
327 }
328  
329 2 ▶ method _build__changeword_is_character_per_character {true}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__changeword_is_character_per_character: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 136 0 136
330  
331 # =========================
332 # --inctounix
333 # =========================
334 2 option inctounix => (
335 is => 'rw',
336 isa => Bool,
337 negativable => 1,
338 trigger => 1,
339 doc =>
340 q{Convert any input (M4's include, stdin, file) from platform's native end-of-line character set to Unix style (LF). Default to a false value. Option is negativable with '--no-' prefix.}
341 );
342 2 has _inctounix => ( is => 'rwp', isa => Bool, lazy => 1, builder => 1 );
343  
344 2 ▶ method _trigger_inctounix (Bool $inctounix, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger_inctounix: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 140 0 140
if @_ < 1 0 140 140
$#_ >= 0 ? : 140 0 140
if ($#_ >= 0) 140 0 140
Type::Tiny::XS::Bool($inctounix) or _failed_check(3, "Bool", $inctounix, "exception_class", "Error::TypeTiny::Assertion") 140 0 140
$#_ >= 1 ? : 0 140 140
345 140 $self->_set__inctounix($inctounix);
346 140 return;
347 }
348  
349 0 ▶ method _build__inctounix {false}
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine _build__inctounix: not called CC=2 SCAR=8.0
Subroutine __ANON__: called CC=1 SCAR=0.6
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
350  
351 # =========================
352 # --tokens-priority
353 # =========================
354 2 our $DEFAULT_TOKENS_PRIORITY = [qw/COMMENT WORD QUOTEDSTRING CHARACTER/];
355 option tokens_priority => (
356 is => 'rw',
357 isa => ArrayRef [Str],
358 format => 's@',
359 autosplit => ',',
360 trigger => 1,
361 handles_via => 'Array',
362 handles => { tokens_priority_elements => 'elements' },
363 140 ▶ default => sub { return $DEFAULT_TOKENS_PRIORITY },
Subroutine __ANON__: called CC=1 SCAR=0.0
364 doc =>
365 "Tokens priority. If setted, it is highly recommended to list all allowed values, that are : \"WORD\", \"MACRO\", \"QUOTEDSTRING\", and \"COMMENT\". The order of appearance on the command-line will be the prefered order when parsing M4 input. Multiple values can be given in the same switch if separated by the comma character ','. Unlisted values will keep their relative order from the default, which is: "
366 . join( ',',
367 2 @{$DEFAULT_TOKENS_PRIORITY}
368 . ". Please note that when doing arguments collection, the parser forces unquoted parenthesis and comma to have higher priority to quoted strings and comments."
369 )
370 );
371 2 has _tokens_priority => (
372 is => 'rwp',
373 lazy => 1,
374 builder => 1,
375 isa => ArrayRef [M4Token],
376 handles_via => 'Array',
377 handles => {
378 _tokens_priority_elements => 'elements',
379 _tokens_priority_count => 'count',
380 _tokens_priority_get => 'get'
381 },
382 );
383  
384 0 ▶ method _trigger_tokens_priority (ArrayRef[Str] $tokens_priority, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_tokens_priority: not called CC=10 SCAR=38.4
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC1($tokens_priority) or _failed_check(80, "ArrayRef[Str]", $tokens_priority, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
385 0 my %tokens_priority = ();
386 0 my $currentMaxIndex = $#{$tokens_priority};
387 0 foreach ( 0 .. $currentMaxIndex ) {
388 0 $tokens_priority{ $tokens_priority->[$_] } = $_;
389 }
390 0 foreach ( 0 .. $self->_tokens_priority_count - 1 ) {
391 0 my $lexeme = $self->_tokens_priority_get($_);
392 0 ▶ if ( !exists( $tokens_priority{$lexeme} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $tokens_priority{$lexeme}) 0 0 0
393 0 $tokens_priority{$lexeme} = ++$currentMaxIndex;
394 }
395 }
396  
397 $self->_set__tokens_priority(
398 0 [ sort { $tokens_priority{$a} <=> $tokens_priority{$b} }
399 keys %tokens_priority
400 ]
401 );
402 0 return;
403 }
404  
405 2 ▶ method _build__tokens_priority {$DEFAULT_TOKENS_PRIORITY}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__tokens_priority: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 139 0 139
406  
407 # =========================
408 # --integer-type
409 # =========================
410 2 option integer_type => (
411 is => 'rw',
412 isa => Str,
413 trigger => 1,
414 format => 's',
415 doc =>
416 q{Integer type. Possible values: "native" (will use what your hardware provides using the libc with which perl was built), "bitvector" (will use s/w-driven bit-per-bit manipulations; this is the only portable option value). Default: "bitvector".}
417 );
418 2 has _integer_type => (
419 is => 'rwp',
420 lazy => 1,
421 builder => 1,
422 isa => Enum [qw/native bitvector/]
423 );
424  
425 0 ▶ method _trigger_integer_type (Str $integer_type, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_integer_type: not called CC=7 SCAR=29.3
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($integer_type) or _failed_check(9, "Str", $integer_type, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
426 0 $self->_set__integer_type($integer_type);
427 0 return;
428 }
429  
430 2 ▶ method _build__integer_type {'bitvector'}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__integer_type: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 11 0 11
431  
432 # =========================
433 # --regexp-type
434 # =========================
435 2 option regexp_type => (
436 is => 'rw',
437 isa => Str,
438 trigger => 1,
439 format => 's',
440 doc =>
441 q{Regular expression engine. Affect the syntax of regexp! Possible values: "GNU", "perl". Default: "GNU" (i.e. the GNU M4 default engine). Please note that this has NO effect on the eventual replacement string, that follows striclty GNU convention, i.e. only \\0 (deprecated), \\& and \\1 to \\9 are supported.}
442 );
443 2 has _regexp_type => (
444 is => 'rwp',
445 lazy => 1,
446 builder => 1,
447 isa => M4RegexpType
448 );
449  
450 2 ▶ method _trigger_regexp_type (Str $regexp_type, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger_regexp_type: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 7 0 7
if @_ < 1 0 7 7
$#_ >= 0 ? : 7 0 7
if ($#_ >= 0) 7 0 7
Type::Tiny::XS::Str($regexp_type) or _failed_check(9, "Str", $regexp_type, "exception_class", "Error::TypeTiny::Assertion") 7 0 7
$#_ >= 1 ? : 0 7 7
451 7 $self->_set__regexp_type($regexp_type);
452 7 return;
453 }
454  
455 2 ▶ method _build__regexp_type {'GNU'}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__regexp_type: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 13 0 13
456  
457 # =========================
458 # --integer-bits
459 # =========================
460 2 our $INTEGER_BITS_DEFAULT_VALUE = 32;
461 2 option integer_bits => (
462 is => 'rw',
463 isa => PositiveInt,
464 trigger => 1,
465 format => 'i',
466 doc =>
467 "Number of bits for integer arithmetic. Possible values: any positive integer. Meaningful for builtins incr and decr only when policy_integer_type is \"bitvector\", always meaningful for builtin eval. Default: $INTEGER_BITS_DEFAULT_VALUE."
468 );
469  
470 2 has _integer_bits => (
471 is => 'rwp',
472 lazy => 1,
473 builder => 1,
474 isa => PositiveInt,
475 );
476  
477 0 ▶ method _trigger_integer_bits (Str $integer_bits, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_integer_bits: not called CC=7 SCAR=29.3
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($integer_bits) or _failed_check(9, "Str", $integer_bits, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
478 0 $self->_set__integer_bits($integer_bits);
479 0 return;
480 }
481  
482 2 ▶ method _build__integer_bits {$INTEGER_BITS_DEFAULT_VALUE}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__integer_bits: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 18 0 18
483  
484 # =========================
485 # --m4wrap-order
486 # =========================
487 2 option m4wrap_order => (
488 is => 'rw',
489 isa => Str,
490 trigger => 1,
491 format => 's',
492 doc =>
493 q{M4wrap unbuffer mode. Possible values: "LIFO" (Last In, First Out), "FIFO" (First In, First Out). Default: "LIFO".}
494 );
495  
496 2 has _m4wrap_order => (
497 is => 'rwp',
498 lazy => 1,
499 builder => 1,
500 isa => Enum [qw/LIFO FIFO/]
501 );
502  
503 0 ▶ method _trigger_m4wrap_order (Str $m4wrap_order, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_m4wrap_order: not called CC=7 SCAR=29.3
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($m4wrap_order) or _failed_check(9, "Str", $m4wrap_order, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
504 0 $self->_set__m4wrap_order($m4wrap_order);
505 0 return;
506 }
507  
508 2 ▶ method _build__m4wrap_order {'LIFO'}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__m4wrap_order: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 8 0 8
509  
510 # =========================
511 # --divert-type
512 # =========================
513 2 option divert_type => (
514 is => 'rw',
515 trigger => 1,
516 isa => Str,
517 format => 's',
518 doc =>
519 q{Divertion type. Possible values: "memory" (all diversions are kept in memory), "temp" (all diversions are kept in temporary files). Default: "memory".}
520 );
521  
522 2 has _divert_type => (
523 is => 'rwp',
524 lazy => 1,
525 builder => 1,
526 isa => Enum [qw/memory file/]
527 );
528  
529 0 ▶ method _trigger_divert_type (Str $divert_type, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_divert_type: not called CC=7 SCAR=29.3
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($divert_type) or _failed_check(9, "Str", $divert_type, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
530 0 $self->_set__divert_type($divert_type);
531 0 return;
532 }
533  
534 2 ▶ method _build__divert_type {'memory'}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__divert_type: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 24 0 24
535  
536 # =========================
537 # --builtin-need-param
538 # =========================
539 2 our $NEED_PARAM_DEFAULT_VALUE = [
540 qw/
541 define
542 undefine
543 defn
544 pushdef
545 popdef
546 indir
547 builtin
548 ifdef
549 ifelse
550 shift
551 changeword
552 m4wrap
553 include
554 sinclude
555 len
556 index
557 regexp
558 substr
559 translit
560 patsubst
561 format
562 incr
563 decr
564 eval
565 syscmd
566 esyscmd
567 mkstemp
568 maketemp
569 errprint
570 /
571 ];
572 option builtin_need_param => (
573 is => 'rw',
574 isa => ArrayRef [Str],
575 trigger => 1,
576 format => 's@',
577 autosplit => ',',
578 handles_via => 'Array',
579 handles => { builtin_need_param_elements => 'elements' },
580 140 ▶ default => sub { return $NEED_PARAM_DEFAULT_VALUE },
Subroutine __ANON__: called CC=1 SCAR=0.0
581 doc =>
582 "Recognized-only-with-parameters policy. Repeatable option. Multiple values can be given in the same switch if separated by the comma character ','. Says if a macro is recognized only if it is immediately followed by a left parenthesis. Every option value is subject to the value of word_regexp: if it matches word_regexp at the beginning, then the option is considered. Any attempt to set it on the command-line will completely overwrite the default. Default: "
583 2 . join( ',', @{$NEED_PARAM_DEFAULT_VALUE} ) . '.'
584 );
585  
586 2 has _builtin_need_param => (
587 is => 'rwp',
588 lazy => 1,
589 builder => 1,
590 isa => HashRef [Bool],
591 handles_via => 'Hash',
592 handles => {
593 _builtin_need_param_set => 'set',
594 _builtin_need_param_get => 'get',
595 _builtin_need_param_exists => 'exists',
596 _builtin_need_param_keys => 'keys',
597 _builtin_need_param_delete => 'delete'
598 },
599 );
600  
601 0 ▶ method _trigger_builtin_need_param (ArrayRef[Str] $builtin_need_param, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_builtin_need_param: not called CC=10 SCAR=38.9
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC1($builtin_need_param) or _failed_check(80, "ArrayRef[Str]", $builtin_need_param, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
602 0 my $r = $self->_regexp_word;
603 0 foreach ( @{$builtin_need_param} ) {
604 0 ▶ if ( $r->regexp_exec( $self, $_ ) == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_exec($self, $_) == 0) { } 0 0 0
605 0 my $lpos;
606 my $length;
607  
608 0 ▶ if ( $r->regexp_lpos_count > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_lpos_count > 1) { } 0 0 0
609 0 $lpos = $r->regexp_lpos_get(1);
610 0 $length = $r->regexp_rpos_get(1) - $lpos;
611 }
612 else {
613 0 $lpos = $r->regexp_lpos_get(0);
614 0 $length = $r->regexp_rpos_get(0) - $lpos;
615 }
616  
617 0 $self->_builtin_need_param_set( substr( $_, $lpos, $length ),
618 true );
619 }
620 else {
621 0 $self->logger_warn( '%s: %s: does not match word regexp',
622 'builtin_need_param', $_ );
623 }
624 }
625 0 return;
626 }
627  
628 2 ▶ method _build__builtin_need_param {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__builtin_need_param: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 138 0 138
629 138 my %ref = map { $_ => true } @{$NEED_PARAM_DEFAULT_VALUE};
630 138 \%ref;
631 }
632  
633 # =========================
634 # --param-can-be-macro
635 # =========================
636 2 our $PARAMCANBEMACRO_DEFAULT_VALUE_HASH = {
637 define => {
638 0 => true, # To trigger a warning
639 1 => true
640 },
641 pushdef => { 1 => true },
642 indir => {
643 '*' => true # To trigger a warning
644 },
645 builtin => {
646 '*' => true # To trigger a warning
647 },
648 };
649 our $PARAMCANBEMACRO_DEFAULT_VALUE = [
650 map {
651 8 my $macroName = $_;
652 "$macroName=" . join(
653 ':',
654 grep {
655 10 $PARAMCANBEMACRO_DEFAULT_VALUE_HASH->{$macroName}->{$_}
656 } keys
657 8 %{ $PARAMCANBEMACRO_DEFAULT_VALUE_HASH->{$macroName} }
658 )
659 2 } keys %{$PARAMCANBEMACRO_DEFAULT_VALUE_HASH}
660 ];
661  
662 option param_can_be_macro => (
663 is => 'rw',
664 isa => ArrayRef [Str],
665 trigger => 1,
666 format => 's@',
667 autosplit => ',',
668 handles_via => 'Array',
669 handles => { param_can_be_macro_elements => 'elements' },
670 140 ▶ default => sub { return $NEED_PARAM_DEFAULT_VALUE },
Subroutine __ANON__: called CC=1 SCAR=0.0
671 doc =>
672 "Can-a-macro-parameter-be-an-internal-macro-token policy. Repeatable option. Multiple values can be given in the same switch if separated by the comma character ','. Says if a macro parameter can be an internal token, i.e. a reference to another macro. Every option value is subject to the value of word_regexp: if it matches word_regexp at the beginning, then the option is considered. On the command-line, the format has to be: word-regexp=?numbersOrStarSeparatedByColon?. For example: --policy_paramcanbemacro popdef,ifelse=,define=1,xxx=3:4,yyy=* says that popdef and ifelse do not accept any parameter as macro, but parameter at indice 1 of the define macro can be such internal token, as well as indices 3 and 4 of xxx macro, and any indices of macro yyy. Any attempt to set it on the command-line will completely overwrite the default. Default: "
673 2 . join( ',', @{$PARAMCANBEMACRO_DEFAULT_VALUE} ) . '.'
674 );
675  
676 2 has _param_can_be_macro => (
677 is => 'rwp',
678 lazy => 1,
679 builder => 1,
680 isa => HashRef [ HashRef [ PositiveOrZeroInt | Enum [qw/*/] ] ],
681 handles_via => 'Hash',
682 handles => {
683 _param_can_be_macro_set => 'set',
684 _param_can_be_macro_get => 'get',
685 _param_can_be_macro_exists => 'exists',
686 _param_can_be_macro_keys => 'keys',
687 _param_can_be_macro_delete => 'delete'
688 },
689 );
690  
691 0 ▶ method _trigger_param_can_be_macro (ArrayRef[Str] $param_can_be_macro, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_param_can_be_macro: not called CC=18 SCAR=53.3
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC1($param_can_be_macro) or _failed_check(80, "ArrayRef[Str]", $param_can_be_macro, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
692 0 my $r = $self->_regexp_word;
693 0 my %ref = ();
694 0 foreach ( @{$param_can_be_macro} ) {
695 0 ▶ if ( $r->regexp_exec( $self, $_ ) == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_exec($self, $_) == 0) { } 0 0 0
696 0 my $macroName;
697 my $lpos;
698 0 my $nextPos;
699 0 my $length;
700  
701 0 ▶ if ( $r->regexp_lpos_count > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_lpos_count > 1) { } 0 0 0
702 0 $lpos = $r->regexp_lpos_get(1);
703 0 $nextPos = $r->regexp_rpos_get(1);
704 }
705 else {
706 0 $lpos = $r->regexp_lpos_get(0);
707 0 $nextPos = $r->regexp_rpos_get(0);
708 }
709  
710 0 $length = $nextPos - $lpos;
711 0 $macroName = substr( $_, $lpos, $length );
712  
713 0 $ref{$macroName} = {};
714 0 ▶ if ( $nextPos < length($_)
Branch: 1 branch
BranchTrueFalseTotal
if ($nextPos < length $_ and substr($_, $nextPos++, 1) eq "=" and $nextPos < length $_) 0 0 0
Condition0%0/6
$nextPos < length $_ and substr($_, $nextPos++, 1) eq "=" and $nextPos < length $_
!ll&&!rl&&r
000
$nextPos < length $_ and substr($_, $nextPos++, 1) eq "="
!ll&&!rl&&r
000
MC/DC0%0/3
$nextPos < length $_ and substr($_, $nextPos++, 1) eq "=" and $nextPos < length $_
$nextPos < length $_ substr($_, $nextPos++, 1) eq "=" $nextPos < length $_
Truth table0%0/4
A and B and C
A= $nextPos < length $_B= substr($_, $nextPos++, 1) eq "="C= $nextPos < length $_
ABCresult
0XX0
10X0
1100
1111
715 && substr( $_, $nextPos++, 1 ) eq '='
716 && $nextPos < length($_) )
717 {
718 0 my $indicesToSplit = substr( $_, $nextPos );
719 my @indices
720 0 ▶ = grep { !Undef->check($_) && length("$_") > 0 }
Condition0%0/3
!&Undef()->check($_) && length "$_" > 0
!ll&&!rl&&r
000
MC/DC0%0/2
!&Undef()->check($_) && length "$_" > 0
!&Undef()->check($_) length "$_" > 0
Truth table0%0/3
not(A) && B
A= !&Undef()->check($_)B= length "$_" > 0
ABresult
0X0
100
111
721 split( /,/, $indicesToSplit );
722 0 foreach (@indices) {
723 0 ▶ if ( PositiveOrZeroInt->check($_)
Branch: 1 branch
BranchTrueFalseTotal
if (&PositiveOrZeroInt()->check($_) or &Str()->check($_) and $_ eq '*') { } 0 0 0
Condition0%0/6
&PositiveOrZeroInt()->check($_) or &Str()->check($_) and $_ eq "*"
l!l&&r!l&&!r
000
&Str()->check($_) and $_ eq "*"
!ll&&!rl&&r
000
MC/DC0%0/3
&PositiveOrZeroInt()->check($_) or &Str()->check($_) and $_ eq "*"
&PositiveOrZeroInt()->check($_) &Str()->check($_) $_ eq "*"
Truth table0%0/4
A or B and C
A= &PositiveOrZeroInt()->check($_)B= &Str()->check($_)C= $_ eq "*"
ABCresult
1XX1
0111
00X0
0100
724 || ( Str->check($_) && $_ eq '*' ) )
725 {
726 0 $ref{$macroName}->{$_} = true;
727 }
728 else {
729 0 $self->logger_warn(
730 '%s: %s: %s does not look like a positive or zero integer, or star character',
731 'policy_paramcanbemacro', $macroName, $_
732 );
733 }
734 }
735 }
736 }
737 else {
738 0 $self->logger_warn( '%s: %s does not match a word regexp',
739 'policy_paramcanbemacro', $_ );
740 }
741 }
742 0 $self->_set__param_can_be_macro( \%ref );
743 0 return;
744 }
745  
746 138 ▶ sub _build__param_can_be_macro {
Subroutine _build__param_can_be_macro: called CC=1 SCAR=0.0
747 138 return $PARAMCANBEMACRO_DEFAULT_VALUE_HASH;
748 }
749  
750 # =========================
751 # --interactive
752 # =========================
753 2 option interactive => (
754 is => 'rw',
755 isa => Bool,
756 negativable => 1,
757 # short => 'i',
758 trigger => 1,
759 doc =>
760 q{Read STDIN and parse it line by line, until EOF. Option is negativable with '--no-' prefix.}
761 );
762  
763 0 ▶ method _dumpCurrent (--> Undef) {
Subroutine BEGIN: called CC=1 SCAR=1.0
Subroutine _dumpCurrent: not called CC=3 SCAR=17.0
Subroutine __ANON__: called CC=1 SCAR=1.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
764 0 my $valueRef = $self->_diversions_get(0)->sref;
765  
766 0 my $old = STDOUT->autoflush(1);
767 0 print STDOUT ${$valueRef};
768 0 STDOUT->autoflush($old);
769  
770 0 ${$valueRef} = '';
771 0 return;
772 }
773  
774 0 ▶ method _trigger_interactive (Bool $interactive, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_interactive: not called CC=8 SCAR=32.4
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Bool($interactive) or _failed_check(3, "Bool", $interactive, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
775 0 ▶ if ($interactive) {
Branch: 1 branch
BranchTrueFalseTotal
if ($interactive) 0 0 0
776 0 $self->impl_parseIncrementalFile('-');
777 }
778 0 return;
779 }
780  
781 # =========================
782 # --version
783 # =========================
784 2 option version => (
785 is => 'rw',
786 isa => Bool,
787 negativable => 1,
788 short => 'v',
789 trigger => 1,
790 doc =>
791 q{Print the version number of the program on standard output, then immediately exit. Option is negativable with '--no-' prefix.}
792 );
793  
794 0 ▶ method _trigger_version (Bool $version, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_version: not called CC=9 SCAR=33.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Bool($version) or _failed_check(3, "Bool", $version, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
795 0 ▶ if ($version) {
Branch: 1 branch
BranchTrueFalseTotal
if ($version) 0 0 0
796 0 my $CURRENTVERSION;
797 #
798 # Because $VERSION is generated by dzil, not available in dev. tree
799 #
800 2 ▶ no strict 'vars';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
801 0 ▶ $CURRENTVERSION = $VERSION || 'dev';
Condition0%0/2
$VERSION || 'dev'
l!l
00
MC/DC0%0/1
$VERSION || 'dev'
$VERSION
Truth table0%0/2
A
A= $VERSION
Aresult
11
00
802  
803 0 print "Version $CURRENTVERSION\n";
804 0 exit(EXIT_SUCCESS);
805 }
806 0 return;
807 }
808  
809 # =========================
810 # --prefix-builtins
811 # =========================
812 2 option prefix_builtins => (
813 is => 'rw',
814 isa => Bool,
815 negativable => 1,
816 short => 'P',
817 trigger => 1,
818 doc =>
819 q{Prefix of all builtin macros with 'm4_'. Default: a false value. Option is negativable with '--no-' prefix.}
820 );
821  
822 2 has _prefix_builtins => (
823 is => 'rwp',
824 lazy => 1,
825 builder => 1,
826 isa => Str,
827 );
828  
829 2 ▶ method _trigger_prefix_builtins (Bool $prefix_builtins, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger_prefix_builtins: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 1 0 1
if @_ < 1 0 1 1
$#_ >= 0 ? : 1 0 1
if ($#_ >= 0) 1 0 1
Type::Tiny::XS::Bool($prefix_builtins) or _failed_check(3, "Bool", $prefix_builtins, "exception_class", "Error::TypeTiny::Assertion") 1 0 1
$#_ >= 1 ? : 0 1 1
830 1 $self->_set__prefix_builtins('m4_');
831 1 return;
832 }
833 2 ▶ method _build__prefix_builtins {''}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__prefix_builtins: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 137 0 137
834  
835 # =========================
836 # --fatal-warnings
837 # =========================
838 2 option fatal_warnings => (
839 is => 'rw',
840 isa => PositiveInt,
841 repeatable => 1,
842 short => 'E',
843 trigger => 1,
844 doc =>
845 q{If unspecified, have no effect. If specified once, impl_rc() will return EXIT_FAILURE. If specified more than once, any warning is fatal. Default: a false value.}
846 );
847  
848 2 has _fatal_warnings => (
849 is => 'rwp',
850 lazy => 1,
851 builder => 1,
852 isa => PositiveOrZeroInt
853 );
854  
855 2 ▶ method _trigger_fatal_warnings (PositiveInt $fatal_warnings, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger_fatal_warnings: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 1 0 1
if @_ < 1 0 1 1
$#_ >= 0 ? : 1 0 1
if ($#_ >= 0) 1 0 1
Type::Tiny::XS::PositiveInt($fatal_warnings) or _failed_check(47, "PositiveInt", $fatal_warnings, "exception_class", "Error::TypeTiny::Assertion") 1 0 1
$#_ >= 1 ? : 0 1 1
856 1 $self->_set__fatal_warnings($fatal_warnings);
857 1 return;
858 }
859  
860 2 ▶ method _build__fatal_warnings {0}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__fatal_warnings: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 13 0 13
861  
862 # =========================
863 # --silent
864 # =========================
865 2 option silent => (
866 is => 'rw',
867 default => false,
868 short => 'Q',
869 doc =>
870 q{Silent mode. If true all warnings will disappear. Default: a false value.}
871 );
872  
873 2 has _silent => (
874 is => 'rwp',
875 lazy => 1,
876 builder => 1,
877 );
878  
879 0 ▶ method _trigger_silent (Bool $silent, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_silent: not called CC=7 SCAR=29.3
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Bool($silent) or _failed_check(3, "Bool", $silent, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
880 0 $self->_set__silent($silent);
881 0 return;
882 }
883  
884 0 ▶ method _build__silent {false}
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine _build__silent: not called CC=2 SCAR=8.0
Subroutine __ANON__: called CC=1 SCAR=0.6
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
885  
886 # =========================
887 # --trace
888 # =========================
889 option trace => (
890 is => 'rw',
891 isa => ArrayRef [Str],
892 0 ▶ default => sub { [] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
893 format => 's@',
894 # short => 't',
895 autosplit => ',',
896 trigger => 1,
897 handles_via => 'Array',
898 handles => { trace_elements => 'elements' },
899 140 ▶ default => sub { return [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
900 2 doc =>
901 q{Trace mode. Repeatable option. Multiple values can be given in the same switch if separated by the comma character ','. Every option value will set trace on the macro sharing this name. Default is empty.}
902 );
903  
904 2 has _trace => (
905 is => 'rwp',
906 lazy => 1,
907 builder => 1,
908 isa => HashRef [Bool],
909 handles_via => 'Hash',
910 handles => {
911 _trace_set => 'set',
912 _trace_get => 'get',
913 _trace_exists => 'exists',
914 _trace_keys => 'keys',
915 _trace_delete => 'delete'
916 }
917 );
918  
919 0 ▶ method _trigger_trace (ArrayRef[Str] $arrayRef, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_trace: not called CC=8 SCAR=32.4
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC1($arrayRef) or _failed_check(80, "ArrayRef[Str]", $arrayRef, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
920 0 $self->impl_reloadState;
921 0 foreach ( @{$arrayRef} ) {
922 0 $self->_trace_set($_);
923 }
924 0 return;
925 }
926 2 ▶ method _build__trace { {} }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__trace: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 138 0 138
927  
928 # =========================
929 # --define
930 # =========================
931 option define => (
932 is => 'rw',
933 isa => ArrayRef [Str],
934 handles_via => 'Array',
935 handles => { define_elements => 'elements' },
936 140 ▶ default => sub { return [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
937 2 format => 's@',
938 short => 'D',
939 trigger => 1,
940 doc =>
941 q{Macro definition. Repeatable option. Every option value is subject to the value of word_regexp: if it matches word_regexp at the beginning, then a macro is declared. For example: --define myMacro. Or --word_regexp x= --define x=. Default expansion is void, unless the matched name is followed by '=', then any remaining character will be the expansion of this new macro. For example: --define myMacro=myExpansion. Or --word_regexp x= --define x==myExpansion. Default is empty.}
942 );
943  
944 0 ▶ method _trigger_define (ArrayRef[Str] $arrayRef, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_define: not called CC=12 SCAR=44.1
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC1($arrayRef) or _failed_check(80, "ArrayRef[Str]", $arrayRef, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
945 0 $self->impl_reloadState;
946 0 my $r = $self->_regexp_word;
947 0 foreach ( @{$arrayRef} ) {
948 0 ▶ if ( $r->regexp_exec( $self, $_ ) == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_exec($self, $_) == 0) { } 0 0 0
949 0 my $macroName;
950 my $lpos;
951 0 my $nextPos;
952 0 my $length;
953  
954 0 ▶ if ( $r->regexp_lpos_count > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_lpos_count > 1) { } 0 0 0
955 0 $lpos = $r->regexp_lpos_get(1);
956 0 $nextPos = $r->regexp_rpos_get(1);
957 }
958 else {
959 0 $lpos = $r->regexp_lpos_get(0);
960 0 $nextPos = $r->regexp_rpos_get(0);
961 }
962  
963 0 $length = $nextPos - $lpos;
964 0 $macroName = substr( $_, $lpos, $length );
965  
966 0 my $value = substr( $_, $nextPos );
967 0 ▶ if ( length($value) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $value > 0) 0 0 0
968 0 ▶ if ( substr( $value, 0, 1 ) ne '=' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($value, 0, 1) ne '=') { } 0 0 0
969 0 $self->logger_warn( '%s: %s: not in form name=value',
970 'define', $_ );
971 }
972 else {
973 0 substr( $value, 0, 1, '' );
974 }
975 }
976 0 $self->builtin_define( $macroName, $value );
977 }
978 else {
979 0 $self->logger_warn( '%s: %s: does not match word regexp',
980 'define', $_ );
981 }
982 }
983 0 return;
984 }
985  
986 # =========================
987 # --undefine
988 # =========================
989 option undefine => (
990 is => 'rw',
991 isa => ArrayRef [Str],
992 handles_via => 'Array',
993 handles => { undefine_elements => 'elements' },
994 140 ▶ default => sub { return [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
995 2 format => 's',
996 short => 'U',
997 repeatable => 1,
998 trigger => 1,
999 doc =>
1000 q{Macro undefinition. Repeatable option. Every option value is subject to the value of word_regexp: if it matches word_regexp at the beginning, then a macro is deleted if it exists. Default is empty.}
1001 );
1002  
1003 0 ▶ method _trigger_undefine (ArrayRef[Str] $arrayRef, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_undefine: not called CC=10 SCAR=39.4
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC1($arrayRef) or _failed_check(80, "ArrayRef[Str]", $arrayRef, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1004 0 $self->impl_reloadState;
1005 0 my $r = $self->_regexp_word;
1006 0 foreach ( @{$arrayRef} ) {
1007 0 ▶ if ( $r->regexp_exec( $self, $_ ) == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_exec($self, $_) == 0) { } 0 0 0
1008 0 my $macroName;
1009 my $lpos;
1010 0 my $length;
1011  
1012 0 ▶ if ( $r->regexp_lpos_count > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_lpos_count > 1) { } 0 0 0
1013 0 $lpos = $r->regexp_lpos_get(1);
1014 0 $length = $r->regexp_rpos_get(1) - $lpos;
1015 }
1016 else {
1017 0 $lpos = $r->regexp_lpos_get(0);
1018 0 $length = $r->regexp_rpos_get(0) - $lpos;
1019 }
1020  
1021 0 $macroName = substr( $_, $lpos, $length );
1022 0 $self->builtin_undefine($macroName);
1023 }
1024 else {
1025 0 $self->logger_warn( '%s: %s: does not match word regexp',
1026 'undefine', $_ );
1027 }
1028 }
1029 0 return;
1030 }
1031  
1032 # =========================
1033 # --prepend-include
1034 # =========================
1035 option prepend_include => (
1036 is => 'rw',
1037 isa => ArrayRef [Str],
1038 handles_via => 'Array',
1039 handles => { prepend_include_elements => 'elements' },
1040 140 ▶ default => sub { return [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
1041 2 format => 's@',
1042 short => 'B',
1043 trigger => 1,
1044 doc =>
1045 q{Include directory. Repeatable option. Will be used in reverse order and before current directory when searching for a file to include. Default is empty.}
1046 );
1047  
1048 2 has _prepend_include => (
1049 is => 'rwp',
1050 lazy => 1,
1051 builder => 1,
1052 isa => ArrayRef [Str],
1053 handles_via => 'Array',
1054 handles => { _prepend_include_elements => 'elements', },
1055 );
1056  
1057 0 ▶ method _trigger_prepend_include (ArrayRef[Str] $prepend_include, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_prepend_include: not called CC=7 SCAR=29.3
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC1($prepend_include) or _failed_check(80, "ArrayRef[Str]", $prepend_include, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1058 0 $self->_set__prepend_include($prepend_include);
1059 0 return;
1060 }
1061 2 ▶ method _build__prepend_include { [] }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__prepend_include: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 20 0 20
1062  
1063 # =========================
1064 # --include
1065 # =========================
1066 option include => (
1067 is => 'rw',
1068 isa => ArrayRef [Str],
1069 handles_via => 'Array',
1070 handles => { include_elements => 'elements' },
1071 140 ▶ default => sub { return [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
1072 2 format => 's@',
1073 short => 'I',
1074 trigger => 1,
1075 doc =>
1076 q{Include directory. Repeatable option. Will be used in order and after current directory when searching for a file to include. Default is empty.}
1077 );
1078  
1079 2 has _include => (
1080 is => 'rwp',
1081 lazy => 1,
1082 builder => 1,
1083 isa => ArrayRef [Str],
1084 handles_via => 'Array',
1085 handles => { _include_elements => 'elements', },
1086 );
1087  
1088 2 ▶ method _trigger_include (ArrayRef[Str] $include, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger_include: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 140 0 140
if @_ < 1 0 140 140
$#_ >= 0 ? : 140 0 140
if ($#_ >= 0) 140 0 140
Type::Tiny::XS::AUTO::TC1($include) or _failed_check(80, "ArrayRef[Str]", $include, "exception_class", "Error::TypeTiny::Assertion") 140 0 140
$#_ >= 1 ? : 0 140 140
1089 140 $self->_set__include($include);
1090 140 return;
1091 }
1092 0 ▶ method _build__include { [] }
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine _build__include: not called CC=2 SCAR=8.0
Subroutine __ANON__: called CC=1 SCAR=0.6
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
1093  
1094 # =========================
1095 # --synclines
1096 # =========================
1097 2 option synclines => (
1098 is => 'rw',
1099 isa => Bool,
1100 negativable => 1,
1101 # short => 's',
1102 trigger => 1,
1103 doc =>
1104 q{Generate synchronization lines. Although option exist it is not yet supported. Option is negativable with '--no-' prefix.}
1105 );
1106  
1107 2 has _synclines => (
1108 is => 'rwp',
1109 lazy => 1,
1110 builder => 1,
1111 isa => Bool,
1112 );
1113  
1114 0 ▶ method _trigger_synclines (Bool $synclines, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_synclines: not called CC=7 SCAR=29.3
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Bool($synclines) or _failed_check(3, "Bool", $synclines, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1115 0 $self->_set__synclines($synclines);
1116 0 return;
1117 }
1118 0 ▶ method _build__synclines { return false }
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine _build__synclines: not called CC=2 SCAR=8.0
Subroutine __ANON__: called CC=1 SCAR=0.6
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
1119  
1120 # =========================
1121 # --gnu
1122 # =========================
1123 2 option gnu => (
1124 is => 'rw',
1125 isa => Bool,
1126 negativable => 1,
1127 short => 'g',
1128 trigger => 1,
1129 doc =>
1130 q{Enable all extensions. Option is negativable with '--no-' prefix.}
1131 );
1132  
1133 2 has _no_gnu_extensions => (
1134 is => 'rwp',
1135 lazy => 1,
1136 builder => 1,
1137 isa => Bool
1138 );
1139  
1140 0 ▶ method _trigger_gnu (Bool $gnu, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_gnu: not called CC=7 SCAR=29.3
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Bool($gnu) or _failed_check(3, "Bool", $gnu, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1141 0 $self->_set__no_gnu_extensions( !$gnu );
1142 0 return;
1143 }
1144 2 ▶ method _build__no_gnu_extensions {false}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__no_gnu_extensions: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 137 0 137
1145  
1146 # =========================
1147 # --traditional
1148 # =========================
1149 2 option traditional => (
1150 is => 'rw',
1151 isa => Bool,
1152 negativable => 1,
1153 short => 'G',
1154 trigger => 1,
1155 doc =>
1156 q{Suppress all extensions. Option is negativable with '--no-' prefix.}
1157 );
1158  
1159 2 ▶ method _trigger_traditional (Bool $traditional, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger_traditional: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 1 0 1
if @_ < 1 0 1 1
$#_ >= 0 ? : 1 0 1
if ($#_ >= 0) 1 0 1
Type::Tiny::XS::Bool($traditional) or _failed_check(3, "Bool", $traditional, "exception_class", "Error::TypeTiny::Assertion") 1 0 1
$#_ >= 1 ? : 0 1 1
1160 1 $self->_set__no_gnu_extensions($traditional);
1161 1 return;
1162 }
1163  
1164 # =========================
1165 # --debugmode
1166 # =========================
1167 2 our @DEBUG_FLAGS = qw/a c e f i l p q t x/;
1168 2 our @DEFAULT_DEBUG_FLAGS = qw/a e q/;
1169 2 option debug => (
1170 is => 'rw',
1171 isa => Str,
1172 trigger => 1,
1173 format => 's',
1174 short => 'd',
1175 doc => 'Debug mode. This is a combinaison of flags, that can be: "'
1176 . join( '", "', @DEBUG_FLAGS )
1177 . '", or "V" wich will put everything on. Default: "'
1178 . join( '', @DEFAULT_DEBUG_FLAGS ) . '".'
1179 );
1180  
1181 2 has _debug => (
1182 is => 'rwp',
1183 lazy => 1,
1184 builder => 1,
1185 isa => HashRef [Bool],
1186 handles_via => 'Hash',
1187 handles => {
1188 _debug_set => 'set',
1189 _debug_get => 'get',
1190 _debug_exists => 'exists',
1191 _debug_keys => 'keys',
1192 _debug_delete => 'delete'
1193 }
1194 );
1195  
1196 0 ▶ method _trigger_debug (Str $flags, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_debug: not called CC=13 SCAR=45.8
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($flags) or _failed_check(9, "Str", $flags, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1197  
1198 0 map { $self->_debug_set( $_, false ) } @DEBUG_FLAGS;
1199  
1200 0 ▶ if ( length($flags) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $flags <= 0) { } 0 0 0
1201 0 map { $self->_debug_set( $_, true ) } @DEFAULT_DEBUG_FLAGS;
1202 }
1203 else {
1204 #
1205 # Only know debug flags are accepted
1206 #
1207 0 my $ok = 1;
1208 0 my @flags = split( //, $flags );
1209 0 foreach ( @flags, 'V' ) {
1210 0 ▶ if ( !$self->_debug_exists($_) && $_ ne 'V' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->_debug_exists($_) and $_ ne "V") 0 0 0
Condition0%0/3
not $self->_debug_exists($_) and $_ ne "V"
!ll&&!rl&&r
000
MC/DC0%0/2
not $self->_debug_exists($_) and $_ ne "V"
not $self->_debug_exists($_) $_ ne "V"
Truth table0%0/3
not(A) and B
A= not $self->_debug_exists($_)B= $_ ne "V"
ABresult
0X0
100
111
1211 0 $self->logger_warn( '%s: unknown debug flag: %c',
1212 'debugmode', $_ );
1213 0 $ok = 0;
1214 0 last;
1215 }
1216 }
1217 0 ▶ if ( !$ok ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ok) 0 0 0
1218 0 return;
1219 }
1220 0 ▶ if ( index( $flags, 'V' ) >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($flags, 'V') != -1) { } 0 0 0
1221 #
1222 # Everything is on
1223 #
1224 0 map { $self->_debug_set( $_, true ) } @DEBUG_FLAGS;
1225 }
1226 else {
1227 0 map { $self->_debug_set( $_, false ) } @DEBUG_FLAGS;
1228 0 map { $self->_debug_set( $_, true ) } @flags;
1229 }
1230 }
1231  
1232 0 return;
1233 }
1234  
1235 2 ▶ method _build__debug {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__debug: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 138 0 138
1236 138 my %ref = ();
1237 138 map { $ref{$_} = false } @DEBUG_FLAGS;
1238 138 map { $ref{$_} = true } @DEFAULT_DEBUG_FLAGS;
1239 138 return \%ref;
1240 }
1241  
1242 # =========================
1243 # --nesting_limit
1244 # =========================
1245 2 our $DEFAULT_NESTING_LIMIT = 1024;
1246 2 option nesting_limit => (
1247 is => 'rw',
1248 isa => PositiveOrZeroInt,
1249 trigger => 1,
1250 format => 'i',
1251 short => 'L',
1252 doc =>
1253 q{Should artificially limit the nesting of macro calls to num levels, stopping program execution if this limit is ever exceeded. This option is supported but has no effect. Must be a positive or zero integer. Default is 1024.}
1254 );
1255  
1256 2 has _nesting_limit => (
1257 is => 'rwp',
1258 lazy => 1,
1259 builder => 1,
1260 isa => PositiveOrZeroInt
1261 );
1262  
1263 0 ▶ method _trigger_nesting_limit (PositiveOrZeroInt $nesting_limit, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_nesting_limit: not called CC=7 SCAR=29.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::PositiveOrZeroInt($nesting_limit) or _failed_check(48, "PositiveOrZeroInt", $nesting_limit, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1264 0 $self->_set__nesting_limit($nesting_limit);
1265 }
1266  
1267 0 ▶ method _build__nesting_limit {$DEFAULT_NESTING_LIMIT}
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine _build__nesting_limit: not called CC=2 SCAR=8.0
Subroutine __ANON__: called CC=1 SCAR=0.6
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
1268  
1269 # =========================
1270 # --debugfile
1271 # =========================
1272 2 our $DEFAULT_DEBUGFILE = undef;
1273 2 option debugfile => (
1274 is => 'rw',
1275 isa => Str,
1276 trigger => 1,
1277 format => 's',
1278 short => 'o',
1279 doc =>
1280 q{Debug file. An empty value disable debug output. A null value redirects to standard error. Default is a null value.}
1281 );
1282  
1283 2 has _debugfile => (
1284 is => 'rwp',
1285 lazy => 1,
1286 builder => 1,
1287 isa => Undef | Str,
1288 );
1289  
1290 0 ▶ method _trigger_debugfile (Str $debugfile, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_debugfile: not called CC=7 SCAR=29.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($debugfile) or _failed_check(9, "Str", $debugfile, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1291 0 $self->_set__debugfile($debugfile);
1292 }
1293  
1294 2 ▶ method _build__debugfile {$DEFAULT_DEBUGFILE}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__debugfile: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 2 0 2
1295  
1296 # =========================
1297 # --quote-start
1298 # =========================
1299 2 our $DEFAULT_QUOTE_START = '`';
1300 2 option quote_start => (
1301 is => 'rw',
1302 isa => Str,
1303 trigger => 1,
1304 format => 's',
1305 doc =>
1306 "Quote start. An empty option value is ignored. Default: \"$DEFAULT_QUOTE_START\"."
1307 );
1308  
1309 2 has _quote_start => (
1310 is => 'rwp',
1311 lazy => 1,
1312 builder => 1,
1313 trigger => 1,
1314 isa => Str,
1315 );
1316  
1317 2 has _quoteStartLength => (
1318 is => 'rwp',
1319 lazy => 1,
1320 builder => 1,
1321 isa => PositiveOrZeroInt
1322 );
1323  
1324 0 ▶ method _trigger_quote_start (Str $quote_start, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_quote_start: not called CC=8 SCAR=32.1
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($quote_start) or _failed_check(9, "Str", $quote_start, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1325 0 ▶ if ( length($quote_start) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $quote_start > 0) 0 0 0
1326 0 $self->_set__quote_start($quote_start);
1327 }
1328 }
1329  
1330 2 ▶ method _trigger__quote_start (Str $quote_start, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger__quote_start: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 23 0 23
if @_ < 1 0 23 23
$#_ >= 0 ? : 23 0 23
if ($#_ >= 0) 23 0 23
Type::Tiny::XS::Str($quote_start) or _failed_check(9, "Str", $quote_start, "exception_class", "Error::TypeTiny::Assertion") 23 0 23
$#_ >= 1 ? : 0 23 23
1331 23 $self->_set__quoteStartLength( length($quote_start) );
1332 }
1333  
1334 2 ▶ method _build__quote_start {$DEFAULT_QUOTE_START}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__quote_start: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 139 0 139
1335 2 ▶ method _build__quoteStartLength { length($DEFAULT_QUOTE_START) }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__quoteStartLength: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 139 0 139
1336  
1337 # =========================
1338 # --quote-end
1339 # =========================
1340 2 our $DEFAULT_QUOTE_END = '\'';
1341 2 option quote_end => (
1342 is => 'rw',
1343 isa => Str,
1344 trigger => 1,
1345 format => 's',
1346 doc =>
1347 "Quote end. An empty option value is ignored. Default: \"$DEFAULT_QUOTE_END\"."
1348 );
1349  
1350 2 has _quote_end => (
1351 is => 'rwp',
1352 lazy => 1,
1353 builder => 1,
1354 trigger => 1,
1355 isa => Str,
1356 );
1357  
1358 2 has _quoteEndLength => (
1359 is => 'rwp',
1360 lazy => 1,
1361 builder => 1,
1362 isa => PositiveOrZeroInt
1363 );
1364  
1365 0 ▶ method _trigger_quote_end (Str $quote_end, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_quote_end: not called CC=8 SCAR=32.1
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($quote_end) or _failed_check(9, "Str", $quote_end, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1366 0 ▶ if ( length($quote_end) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $quote_end > 0) 0 0 0
1367 0 $self->_set__quote_end($quote_end);
1368 }
1369 }
1370  
1371 2 ▶ method _trigger__quote_end (Str $quote_end, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger__quote_end: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 23 0 23
if @_ < 1 0 23 23
$#_ >= 0 ? : 23 0 23
if ($#_ >= 0) 23 0 23
Type::Tiny::XS::Str($quote_end) or _failed_check(9, "Str", $quote_end, "exception_class", "Error::TypeTiny::Assertion") 23 0 23
$#_ >= 1 ? : 0 23 23
1372 23 $self->_set__quoteEndLength( length($quote_end) );
1373 }
1374  
1375 2 ▶ method _build__quote_end {$DEFAULT_QUOTE_END}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__quote_end: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 139 0 139
1376 2 ▶ method _build__quoteEndLength { length($DEFAULT_QUOTE_END) }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__quoteEndLength: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 139 0 139
1377  
1378 # =========================
1379 # --comment-start
1380 # =========================
1381 2 our $DEFAULT_COMMENT_START = '#';
1382 2 option comment_start => (
1383 is => 'rw',
1384 isa => Str,
1385 trigger => 1,
1386 format => 's',
1387 doc =>
1388 "Comment start. An empty option value is ignored. Default: \"$DEFAULT_COMMENT_START\"."
1389 );
1390  
1391 2 has _comment_start => (
1392 is => 'rwp',
1393 lazy => 1,
1394 builder => 1,
1395 trigger => 1,
1396 isa => Str,
1397 );
1398  
1399 2 has _commentStartLength => (
1400 is => 'rwp',
1401 lazy => 1,
1402 builder => 1,
1403 isa => PositiveOrZeroInt
1404 );
1405  
1406 0 ▶ method _trigger_comment_start (Str $comment_start, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_comment_start: not called CC=8 SCAR=32.1
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($comment_start) or _failed_check(9, "Str", $comment_start, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1407 0 ▶ if ( length($comment_start) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $comment_start > 0) 0 0 0
1408 0 $self->_set__comment_start($comment_start);
1409 }
1410 }
1411  
1412 2 ▶ method _trigger__comment_start (Str $comment_start, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger__comment_start: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 16 0 16
if @_ < 1 0 16 16
$#_ >= 0 ? : 16 0 16
if ($#_ >= 0) 16 0 16
Type::Tiny::XS::Str($comment_start) or _failed_check(9, "Str", $comment_start, "exception_class", "Error::TypeTiny::Assertion") 16 0 16
$#_ >= 1 ? : 0 16 16
1413 16 $self->_set__commentStartLength( length($comment_start) );
1414 }
1415  
1416 2 ▶ method _build__comment_start {$DEFAULT_COMMENT_START}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__comment_start: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 139 0 139
1417  
1418 139 ▶ sub _build__commentStartLength {
Subroutine _build__commentStartLength: called CC=1 SCAR=0.0
1419 139 return length($DEFAULT_COMMENT_START);
1420 }
1421  
1422 # =========================
1423 # --comment-end
1424 # =========================
1425 2 our $DEFAULT_COMMENT_END = "\n";
1426 2 option comment_end => (
1427 is => 'rw',
1428 isa => Str,
1429 trigger => 1,
1430 format => 's',
1431 doc =>
1432 "Comment end. An empty option value is ignored. Default value: the newline character."
1433 );
1434  
1435 2 has _comment_end => (
1436 is => 'rwp',
1437 lazy => 1,
1438 builder => 1,
1439 trigger => 1,
1440 isa => Str,
1441 );
1442  
1443 2 has _commentEndLength => (
1444 is => 'rwp',
1445 lazy => 1,
1446 builder => 1,
1447 isa => PositiveOrZeroInt
1448 );
1449  
1450 0 ▶ method _trigger_comment_end (Str $comment_end, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_comment_end: not called CC=8 SCAR=32.1
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($comment_end) or _failed_check(9, "Str", $comment_end, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1451 0 ▶ if ( length($comment_end) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $comment_end > 0) 0 0 0
1452 0 $self->_set__comment_end($comment_end);
1453 }
1454 }
1455  
1456 2 ▶ method _trigger__comment_end (Str $comment_end, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger__comment_end: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 16 0 16
if @_ < 1 0 16 16
$#_ >= 0 ? : 16 0 16
if ($#_ >= 0) 16 0 16
Type::Tiny::XS::Str($comment_end) or _failed_check(9, "Str", $comment_end, "exception_class", "Error::TypeTiny::Assertion") 16 0 16
$#_ >= 1 ? : 0 16 16
1457 16 $self->_set__commentEndLength( length($comment_end) );
1458 }
1459  
1460 2 ▶ method _build__comment_end {$DEFAULT_COMMENT_END}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__comment_end: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 139 0 139
1461 2 ▶ method _build__commentEndLength { length($DEFAULT_COMMENT_END) }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__commentEndLength: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 139 0 139
1462  
1463 # =========================
1464 # --word-regexp
1465 # =========================
1466 #
1467 # Note: it appears that the default regexp works with both perl and GNU Emacs engines
1468 #
1469 2 our $DEFAULT_WORD_REGEXP = '[_a-zA-Z][_a-zA-Z0-9]*';
1470 2 option word_regexp => (
1471 is => 'rw',
1472 isa => Str,
1473 trigger => 1,
1474 format => 's',
1475 short => 'W',
1476 doc =>
1477 "Word regular expression. Default: \"$DEFAULT_WORD_REGEXP\" (equivalent between perl and GNU Emacs engines)."
1478 );
1479  
1480 2 has _word_regexp => (
1481 is => 'rwp',
1482 lazy => 1,
1483 builder => 1,
1484 isa => Str
1485 );
1486  
1487 2 has _regexp_word => (
1488 is => 'rwp',
1489 lazy => 1,
1490 builder => 1,
1491 isa => InstanceOf [M4Regexp]
1492 );
1493  
1494 2 has _regexp_isDefault => (
1495 is => 'rwp',
1496 default => true,
1497 isa => Bool
1498 );
1499  
1500 2 ▶ method _trigger_word_regexp (Str $regexpString, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger_word_regexp: called CC=11 SCAR=25.0
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 11 0 11
if @_ < 1 0 11 11
$#_ >= 0 ? : 11 0 11
if ($#_ >= 0) 11 0 11
Type::Tiny::XS::Str($regexpString) or _failed_check(9, "Str", $regexpString, "exception_class", "Error::TypeTiny::Assertion") 11 0 11
$#_ >= 1 ? : 0 11 11
1501 11 ▶ if ( length($regexpString) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $regexpString <= 0) 0 11 11
1502 0 $regexpString = $DEFAULT_WORD_REGEXP;
1503 }
1504 #
1505 # Check it compiles.
1506 # If $regexpString is $DEFAULT_WORD_REGEXP we force the perl
1507 # mode because:
1508 # - regexp is the same between perl and re::engine::GNU
1509 # - perl version is (much faster)
1510 #
1511 11 ▶ my $regexp_type
Branch: 1 branch
BranchTrueFalseTotal
$regexpString eq $MarpaX::Languages::M4::Impl::Default::DEFAULT_WORD_REGEXP ? : 0 11 11
1512 = ( $regexpString eq $DEFAULT_WORD_REGEXP )
1513 ? 'perl'
1514 : $self->_regexp_type;
1515 11 my $r = MarpaX::Languages::M4::Impl::Regexp->new();
1516 11 ▶ if ( $r->regexp_compile( $self, $regexp_type, $regexpString ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_compile($self, $regexp_type, $regexpString)) 11 0 11
1517 11 $self->_set__word_regexp($regexpString);
1518 11 $self->_set__regexp_word($r);
1519 }
1520 $self->_set__regexp_isDefault(
1521 11 ▶ ( $regexpString eq $DEFAULT_WORD_REGEXP ) ? true : false );
Branch: 1 branch
BranchTrueFalseTotal
$regexpString eq $MarpaX::Languages::M4::Impl::Default::DEFAULT_WORD_REGEXP ? : 0 11 11
1522  
1523 11 return;
1524 }
1525  
1526 #
1527 # Why perltidier does not like it without @args ?
1528 #
1529 2 ▶ method _build__word_regexp (@args) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__word_regexp: called CC=3 SCAR=11.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 139 0 139
$#_ >= 0 ? : 0 139 139
1530 139 return $DEFAULT_WORD_REGEXP;
1531 }
1532  
1533 2 ▶ method _build__regexp_word (@args) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__regexp_word: called CC=4 SCAR=14.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 139 0 139
$#_ >= 0 ? : 0 139 139
1534 139 my $r = MarpaX::Languages::M4::Impl::Regexp->new();
1535 139 ▶ my $regexp_type
Branch: 1 branch
BranchTrueFalseTotal
$self->_word_regexp eq $MarpaX::Languages::M4::Impl::Default::DEFAULT_WORD_REGEXP ? : 139 0 139
1536 = ( $self->_word_regexp eq $DEFAULT_WORD_REGEXP )
1537 ? 'perl'
1538 : $self->_regexp_type;
1539 139 $r->regexp_compile( $self, $regexp_type, $self->_word_regexp );
1540 139 return $r;
1541 }
1542  
1543 # ============================
1544 # --warn-macro-sequence-regexp
1545 # ============================
1546 2 our $DEFAULT_WARN_MACRO_SEQUENCE_REGEXP_GNU
1547 = '\$\({[^}]*}\|[0-9][0-9]+\)';
1548 2 our $DEFAULT_WARN_MACRO_SEQUENCE_REGEXP_PERL
1549 = '\$(\{[^\}]*\}|[0-9][0-9]+)';
1550 2 option warn_macro_sequence_regexp => (
1551 is => 'rw',
1552 isa => Str,
1553 trigger => 1,
1554 format => 's',
1555 doc =>
1556 "Regexp used to trigger a warning in macro definition when --warn-macro-sequence option is setted. Take care, the option value will have to obey current --regex-type (i.e. perl or GNU Emacs syntax). Perl default: \"$DEFAULT_WARN_MACRO_SEQUENCE_REGEXP_PERL\", GNU default: \"$DEFAULT_WARN_MACRO_SEQUENCE_REGEXP_GNU\"."
1557 );
1558  
1559 2 has _warn_macro_sequence_regexp => (
1560 is => 'rwp',
1561 lazy => 1,
1562 builder => 1,
1563 isa => M4Regexp
1564 );
1565  
1566 2 ▶ method _build__warn_macro_sequence_regexp {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__warn_macro_sequence_regexp: called CC=3 SCAR=11.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 1 0 1
1567 1 ▶ my $regexpString
Branch: 1 branch
BranchTrueFalseTotal
$self->_regexp_type eq 'GNU' ? : 1 0 1
1568 = ( $self->_regexp_type eq 'GNU' )
1569 ? $DEFAULT_WARN_MACRO_SEQUENCE_REGEXP_GNU
1570 : $DEFAULT_WARN_MACRO_SEQUENCE_REGEXP_PERL;
1571 1 my $r = MarpaX::Languages::M4::Impl::Regexp->new();
1572 1 $r->regexp_compile( $self, $self->_regexp_type, $regexpString );
1573 1 return $r;
1574 }
1575  
1576 0 ▶ method _trigger_warn_macro_sequence_regexp (Str $regexpString, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine BEGIN: called CC=1 SCAR=2.0
Subroutine _trigger_warn_macro_sequence_regexp: not called CC=8 SCAR=32.7
Subroutine __ANON__: called CC=1 SCAR=2.0
Subroutine __ANON__: called CC=1 SCAR=2.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($regexpString) or _failed_check(9, "Str", $regexpString, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
1577 #
1578 # Check it compiles
1579 #
1580 0 my $r = MarpaX::Languages::M4::Impl::Regexp->new();
1581 0 ▶ if ( $r->regexp_compile( $self, $self->_regexp_type, $regexpString ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_compile($self, $self->_regexp_type, $regexpString)) 0 0 0
1582 {
1583 0 $self->_set__warn_macro_sequence_regexp($r);
1584 }
1585 0 return;
1586 }
1587  
1588 # =========================
1589 # --warn-macro-sequence
1590 # =========================
1591 2 our $DEFAULT_WARN_MACRO_SEQUENCE = false;
1592 2 option warn_macro_sequence => (
1593 is => 'rw',
1594 isa => Bool,
1595 default => false,
1596 trigger => 1,
1597 doc =>
1598 "Issue a warning if a macro defined via builtins define or pushdef is matching the regexp setted via --warn-macro-sequence-regexp option value. This is option is negativable. Default: a false value."
1599 );
1600  
1601 2 has _warn_macro_sequence => (
1602 is => 'rwp',
1603 lazy => 1,
1604 builder => 1,
1605 isa => Bool
1606 );
1607  
1608 2 ▶ method _trigger_warn_macro_sequence (Bool $bool, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger_warn_macro_sequence: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 1 0 1
if @_ < 1 0 1 1
$#_ >= 0 ? : 1 0 1
if ($#_ >= 0) 1 0 1
Type::Tiny::XS::Bool($bool) or _failed_check(3, "Bool", $bool, "exception_class", "Error::TypeTiny::Assertion") 1 0 1
$#_ >= 1 ? : 0 1 1
1609 1 $self->_set__warn_macro_sequence($bool);
1610 1 return;
1611 }
1612  
1613 2 ▶ method _build__warn_macro_sequence {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__warn_macro_sequence: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 94 0 94
1614 94 return $DEFAULT_WARN_MACRO_SEQUENCE;
1615 }
1616  
1617 # ---------------------------------------------------------------
1618 # PARSER REQUIRED METHODS
1619 # ---------------------------------------------------------------
1620  
1621 2 ▶ method parser_isWord (Str $input, PositiveOrZeroInt $pos, PositiveOrZeroInt $maxPos, Ref $lexemeValueRef, Ref $lexemeLengthRef --> Bool) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine parser_isWord: called CC=26 SCAR=33.2
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 17 branches
BranchTrueFalseTotal
@_ ? : 15088 0 15088
if @_ != 5 0 15088 15088
$#_ >= 0 ? : 15088 0 15088
if ($#_ >= 0) 15088 0 15088
Type::Tiny::XS::Str($input) or _failed_check(9, "Str", $input, "exception_class", "Error::TypeTiny::Assertion") 15088 0 15088
$#_ >= 1 ? : 15088 0 15088
if ($#_ >= 1) 15088 0 15088
Type::Tiny::XS::PositiveOrZeroInt($pos) or _failed_check(48, "PositiveOrZeroInt", $pos, "exception_class", "Error::TypeTiny::Assertion") 15088 0 15088
$#_ >= 2 ? : 15088 0 15088
if ($#_ >= 2) 15088 0 15088
Type::Tiny::XS::PositiveOrZeroInt($maxPos) or _failed_check(48, "PositiveOrZeroInt", $maxPos, "exception_class", "Error::TypeTiny::Assertion") 15088 0 15088
$#_ >= 3 ? : 15088 0 15088
if ($#_ >= 3) 15088 0 15088
not ref $lexemeValueRef and _failed_check(16, "Ref", $lexemeValueRef, "exception_class", "Error::TypeTiny::Assertion") 0 15088 15088
$#_ >= 4 ? : 15088 0 15088
if ($#_ >= 4) 15088 0 15088
not ref $lexemeLengthRef and _failed_check(16, "Ref", $lexemeLengthRef, "exception_class", "Error::TypeTiny::Assertion") 0 15088 15088
1622  
1623 15088 my $r = $self->_regexp_word;
1624 15088 ▶ if ( $r->regexp_exec( $self, $input, $pos ) == $pos ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_exec($self, $input, $pos) == $pos) 3091 11997 15088
1625 3091 my $lposp = $r->regexp_lpos;
1626 3091 my $rposp = $r->regexp_rpos;
1627 3091 my $lpos;
1628 my $lposFull;
1629 3091 my $rpos;
1630 3091 my $rposFull;
1631  
1632 3091 ▶ if ( $#{$lposp} > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($#{$lposp;} > 0) { } 12 3079 3091
1633 12 $lpos = $lposp->[1];
1634 12 $rpos = $rposp->[1];
1635 12 ▶ if ( $rpos <= $lpos ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rpos <= $lpos) { } 0 12 12
1636 0 $lpos = $lposFull = $lposp->[0];
1637 0 $rpos = $rposFull = $rposp->[0];
1638 }
1639 else {
1640 12 $lposFull = $lposp->[0];
1641 12 $rposFull = $rposp->[0];
1642 }
1643 }
1644 else {
1645 3079 $lpos = $lposFull = $lposp->[0];
1646 3079 $rpos = $rposFull = $rposp->[0];
1647 }
1648  
1649 3091 my $lexemeLength = $rposFull - $lposFull;
1650 3091 my $lexemeValue = substr( $input, $lpos, $rpos - $lpos );
1651  
1652 #
1653 # There is an internal limitation:
1654 # if a regexp matches on characters abcdef,
1655 # then it must also match on a, ab, ..., abcde
1656 #
1657 #
1658 # Nevertheless we can bypass this horrible cost in one specific case:
1659 # the default value. We know that the default regexp is: [_a-zA-Z][_a-zA-Z0-9]*
1660 # i.e. per def when there is a match we /know/ it matches also character per
1661 # character.
1662 #
1663 # This can also be disabled with the option --no-changeword-is-character-per-character
1664 #
1665 3091 ▶ if ( $self->_changeword_is_character_per_character
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_changeword_is_character_per_character and not $self->_regexp_isDefault and $lexemeLength > 1) 19 3072 3091
Condition100%6/6
$self->_changeword_is_character_per_character and not $self->_regexp_isDefault and $lexemeLength > 1
!ll&&!rl&&r
3070219
$self->_changeword_is_character_per_character and not $self->_regexp_isDefault
!ll&&!rl&&r
14305621
MC/DC100%3/3
$self->_changeword_is_character_per_character and not $self->_regexp_isDefault and $lexemeLength > 1
$self->_changeword_is_character_per_character not $self->_regexp_isDefault $lexemeLength > 1
Truth table100%4/4
A and not(B) and C
A= $self->_changeword_is_character_per_characterB= not $self->_regexp_isDefaultC= $lexemeLength > 1
ABCresult
0XX0
10X0
1100
1111
1666 && !$self->_regexp_isDefault
1667 &&
1668 #
1669 # No need to check character per character if the length that matched
1670 # (and not the captured group, eventually) is one character exactly
1671 #
1672 $lexemeLength > 1
1673 )
1674 {
1675 19 my $lengthFull = $rposFull - $lposFull;
1676 19 foreach ( 1 .. $lengthFull - 1 ) {
1677 61 my $substring = substr( $input, $lposFull, $_ );
1678 61 ▶ if ( $r->regexp_exec( $self, $substring, 0 ) != 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_exec($self, $substring, 0) != 0) 2 59 61
1679 2 return false;
1680 }
1681 }
1682 }
1683 3089 ${$lexemeLengthRef} = $lexemeLength;
1684 3089 ${$lexemeValueRef} = $lexemeValue;
1685 3089 return true;
1686 }
1687  
1688 11997 return false;
1689 }
1690  
1691 2 ▶ method parser_isComment (Str $input, PositiveOrZeroInt $pos, PositiveOrZeroInt $maxPos, Ref $lexemeValueRef, Ref $lexemeLengthRef --> Bool) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine parser_isComment: called CC=24 SCAR=32.5
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 17 branches
BranchTrueFalseTotal
@_ ? : 23996 0 23996
if @_ != 5 0 23996 23996
$#_ >= 0 ? : 23996 0 23996
if ($#_ >= 0) 23996 0 23996
Type::Tiny::XS::Str($input) or _failed_check(9, "Str", $input, "exception_class", "Error::TypeTiny::Assertion") 23996 0 23996
$#_ >= 1 ? : 23996 0 23996
if ($#_ >= 1) 23996 0 23996
Type::Tiny::XS::PositiveOrZeroInt($pos) or _failed_check(48, "PositiveOrZeroInt", $pos, "exception_class", "Error::TypeTiny::Assertion") 23996 0 23996
$#_ >= 2 ? : 23996 0 23996
if ($#_ >= 2) 23996 0 23996
Type::Tiny::XS::PositiveOrZeroInt($maxPos) or _failed_check(48, "PositiveOrZeroInt", $maxPos, "exception_class", "Error::TypeTiny::Assertion") 23996 0 23996
$#_ >= 3 ? : 23996 0 23996
if ($#_ >= 3) 23996 0 23996
not ref $lexemeValueRef and _failed_check(16, "Ref", $lexemeValueRef, "exception_class", "Error::TypeTiny::Assertion") 0 23996 23996
$#_ >= 4 ? : 23996 0 23996
if ($#_ >= 4) 23996 0 23996
not ref $lexemeLengthRef and _failed_check(16, "Ref", $lexemeLengthRef, "exception_class", "Error::TypeTiny::Assertion") 0 23996 23996
1692  
1693 #
1694 # We want to catch EOF in comment. So we do it ourself.
1695 #
1696 23996 my $comStart = $self->_comment_start;
1697 23996 my $comEnd = $self->_comment_end;
1698 23996 my $commentStartLength = $self->_commentStartLength;
1699 23996 my $commentEndLength = $self->_commentEndLength;
1700 23996 ▶ if ( $commentStartLength > 0 && $commentEndLength > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($commentStartLength > 0 and $commentEndLength > 0) 23916 80 23996
Condition66%2/3
$commentStartLength > 0 and $commentEndLength > 0
!ll&&!rl&&r
80023916
MC/DC50%1/2
$commentStartLength > 0 and $commentEndLength > 0
$commentStartLength > 0 $commentEndLength > 0
Truth table66%2/3
A and B
A= $commentStartLength > 0B= $commentEndLength > 0
ABresult
0X0
100
111
1701  
1702 23916 ▶ if ( substr( $input, $pos, $commentStartLength ) eq $comStart ) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($input, $pos, $commentStartLength) eq $comStart) 81 23835 23916
1703 81 my $lastPos = $pos + $commentStartLength;
1704 81 ▶ while ( $lastPos <= $maxPos ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lastPos <= $maxPos) 3075 2 3077
1705 3075 ▶ if ( substr( $input, $lastPos, $commentEndLength ) eq $comEnd ) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($input, $lastPos, $commentEndLength) eq $comEnd) { } 79 2996 3075
1706 79 $lastPos += $commentEndLength;
1707 79 ${$lexemeLengthRef} = $lastPos - $pos;
1708 79 ${$lexemeValueRef}
1709 79 = substr( $input, $pos, ${$lexemeLengthRef} );
1710 79 return true;
1711 }
1712 else {
1713 2996 ++$lastPos;
1714 }
1715 }
1716 #
1717 # If we are here, it is an error if End-Of-Input is flagged
1718 #
1719 2 ▶ if ( $self->_eof ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_eof) 2 0 2
1720 2 $self->impl_raiseException('EOF in comment');
1721 }
1722 }
1723 }
1724 23915 return false;
1725 }
1726  
1727 2 ▶ method parser_isQuotedstring (Str $input, PositiveOrZeroInt $pos, PositiveOrZeroInt $maxPos, Ref $lexemeValueRef, Ref $lexemeLengthRef --> Bool) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine parser_isQuotedstring: called CC=26 SCAR=33.2
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 17 branches
BranchTrueFalseTotal
@_ ? : 21736 0 21736
if @_ != 5 0 21736 21736
$#_ >= 0 ? : 21736 0 21736
if ($#_ >= 0) 21736 0 21736
Type::Tiny::XS::Str($input) or _failed_check(9, "Str", $input, "exception_class", "Error::TypeTiny::Assertion") 21736 0 21736
$#_ >= 1 ? : 21736 0 21736
if ($#_ >= 1) 21736 0 21736
Type::Tiny::XS::PositiveOrZeroInt($pos) or _failed_check(48, "PositiveOrZeroInt", $pos, "exception_class", "Error::TypeTiny::Assertion") 21736 0 21736
$#_ >= 2 ? : 21736 0 21736
if ($#_ >= 2) 21736 0 21736
Type::Tiny::XS::PositiveOrZeroInt($maxPos) or _failed_check(48, "PositiveOrZeroInt", $maxPos, "exception_class", "Error::TypeTiny::Assertion") 21736 0 21736
$#_ >= 3 ? : 21736 0 21736
if ($#_ >= 3) 21736 0 21736
not ref $lexemeValueRef and _failed_check(16, "Ref", $lexemeValueRef, "exception_class", "Error::TypeTiny::Assertion") 0 21736 21736
$#_ >= 4 ? : 21736 0 21736
if ($#_ >= 4) 21736 0 21736
not ref $lexemeLengthRef and _failed_check(16, "Ref", $lexemeLengthRef, "exception_class", "Error::TypeTiny::Assertion") 0 21736 21736
1728  
1729 #
1730 # We cannot rely on a balanced regexp a-la-Regexp::Common
1731 # because if end-string is a prefix of start-string, it has precedence
1732 #
1733 21736 my $quoteStart = $self->_quote_start;
1734 21736 my $quoteEnd = $self->_quote_end;
1735 21736 my $quoteStartLength = $self->_quoteStartLength;
1736 21736 my $quoteEndLength = $self->_quoteEndLength;
1737 21736 ▶ if ( $quoteStartLength > 0 && $quoteEndLength > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($quoteStartLength > 0 and $quoteEndLength > 0) 21716 20 21736
Condition66%2/3
$quoteStartLength > 0 and $quoteEndLength > 0
!ll&&!rl&&r
20021716
MC/DC50%1/2
$quoteStartLength > 0 and $quoteEndLength > 0
$quoteStartLength > 0 $quoteEndLength > 0
Truth table66%2/3
A and B
A= $quoteStartLength > 0B= $quoteEndLength > 0
ABresult
0X0
100
111
1738  
1739 21716 ▶ if ( substr( $input, $pos, $quoteStartLength ) eq $quoteStart ) {
Branch: 1 branch
BranchTrueFalseTotal
if (substr($input, $pos, $quoteStartLength) eq $quoteStart) 4394 17322 21716
1740 4394 my $nested = 0;
1741 4394 my $lastPos = $pos + $quoteStartLength;
1742 4394 ▶ while ( $lastPos <= $maxPos ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lastPos <= $maxPos) 48304 2 48306
1743 48304 ▶ if (substr( $input, $lastPos, $quoteEndLength ) eq
Branch: 2 branches
BranchTrueFalseTotal
if (substr($input, $lastPos, $quoteEndLength) eq $quoteEnd) { } 7218 41086 48304
elsif (substr($input, $lastPos, $quoteStartLength) eq $quoteStart) { } 2826 38260 41086
1744 $quoteEnd )
1745 {
1746 7218 $lastPos += $quoteEndLength;
1747 7218 ▶ if ( $nested == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($nested == 0) { } 4392 2826 7218
1748 4392 ${$lexemeLengthRef} = $lastPos - $pos;
1749 4392 ${$lexemeValueRef} = $self->impl_unquote(
1750 4392 substr( $input, $pos, ${$lexemeLengthRef} ) );
1751 4392 return true;
1752 }
1753 else {
1754 2826 $nested--;
1755 }
1756 }
1757 elsif (
1758 substr( $input, $lastPos, $quoteStartLength ) eq
1759 $quoteStart )
1760 {
1761 2826 $lastPos += $quoteStartLength;
1762 2826 $nested++;
1763 }
1764 else {
1765 38260 ++$lastPos;
1766 }
1767 }
1768 #
1769 # If we are here, it is an error if End-Of-Input is flagged
1770 #
1771 2 ▶ if ( $self->_eof ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_eof) 2 0 2
1772 2 $self->impl_raiseException('EOF in string');
1773 }
1774 }
1775 }
1776 17342 return false;
1777 }
1778  
1779 2 ▶ method parser_isCharacter (Str $input, PositiveOrZeroInt $pos, PositiveOrZeroInt $maxPos, Ref $lexemeValueRef, Ref $lexemeLengthRef --> Bool) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine parser_isCharacter: called CC=19 SCAR=30.4
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 17 branches
BranchTrueFalseTotal
@_ ? : 7638 0 7638
if @_ != 5 0 7638 7638
$#_ >= 0 ? : 7638 0 7638
if ($#_ >= 0) 7638 0 7638
Type::Tiny::XS::Str($input) or _failed_check(9, "Str", $input, "exception_class", "Error::TypeTiny::Assertion") 7638 0 7638
$#_ >= 1 ? : 7638 0 7638
if ($#_ >= 1) 7638 0 7638
Type::Tiny::XS::PositiveOrZeroInt($pos) or _failed_check(48, "PositiveOrZeroInt", $pos, "exception_class", "Error::TypeTiny::Assertion") 7638 0 7638
$#_ >= 2 ? : 7638 0 7638
if ($#_ >= 2) 7638 0 7638
Type::Tiny::XS::PositiveOrZeroInt($maxPos) or _failed_check(48, "PositiveOrZeroInt", $maxPos, "exception_class", "Error::TypeTiny::Assertion") 7638 0 7638
$#_ >= 3 ? : 7638 0 7638
if ($#_ >= 3) 7638 0 7638
not ref $lexemeValueRef and _failed_check(16, "Ref", $lexemeValueRef, "exception_class", "Error::TypeTiny::Assertion") 0 7638 7638
$#_ >= 4 ? : 7638 0 7638
if ($#_ >= 4) 7638 0 7638
not ref $lexemeLengthRef and _failed_check(16, "Ref", $lexemeLengthRef, "exception_class", "Error::TypeTiny::Assertion") 0 7638 7638
1780 7638 pos($input) = $pos;
1781 7638 ▶ if ( $input =~ /\G./s ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($input =~ /\G./su) 7638 0 7638
1782 7638 ${$lexemeLengthRef} = $+[0] - $-[0];
1783 7638 ${$lexemeValueRef} = substr( $input, $-[0], ${$lexemeLengthRef} );
1784 7638 return true;
1785 }
1786 0 return false;
1787 }
1788  
1789 2 ▶ method _getMacro (Str $word --> M4Macro) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _getMacro: called CC=6 SCAR=18.1
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 2533 0 2533
if @_ != 1 0 2533 2533
$#_ >= 0 ? : 2533 0 2533
if ($#_ >= 0) 2533 0 2533
Type::Tiny::XS::Str($word) or _failed_check(9, "Str", $word, "exception_class", "Error::TypeTiny::Assertion") 2533 0 2533
1790 2533 return $self->_macros_get($word)->macros_get(-1);
1791 }
1792  
1793 2 ▶ method parser_isMacro (Str $input, PositiveOrZeroInt $pos, PositiveOrZeroInt $maxPos, Str $wordValue, PositiveInt $wordLength, Ref $macroRef, Ref $lparenPosRef --> Bool) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine parser_isMacro: called CC=31 SCAR=35.2
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 23 branches
BranchTrueFalseTotal
@_ ? : 3089 0 3089
if @_ != 7 0 3089 3089
$#_ >= 0 ? : 3089 0 3089
if ($#_ >= 0) 3089 0 3089
Type::Tiny::XS::Str($input) or _failed_check(9, "Str", $input, "exception_class", "Error::TypeTiny::Assertion") 3089 0 3089
$#_ >= 1 ? : 3089 0 3089
if ($#_ >= 1) 3089 0 3089
Type::Tiny::XS::PositiveOrZeroInt($pos) or _failed_check(48, "PositiveOrZeroInt", $pos, "exception_class", "Error::TypeTiny::Assertion") 3089 0 3089
$#_ >= 2 ? : 3089 0 3089
if ($#_ >= 2) 3089 0 3089
Type::Tiny::XS::PositiveOrZeroInt($maxPos) or _failed_check(48, "PositiveOrZeroInt", $maxPos, "exception_class", "Error::TypeTiny::Assertion") 3089 0 3089
$#_ >= 3 ? : 3089 0 3089
if ($#_ >= 3) 3089 0 3089
Type::Tiny::XS::Str($wordValue) or _failed_check(9, "Str", $wordValue, "exception_class", "Error::TypeTiny::Assertion") 3089 0 3089
$#_ >= 4 ? : 3089 0 3089
if ($#_ >= 4) 3089 0 3089
Type::Tiny::XS::PositiveInt($wordLength) or _failed_check(47, "PositiveInt", $wordLength, "exception_class", "Error::TypeTiny::Assertion") 3089 0 3089
$#_ >= 5 ? : 3089 0 3089
if ($#_ >= 5) 3089 0 3089
not ref $macroRef and _failed_check(16, "Ref", $macroRef, "exception_class", "Error::TypeTiny::Assertion") 0 3089 3089
$#_ >= 6 ? : 3089 0 3089
if ($#_ >= 6) 3089 0 3089
not ref $lparenPosRef and _failed_check(16, "Ref", $lparenPosRef, "exception_class", "Error::TypeTiny::Assertion") 0 3089 3089
1794  
1795 #
1796 # If a macro with this name exist, we have to check if it is accepted.
1797 # The condition is if it is recognized only with parameters
1798 #
1799 3089 ▶ if ( $self->_macros_exists($wordValue) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_macros_exists($wordValue)) 2443 646 3089
1800 2443 my $macro = $self->_getMacro($wordValue);
1801 2443 my $lparenPos = $pos + $wordLength;
1802 2443 my $dummy;
1803 2443 ▶ my $lparen
Branch: 2 branches
BranchTrueFalseTotal
$self->parser_isQuotedstring($input, $lparenPos, $maxPos, \$dummy, \$dummy) || $self->parser_isComment($input, $lparenPos, $maxPos, \$dummy, \$dummy) ? : 36 2407 2443
$lparenPos <= $maxPos ? : 2399 8 2407
Condition100%3/3
$self->parser_isQuotedstring($input, $lparenPos, $maxPos, \$dummy, \$dummy) or $self->parser_isComment($input, $lparenPos, $maxPos, \$dummy, \$dummy)
l!l&&r!l&&!r
3332407
MC/DC100%2/2
$self->parser_isQuotedstring($input, $lparenPos, $maxPos, \$dummy, \$dummy) or $self->parser_isComment($input, $lparenPos, $maxPos, \$dummy, \$dummy)
$self->parser_isQuotedstring($input, $lparenPos, $maxPos, \$dummy, \$dummy) $self->parser_isComment($input, $lparenPos, $maxPos, \$dummy, \$dummy)
Truth table100%3/3
A or B
A= $self->parser_isQuotedstring($input, $lparenPos, $maxPos, \$dummy, \$dummy)B= $self->parser_isComment($input, $lparenPos, $maxPos, \$dummy, \$dummy)
ABresult
1X1
011
000
1804 = (
1805 $self->parser_isQuotedstring( $input, $lparenPos, $maxPos,
1806 \$dummy, \$dummy )
1807 || $self->parser_isComment(
1808 $input, $lparenPos, $maxPos, \$dummy, \$dummy
1809 )
1810 ) ? ''
1811 : ( $lparenPos <= $maxPos ) ? substr( $input, $lparenPos, 1 )
1812 : '';
1813 2443 ▶ if ( $lparen eq '(' || !$macro->macro_needParams ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lparen eq "(" or not $macro->macro_needParams) 2441 2 2443
Condition100%3/3
$lparen eq "(" or not $macro->macro_needParams
l!l&&r!l&&!r
18545872
MC/DC100%2/2
$lparen eq "(" or not $macro->macro_needParams
$lparen eq "(" not $macro->macro_needParams
Truth table100%3/3
A or not(B)
A= $lparen eq "("B= not $macro->macro_needParams
ABresult
1X1
011
000
1814 2441 ${$macroRef} = $macro;
1815 2441 ▶ ${$lparenPosRef} = ( $lparen eq '(' ) ? $lparenPos : -1;
Branch: 1 branch
BranchTrueFalseTotal
$lparen eq '(' ? : 1854 587 2441
1816 2441 return true;
1817 }
1818 }
1819  
1820 648 return false,;
1821 }
1822  
1823 2 ▶ method parser_tokensPriority {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine parser_tokensPriority: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 2017 0 2017
1824 2017 return $self->_tokens_priority_elements;
1825 }
1826  
1827 # ---------------------------------------------------------------
1828 # LOGGER REQUIRED METHODS
1829 # ---------------------------------------------------------------
1830 2 ▶ method logger_error (@args --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine logger_error: called CC=3 SCAR=11.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 40 0 40
$#_ >= 0 ? : 40 0 40
1831 #
1832 # Localize anyway, because there can be an error within
1833 # new_with_options() -;
1834 #
1835 40 local $MarpaX::Languages::M4::SELF = $self;
1836 40 $self->_logger->errorf(@args);
1837 40 return;
1838 }
1839  
1840 2 ▶ method logger_warn (@args --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine logger_warn: called CC=6 SCAR=18.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 28 0 28
$#_ >= 0 ? : 28 0 28
1841 #
1842 # Localize anyway, because there can be an error within
1843 # new_with_options() -;
1844 #
1845 28 local $MarpaX::Languages::M4::SELF = $self;
1846 28 ▶ if ( !$self->silent ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->silent) 28 0 28
1847 28 $self->_logger->warnf(@args);
1848 }
1849 28 ▶ if ( $self->_fatal_warnings >= 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_fatal_warnings >= 1) 2 26 28
1850 2 $self->_set__rc(EXIT_FAILURE);
1851 }
1852 28 ▶ if ( $self->_fatal_warnings > 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_fatal_warnings > 1) 2 26 28
1853 #
1854 # Say we do not accept more input
1855 #
1856 2 $self->impl_setEoi;
1857 2 $self->impl_raiseException('Warning is fatal');
1858 }
1859 26 return;
1860 }
1861  
1862 2 ▶ method _canDebug (Str $what --> Bool) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _canDebug: called CC=6 SCAR=18.1
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 116 0 116
if @_ != 1 0 116 116
$#_ >= 0 ? : 116 0 116
if ($#_ >= 0) 116 0 116
Type::Tiny::XS::Str($what) or _failed_check(9, "Str", $what, "exception_class", "Error::TypeTiny::Assertion") 116 0 116
1863 #
1864 # A macro is debugged if 't' is setted,
1865 # or if it is explicitely traced
1866 #
1867 116 return $self->_debug_get($what);
1868 }
1869  
1870 2 ▶ method _canTrace (ConsumerOf[M4Macro] $macro --> Bool) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _canTrace: called CC=10 SCAR=24.7
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 2450 0 2450
if @_ != 1 0 2450 2450
$#_ >= 0 ? : 2450 0 2450
if ($#_ >= 0) 2450 0 2450
do { builtin::blessed($macro) and do { my $method = $macro->can("DOES") || $macro->can("isa"); $macro->$method("MarpaX::Languages::M4::Role::Macro") } } or _failed_check(83, "M4Macro", $macro, "exception_class", "Error::TypeTiny::Assertion") 2450 0 2450
Condition33%2/6
builtin::blessed($macro) && do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
!ll&&!rl&&r
002450
$macro->can('DOES') || $macro->can('isa')
l!l&&r!l&&!r
245000
MC/DC0%0/2
builtin::blessed($macro) && do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
builtin::blessed($macro) do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
MC/DC0%0/2
$macro->can('DOES') || $macro->can('isa')
$macro->can('DOES') $macro->can('isa')
Truth table33%1/3
A && B
A= builtin::blessed($macro)B= do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
ABresult
0X0
100
111
Truth table33%1/3
A || B
A= $macro->can('DOES')B= $macro->can('isa')
ABresult
1X1
011
000
1871 #
1872 # A macro is debugged if 't' is setted,
1873 # or if it is explicitely traced
1874 #
1875 2450 ▶ if ( !$self->_debug_get('t') && !$self->_trace_get( $macro->name ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_debug_get("t") or $self->_trace_get($macro->name)) 2450 0 2450
Condition33%1/3
$self->_debug_get("t") or $self->_trace_get($macro->name)
l!l&&r!l&&!r
002450
MC/DC0%0/2
$self->_debug_get("t") or $self->_trace_get($macro->name)
$self->_debug_get("t") $self->_trace_get($macro->name)
Truth table33%1/3
A or B
A= $self->_debug_get("t")B= $self->_trace_get($macro->name)
ABresult
1X1
011
000
1876 2450 return false;
1877 }
1878  
1879 0 return true;
1880 }
1881  
1882 2 ▶ method logger_debug (@args --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine logger_debug: called CC=3 SCAR=11.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 3 0 3
$#_ >= 0 ? : 3 0 3
1883 3 local $MarpaX::Languages::M4::SELF = $self;
1884 3 $self->_logger->debugf(@args);
1885 3 return;
1886 }
1887  
1888 #
1889 # _canTrace is called upper
1890 #
1891 0 ▶ method logger_trace (@args --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=1.0
Subroutine logger_trace: not called CC=3 SCAR=15.1
Subroutine __ANON__: called CC=1 SCAR=1.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
$#_ >= 0 ? : 0 0 0
1892 0 local $MarpaX::Languages::M4::SELF = $self;
1893 0 $self->_logger->tracef(@args);
1894 0 return;
1895 }
1896  
1897 # ---------------------------------------------------------------
1898 # PRIVATE ATTRIBUTES
1899 # ---------------------------------------------------------------
1900 2 has _lastSysExitCode => ( is => 'rw', isa => Int, default => 0 );
1901  
1902 2 has __file__ => ( is => 'rwp', isa => Str, default => '' );
1903 2 has __line__ => ( is => 'rwp', isa => PositiveOrZeroInt, default => 0 );
1904  
1905 # Saying directly $0 failed in taint mode
1906 2 ▶ has __program__ => ( is => 'rwp', isa => Str, default => sub {$0} );
Subroutine __ANON__: called CC=1 SCAR=0.0
1907  
1908 2 has _value => (
1909 is => 'rwp',
1910 isa => Str,
1911 default => ''
1912 );
1913  
1914 # ----------------------------------------------------
1915 # builders
1916 # ----------------------------------------------------
1917  
1918 0 ▶ method _build_quote_start {$DEFAULT_QUOTE_START}
Subroutine BEGIN: called CC=1 SCAR=0.6
Subroutine _build_quote_start: not called CC=2 SCAR=8.0
Subroutine __ANON__: called CC=1 SCAR=0.6
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 0 0
1919  
1920 2 ▶ method _build__logger_category {'M4'}
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__logger_category: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 34 0 34
1921  
1922 #
1923 # Diversion 0 is special and maps directly to an internal variable
1924 #
1925 2 ▶ method _build__diversions { { 0 => IO::Scalar->new } }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__diversions: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 140 0 140
1926  
1927 2 ▶ method _build__lastDiversion { $self->_diversions_get(0) }
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__lastDiversion: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 118 0 118
1928  
1929 2 ▶ method _build__builtins {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__builtins: called CC=16 SCAR=30.1
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 138 0 138
1930 138 my %ref = ();
1931 138 foreach (
1932 qw/
1933 define undefine defn pushdef popdef indir builtin
1934 ifdef ifelse
1935 shift
1936 dumpdef
1937 traceon traceoff
1938 debugmode debugfile
1939 dnl
1940 changequote changecom changeword
1941 m4wrap
1942 m4exit
1943 include sinclude
1944 divert undivert divnum
1945 len index
1946 regexp substr translit patsubst
1947 format
1948 incr decr
1949 eval
1950 syscmd esyscmd sysval
1951 mkstemp maketemp
1952 errprint
1953 __file__ __line__ __program__
1954 /
1955 )
1956 {
1957  
1958 6210 ▶ if ( $self->_no_gnu_extensions
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_no_gnu_extensions and exists $MarpaX::Languages::M4::Impl::Default::Default_EXTENSIONS{$_} and $MarpaX::Languages::M4::Impl::Default::Default_EXTENSIONS{$_}) 10 6200 6210
Condition83%5/6
$self->_no_gnu_extensions and exists $MarpaX::Languages::M4::Impl::Default::Default_EXTENSIONS{$_} and $MarpaX::Languages::M4::Impl::Default::Default_EXTENSIONS{$_}
!ll&&!rl&&r
6200010
$self->_no_gnu_extensions and exists $MarpaX::Languages::M4::Impl::Default::Default_EXTENSIONS{$_}
!ll&&!rl&&r
61653510
MC/DC66%2/3
$self->_no_gnu_extensions and exists $MarpaX::Languages::M4::Impl::Default::Default_EXTENSIONS{$_} and $MarpaX::Languages::M4::Impl::Default::Default_EXTENSIONS{$_}
$self->_no_gnu_extensions exists $MarpaX::Languages::M4::Impl::Default::Default_EXTENSIONS{$_} $MarpaX::Languages::M4::Impl::Default::Default_EXTENSIONS{$_}
Truth table75%3/4
A and B and C
A= $self->_no_gnu_extensionsB= exists $MarpaX::Languages::M4::Impl::Default::Default_EXTENSIONS{$_}C= $MarpaX::Languages::M4::Impl::Default::Default_EXTENSIONS{$_}
ABCresult
0XX0
10X0
1100
1111
1959 && exists( $Default_EXTENSIONS{$_} )
1960 && $Default_EXTENSIONS{$_} )
1961 {
1962 10 next;
1963 }
1964 6200 my $stubName = "builtin_$_";
1965 6200 $ref{$_} = MarpaX::Languages::M4::Impl::Macro->new(
1966 name => $_,
1967 #
1968 # Builtins have no extension
1969 #
1970 expansion => undef,
1971 #
1972 # I learned it the hard way: NEVER call meta in Moo,
1973 # this will load Moose
1974 #
1975 # stub => $self->meta->get_method("builtin_$_")->body
1976 stub => \&$stubName
1977 );
1978 6200 ▶ if ( $self->_builtin_need_param_exists($_) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_builtin_need_param_exists($_)) 3995 2205 6200
1979 3995 $ref{$_}->needParams( $self->_builtin_need_param_get($_) );
1980 }
1981 6200 ▶ if ( $self->_param_can_be_macro_exists($_) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_param_can_be_macro_exists($_)) 550 5650 6200
1982 550 $ref{$_}
1983 ->paramCanBeMacro( $self->_param_can_be_macro_get($_) );
1984 }
1985 6200 ▶ if ( $_ eq 'dnl' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_ eq "dnl") 138 6062 6200
1986 $ref{$_}->postMatchLength(
1987 128 ▶ sub {
Subroutine __ANON__: called CC=4 SCAR=14.8
1988 128 my ( $self, $input, $pos, $maxPos ) = @_;
1989 128 pos($input) = $pos;
1990 128 ▶ if ( $input =~ /\G.*?\n/s ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($input =~ /\G.*?\n/su) { } 127 1 128
elsif ($self->_eof and $input =~ /\G[^\n]*\z/u) { } 1 0 1
1991 127 return $+[0] - $-[0];
1992 }
1993 ▶ elsif ( $self->_eof && $input =~ /\G[^\n]*\z/ ) {
Condition33%1/3
$self->_eof and $input =~ /\G[^\n]*\z/u
!ll&&!rl&&r
001
MC/DC0%0/2
$self->_eof and $input =~ /\G[^\n]*\z/u
$self->_eof $input =~ /\G[^\n]*\z/u
Truth table33%1/3
A and B
A= $self->_eofB= $input =~ /\G[^\n]*\z/u
ABresult
0X0
100
111
1994 1 $self->logger_warn( '%s: %s',
1995 'dnl', 'EOF without a newline' );
1996 1 return $+[0] - $-[0];
1997 }
1998 else {
1999 0 return 0;
2000 }
2001 }
2002 138 );
2003 }
2004 }
2005 138 ▶ if ( !$self->_no_gnu_extensions ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_no_gnu_extensions) 137 1 138
2006 137 my $name = '__gnu__';
2007 $ref{$name} = MarpaX::Languages::M4::Impl::Macro->new(
2008 name => $name,
2009 expansion => '',
2010 2 ▶ stub => sub { return ''; }
Subroutine __ANON__: called CC=1 SCAR=0.0
2011 137 );
2012 }
2013 138 ▶ if ( is_os_type('Windows') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_os_type("Windows")) 0 138 138
2014 #
2015 # A priori I assume this is reliable
2016 #
2017 0 my $name;
2018 0 ▶ if ( $^O eq 'os2' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O eq 'os2') { } 0 0 0
2019 0 ▶ $name = $self->_no_gnu_extensions ? 'os2' : '__os2__';
Branch: 1 branch
BranchTrueFalseTotal
$self->_no_gnu_extensions ? : 0 0 0
2020 }
2021 else {
2022 0 ▶ $name = $self->_no_gnu_extensions ? 'windows' : '__windows__';
Branch: 1 branch
BranchTrueFalseTotal
$self->_no_gnu_extensions ? : 0 0 0
2023 }
2024 $ref{$name} = MarpaX::Languages::M4::Impl::Macro->new(
2025 name => $name,
2026 expansion => '',
2027 0 ▶ stub => sub { return ''; }
Subroutine __ANON__: not called CC=1 SCAR=6.9
2028 0 );
2029 }
2030 138 ▶ if ( is_os_type('Unix') ) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_os_type("Unix")) 138 0 138
2031 138 ▶ my $name = $self->_no_gnu_extensions ? 'unix' : '__unix__';
Branch: 1 branch
BranchTrueFalseTotal
$self->_no_gnu_extensions ? : 1 137 138
2032 $ref{$name} = MarpaX::Languages::M4::Impl::Macro->new(
2033 name => $name,
2034 expansion => '',
2035 0 ▶ stub => sub { return ''; }
Subroutine __ANON__: not called CC=1 SCAR=6.9
2036 138 );
2037 }
2038  
2039 138 return \%ref;
2040 }
2041  
2042 2 ▶ method _build__macros {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _build__macros: called CC=3 SCAR=11.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 138 0 138
2043 138 my %ref = ();
2044 138 foreach ( $self->_builtins_keys ) {
2045 6475 my $macros = MarpaX::Languages::M4::Impl::Macros->new();
2046 6475 $macros->macros_push( $self->_builtins_get($_) );
2047 6475 $ref{ $self->_prefix_builtins . $_ } = $macros;
2048 }
2049 138 return \%ref;
2050 }
2051  
2052 # ----------------------------------------------------
2053 # Triggers
2054 # ----------------------------------------------------
2055 2 ▶ method _trigger__eoi (Bool $eoi, @rest --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _trigger__eoi: called CC=10 SCAR=23.5
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 142 0 142
if @_ < 1 0 142 142
$#_ >= 0 ? : 142 0 142
if ($#_ >= 0) 142 0 142
Type::Tiny::XS::Bool($eoi) or _failed_check(3, "Bool", $eoi, "exception_class", "Error::TypeTiny::Assertion") 142 0 142
$#_ >= 1 ? : 0 142 142
2056 142 ▶ if ($eoi) {
Branch: 1 branch
BranchTrueFalseTotal
if ($eoi) 142 0 142
2057 #
2058 # First, m4wrap stuff is rescanned.
2059 # and each of them appears like an
2060 # independant input.
2061 #
2062 142 ▶ while ( $self->_m4wrap_count > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_m4wrap_count > 0) 21 142 163
2063 21 my @m4wrap = $self->_m4wrap_elements;
2064 21 $self->_set___m4wrap( [] );
2065 21 ▶ $self->impl_parseIncremental(
Branch: 1 branch
BranchTrueFalseTotal
$self->_m4wrap_order eq 'FIFO' ? : 0 21 21
2066 join( '',
2067 ( $self->_m4wrap_order eq 'FIFO' )
2068 ? @m4wrap
2069 : reverse @m4wrap )
2070 );
2071 }
2072 #
2073 # Then, diverted thingies, that are not rescanned
2074 # We make sure current diversion is number 0
2075 142 $self->builtin_divert();
2076 142 $self->builtin_undivert();
2077 }
2078 142 return;
2079 }
2080  
2081 # ----------------------------------------------------
2082 # Internal attributes
2083 # ----------------------------------------------------
2084 2 has _macroCallId => (
2085 is => 'rwp',
2086 isa => PositiveOrZeroInt,
2087 default => 0
2088 );
2089  
2090 2 has _rc => (
2091 is => 'rwp',
2092 isa => Int,
2093 default => EXIT_SUCCESS,
2094 );
2095  
2096 2 has _builtins => (
2097 is => 'lazy',
2098 isa => HashRef [M4Macro],
2099 handles_via => 'Hash',
2100 handles => {
2101 _builtins_set => 'set',
2102 _builtins_get => 'get',
2103 _builtins_exists => 'exists',
2104 _builtins_keys => 'keys',
2105 _builtins_delete => 'delete'
2106 }
2107 );
2108  
2109 2 has _macros => (
2110 is => 'lazy',
2111 isa => HashRef [ InstanceOf ['MarpaX::Languages::M4::Impl::Macros'] ],
2112 handles_via => 'Hash',
2113 handles => {
2114 _macros_set => 'set',
2115 _macros_get => 'get',
2116 _macros_exists => 'exists',
2117 _macros_keys => 'keys',
2118 _macros_delete => 'delete'
2119 }
2120 );
2121  
2122 has __m4wrap => (
2123 is => 'rwp',
2124 isa => ArrayRef [Str],
2125 140 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
2126 2 handles_via => 'Array',
2127 handles => {
2128 _m4wrap_push => 'push',
2129 _m4wrap_unshift => 'unshift',
2130 _m4wrap_elements => 'elements',
2131 _m4wrap_count => 'count',
2132 }
2133 );
2134  
2135 2 has _eof => (
2136 is => 'rwp',
2137 isa => Bool,
2138 default => false
2139 );
2140  
2141 2 has _eoi => (
2142 is => 'rwp',
2143 isa => Bool,
2144 trigger => 1,
2145 default => false
2146 );
2147  
2148 2 has _unparsed => (
2149 is => 'rwp',
2150 isa => Str,
2151 default => ''
2152 );
2153  
2154 2 has _diversions => (
2155 is => 'lazy',
2156 isa => HashRef [ ConsumerOf ['IO::Handle'] ],
2157 handles_via => 'Hash',
2158 handles => {
2159 _diversions_set => 'set',
2160 _diversions_get => 'get',
2161 _diversions_exists => 'exists',
2162 _diversions_keys => 'keys',
2163 _diversions_delete => 'delete'
2164 }
2165 );
2166  
2167 2 has _lastDiversion => (
2168 is => 'rwp',
2169 lazy => 1,
2170 builder => 1,
2171 isa => ConsumerOf ['IO::Handle']
2172 );
2173 has _lastDiversionNumbers => (
2174 is => 'rwp',
2175 isa => ArrayRef [Int],
2176 140 ▶ default => sub { [0] },
Subroutine __ANON__: called CC=1 SCAR=0.0
2177 2 handles_via => 'Array',
2178 handles => {
2179 _lastDiversionNumbers_push => 'push',
2180 _lastDiversionNumbers_first_index => 'first_index',
2181 _lastDiversionNumbers_get => 'get',
2182 _lastDiversionNumbers_splice => 'splice'
2183 }
2184 );
2185  
2186 2 ▶ method impl_quote (Str $string --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine impl_quote: called CC=8 SCAR=21.7
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 1377 0 1377
if @_ != 1 0 1377 1377
$#_ >= 0 ? : 1377 0 1377
if ($#_ >= 0) 1377 0 1377
Type::Tiny::XS::Str($string) or _failed_check(9, "Str", $string, "exception_class", "Error::TypeTiny::Assertion") 1377 0 1377
2187 1377 ▶ if ( $self->_quoteStartLength > 0 && $self->_quoteEndLength > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_quoteStartLength > 0 and $self->_quoteEndLength > 0) { } 1377 0 1377
Condition33%1/3
$self->_quoteStartLength > 0 and $self->_quoteEndLength > 0
!ll&&!rl&&r
001377
MC/DC0%0/2
$self->_quoteStartLength > 0 and $self->_quoteEndLength > 0
$self->_quoteStartLength > 0 $self->_quoteEndLength > 0
Truth table33%1/3
A and B
A= $self->_quoteStartLength > 0B= $self->_quoteEndLength > 0
ABresult
0X0
100
111
2188 1377 return $self->_quote_start . $string . $self->_quote_end;
2189 }
2190 else {
2191 0 return $string;
2192 }
2193 }
2194  
2195 2 ▶ method impl_unquote (Str $string --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine impl_unquote: called CC=8 SCAR=21.3
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 4392 0 4392
if @_ != 1 0 4392 4392
$#_ >= 0 ? : 4392 0 4392
if ($#_ >= 0) 4392 0 4392
Type::Tiny::XS::Str($string) or _failed_check(9, "Str", $string, "exception_class", "Error::TypeTiny::Assertion") 4392 0 4392
2196 4392 ▶ if ( $self->_quoteStartLength > 0 && $self->_quoteEndLength > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_quoteStartLength > 0 and $self->_quoteEndLength > 0) 4392 0 4392
Condition33%1/3
$self->_quoteStartLength > 0 and $self->_quoteEndLength > 0
!ll&&!rl&&r
004392
MC/DC0%0/2
$self->_quoteStartLength > 0 and $self->_quoteEndLength > 0
$self->_quoteStartLength > 0 $self->_quoteEndLength > 0
Truth table33%1/3
A and B
A= $self->_quoteStartLength > 0B= $self->_quoteEndLength > 0
ABresult
0X0
100
111
2197 4392 substr( $string, 0, $self->_quoteStartLength, '' );
2198 4392 my $quoteEndLength = $self->_quoteEndLength;
2199 4392 substr( $string, -$quoteEndLength, $quoteEndLength, '' );
2200 }
2201 4392 return $string;
2202 }
2203  
2204 2 ▶ method _checkIgnored (Str $name, @ignored --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _checkIgnored: called CC=8 SCAR=20.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 1457 0 1457
if @_ < 1 0 1457 1457
$#_ >= 0 ? : 1457 0 1457
if ($#_ >= 0) 1457 0 1457
Type::Tiny::XS::Str($name) or _failed_check(9, "Str", $name, "exception_class", "Error::TypeTiny::Assertion") 1457 0 1457
$#_ >= 1 ? : 2 1455 1457
2205 1457 ▶ if (@ignored) {
Branch: 1 branch
BranchTrueFalseTotal
if (@ignored) 2 1455 1457
2206 2 $self->logger_warn( 'excess arguments to builtin %s ignored',
2207 $self->impl_quote($name) );
2208 }
2209 1457 return;
2210 }
2211  
2212 2 ▶ method builtin_define (Undef|Str|M4Macro $name?, Undef|Str|M4Macro $defn?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine builtin_define: called CC=22 SCAR=33.1
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 314 0 314
$#_ >= 0 ? : 314 0 314
if ($#_ >= 0) 314 0 314
not defined $name or Type::Tiny::XS::Str($name) or do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } } or _failed_check(136, "Undef|Str|M4Macro", $name, "exception_class", "Error::TypeTiny::Assertion") 314 0 314
$#_ >= 1 ? : 314 0 314
if ($#_ >= 1) 314 0 314
not defined $defn or Type::Tiny::XS::Str($defn) or do { builtin::blessed($defn) and do { my $method = $defn->can("DOES") || $defn->can("isa"); $defn->$method("MarpaX::Languages::M4::Role::Macro") } } or _failed_check(137, "Undef|Str|M4Macro", $defn, "exception_class", "Error::TypeTiny::Assertion") 314 0 314
$#_ >= 2 ? : 0 314 314
Condition50%12/24
not defined $name or Type::Tiny::XS::Str($name) or do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
l!l&&r!l&&!r
31220
not defined $name or Type::Tiny::XS::Str($name)
l!l&&r!l&&!r
03122
builtin::blessed($name) && do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
!ll&&!rl&&r
002
$name->can('DOES') || $name->can('isa')
l!l&&r!l&&!r
200
not defined $defn or Type::Tiny::XS::Str($defn) or do { builtin::blessed($defn) and do { my $method = $defn->can("DOES") || $defn->can("isa"); $defn->$method("MarpaX::Languages::M4::Role::Macro") } }
l!l&&r!l&&!r
30950
not defined $defn or Type::Tiny::XS::Str($defn)
l!l&&r!l&&!r
03095
builtin::blessed($defn) && do { my $method = $defn->can('DOES') || $defn->can('isa'); $defn->$method('MarpaX::Languages::M4::Role::Macro') }
!ll&&!rl&&r
005
$defn->can('DOES') || $defn->can('isa')
l!l&&r!l&&!r
500
MC/DC0%0/3
not defined $name or Type::Tiny::XS::Str($name) or do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
not defined $name Type::Tiny::XS::Str($name) do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
MC/DC0%0/2
builtin::blessed($name) && do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
builtin::blessed($name) do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
MC/DC0%0/2
$name->can('DOES') || $name->can('isa')
$name->can('DOES') $name->can('isa')
MC/DC0%0/3
not defined $defn or Type::Tiny::XS::Str($defn) or do { builtin::blessed($defn) and do { my $method = $defn->can("DOES") || $defn->can("isa"); $defn->$method("MarpaX::Languages::M4::Role::Macro") } }
not defined $defn Type::Tiny::XS::Str($defn) do { builtin::blessed($defn) and do { my $method = $defn->can("DOES") || $defn->can("isa"); $defn->$method("MarpaX::Languages::M4::Role::Macro") } }
MC/DC0%0/2
builtin::blessed($defn) && do { my $method = $defn->can('DOES') || $defn->can('isa'); $defn->$method('MarpaX::Languages::M4::Role::Macro') }
builtin::blessed($defn) do { my $method = $defn->can('DOES') || $defn->can('isa'); $defn->$method('MarpaX::Languages::M4::Role::Macro') }
MC/DC0%0/2
$defn->can('DOES') || $defn->can('isa')
$defn->can('DOES') $defn->can('isa')
Truth table50%2/4
not(A) or B or C
A= not defined $nameB= Type::Tiny::XS::Str($name)C= do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
ABCresult
1XX1
01X1
0011
0000
Truth table33%1/3
A && B
A= builtin::blessed($name)B= do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
ABresult
0X0
100
111
Truth table33%1/3
A || B
A= $name->can('DOES')B= $name->can('isa')
ABresult
1X1
011
000
Truth table50%2/4
not(A) or B or C
A= not defined $defnB= Type::Tiny::XS::Str($defn)C= do { builtin::blessed($defn) and do { my $method = $defn->can("DOES") || $defn->can("isa"); $defn->$method("MarpaX::Languages::M4::Role::Macro") } }
ABCresult
1XX1
01X1
0011
0000
Truth table33%1/3
A && B
A= builtin::blessed($defn)B= do { my $method = $defn->can('DOES') || $defn->can('isa'); $defn->$method('MarpaX::Languages::M4::Role::Macro') }
ABresult
0X0
100
111
Truth table33%1/3
A || B
A= $defn->can('DOES')B= $defn->can('isa')
ABresult
1X1
011
000
2213 314 ▶ if ( Undef->check($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($name)) 0 314 314
2214 0 $self->logger_error(
2215 'too few arguments to builtin %s',
2216 $self->impl_quote('define')
2217 );
2218 0 return '';
2219 }
2220 314 ▶ $defn //= '';
Condition50%1/2
$defn //= ""
l!l
3140
MC/DC0%0/1
$defn //= ""
$defn
Truth table50%1/2
A
A= $defn
Aresult
11
00
2221  
2222 314 $self->_checkIgnored( 'define', @ignored );
2223  
2224 314 ▶ if ( M4Macro->check($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&M4Macro()->check($name)) 2 312 314
2225 2 $self->logger_warn(
2226 '%s: invalid macro name ignored',
2227 $self->impl_quote('define')
2228 );
2229 2 return '';
2230 }
2231  
2232 312 my $macro;
2233 312 ▶ if ( Str->check($defn) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Str()->check($defn)) { } 307 5 312
2234 #
2235 # Make a M4Macro out of $defn
2236 #
2237 307 $macro = MarpaX::Languages::M4::Impl::Macro->new(
2238 name => $name,
2239 stub => $self->_expansion2CodeRef( $name, $defn ),
2240 expansion => $defn
2241 );
2242 }
2243 else {
2244 5 $macro = $defn->macro_clone($name);
2245 }
2246 310 ▶ if ( !$self->_macros_exists($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->_macros_exists($name)) { } 192 118 310
2247 192 my $macros = MarpaX::Languages::M4::Impl::Macros->new();
2248 192 $macros->macros_push($macro);
2249 192 $self->_macros_set( $name, $macros );
2250 }
2251 else {
2252 118 $self->_macros_get($name)->macros_set( -1, $macro );
2253 }
2254 310 return '';
2255 }
2256  
2257 2 ▶ method builtin_undefine (Str @names --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_undefine: called CC=5 SCAR=16.1
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 9 0 9
$#_ >= 0 ? : 9 0 9
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 10 0 10
2258 9 $self->_macros_delete(@names);
2259 9 return '';
2260 }
2261  
2262 #
2263 # defn can only concatenate text macros
2264 #
2265 2 ▶ method builtin_defn (Str @names --> Str|M4Macro) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_defn: called CC=12 SCAR=24.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 74 0 74
$#_ >= 0 ? : 74 0 74
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 78 0 78
2266 74 my @macros = ();
2267  
2268 74 foreach (@names) {
2269 78 ▶ if ( $self->_macros_exists($_) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_macros_exists($_)) 78 0 78
2270 78 push( @macros, $self->_getMacro($_) );
2271 }
2272 }
2273  
2274 74 my $rc = '';
2275 74 foreach ( 0 .. $#macros ) {
2276 78 ▶ if ( $macros[$_]->macro_isBuiltin ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($macros[$_]->macro_isBuiltin) { } 18 60 78
2277 18 ▶ if ( ( $_ == 0 && $#macros > 0 )
Branch: 1 branch
BranchTrueFalseTotal
if ($_ == 0 and $#macros > 0 or $_ > 0) { } 3 15 18
Condition100%6/6
$_ == 0 and $#macros > 0 or $_ > 0
l!l&&r!l&&!r
1215
$_ == 0 and $#macros > 0
!ll&&!rl&&r
2151
MC/DC33%1/3
$_ == 0 and $#macros > 0 or $_ > 0
$_ == 0 $#macros > 0 $_ > 0
Truth table60%3/5
A and B or C
A= $_ == 0B= $#macros > 0C= $_ > 0
ABCresult
11X1
0X11
1011
0X00
1000
2278 || ( $_ > 0 ) )
2279 {
2280 3 $self->logger_warn( '%s: cannot concatenate builtin %s',
2281 'defn',
2282 $self->impl_quote( $macros[$_]->macro_name ) );
2283 }
2284 else {
2285 #
2286 # Per def this is ok only
2287 # if @macros has one element,
2288 # and this is a builtin
2289 #
2290 15 $rc = $macros[$_];
2291 }
2292 }
2293 else {
2294 60 $rc .= $self->impl_quote( $macros[$_]->macro_expansion );
2295 }
2296 }
2297 74 return $rc;
2298 }
2299  
2300 2 ▶ method builtin_pushdef (Undef|Str $name?, Undef|Str|M4Macro $defn?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine builtin_pushdef: called CC=17 SCAR=29.2
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 66 0 66
$#_ >= 0 ? : 66 0 66
if ($#_ >= 0) 66 0 66
Type::Tiny::XS::AUTO::TC5($name) or _failed_check(139, "Undef|Str", $name, "exception_class", "Error::TypeTiny::Assertion") 66 0 66
$#_ >= 1 ? : 59 7 66
if ($#_ >= 1) 59 7 66
not defined $defn or Type::Tiny::XS::Str($defn) or do { builtin::blessed($defn) and do { my $method = $defn->can("DOES") || $defn->can("isa"); $defn->$method("MarpaX::Languages::M4::Role::Macro") } } or _failed_check(140, "Undef|Str|M4Macro", $defn, "exception_class", "Error::TypeTiny::Assertion") 59 0 59
$#_ >= 2 ? : 0 66 66
Condition50%6/12
not defined $defn or Type::Tiny::XS::Str($defn) or do { builtin::blessed($defn) and do { my $method = $defn->can("DOES") || $defn->can("isa"); $defn->$method("MarpaX::Languages::M4::Role::Macro") } }
l!l&&r!l&&!r
5630
not defined $defn or Type::Tiny::XS::Str($defn)
l!l&&r!l&&!r
0563
builtin::blessed($defn) && do { my $method = $defn->can('DOES') || $defn->can('isa'); $defn->$method('MarpaX::Languages::M4::Role::Macro') }
!ll&&!rl&&r
003
$defn->can('DOES') || $defn->can('isa')
l!l&&r!l&&!r
300
MC/DC0%0/3
not defined $defn or Type::Tiny::XS::Str($defn) or do { builtin::blessed($defn) and do { my $method = $defn->can("DOES") || $defn->can("isa"); $defn->$method("MarpaX::Languages::M4::Role::Macro") } }
not defined $defn Type::Tiny::XS::Str($defn) do { builtin::blessed($defn) and do { my $method = $defn->can("DOES") || $defn->can("isa"); $defn->$method("MarpaX::Languages::M4::Role::Macro") } }
MC/DC0%0/2
builtin::blessed($defn) && do { my $method = $defn->can('DOES') || $defn->can('isa'); $defn->$method('MarpaX::Languages::M4::Role::Macro') }
builtin::blessed($defn) do { my $method = $defn->can('DOES') || $defn->can('isa'); $defn->$method('MarpaX::Languages::M4::Role::Macro') }
MC/DC0%0/2
$defn->can('DOES') || $defn->can('isa')
$defn->can('DOES') $defn->can('isa')
Truth table50%2/4
not(A) or B or C
A= not defined $defnB= Type::Tiny::XS::Str($defn)C= do { builtin::blessed($defn) and do { my $method = $defn->can("DOES") || $defn->can("isa"); $defn->$method("MarpaX::Languages::M4::Role::Macro") } }
ABCresult
1XX1
01X1
0011
0000
Truth table33%1/3
A && B
A= builtin::blessed($defn)B= do { my $method = $defn->can('DOES') || $defn->can('isa'); $defn->$method('MarpaX::Languages::M4::Role::Macro') }
ABresult
0X0
100
111
Truth table33%1/3
A || B
A= $defn->can('DOES')B= $defn->can('isa')
ABresult
1X1
011
000
2301 66 ▶ if ( Undef->check($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($name)) 0 66 66
2302 0 $self->logger_error(
2303 'too few arguments to builtin %s',
2304 $self->impl_quote('pushdef')
2305 );
2306 0 return '';
2307 }
2308  
2309 66 my $macro;
2310 66 ▶ $defn //= '';
Condition100%2/2
$defn //= ""
l!l
597
MC/DC100%1/1
$defn //= ""
$defn
Truth table100%2/2
A
A= $defn
Aresult
11
00
2311  
2312 66 $self->_checkIgnored( 'pushdef', @ignored );
2313  
2314 66 ▶ if ( Str->check($defn) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Str()->check($defn)) { } 63 3 66
2315 #
2316 # Make a M4Macro out of $defn
2317 #
2318 63 $macro = MarpaX::Languages::M4::Impl::Macro->new(
2319 name => $name,
2320 stub => $self->_expansion2CodeRef( $name, $defn ),
2321 expansion => $defn
2322 );
2323 }
2324 else {
2325 3 $macro = $defn->macro_clone($name);
2326 }
2327 66 ▶ if ( !$self->_macros_exists($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->_macros_exists($name)) { } 30 36 66
2328 30 my $macros = MarpaX::Languages::M4::Impl::Macros->new();
2329 30 $macros->macros_push($macro);
2330 30 $self->_macros_set( $name, $macros );
2331 }
2332 else {
2333 36 $self->_macros_get($name)->macros_push($macro);
2334 }
2335 66 return '';
2336 }
2337  
2338 2 ▶ method builtin_popdef (Str @names --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_popdef: called CC=8 SCAR=20.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 51 0 51
$#_ >= 0 ? : 51 0 51
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 54 0 54
2339  
2340 51 foreach (@names) {
2341 54 ▶ if ( $self->_macros_exists($_) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_macros_exists($_)) 54 0 54
2342 54 $self->_macros_get($_)->macros_pop();
2343 54 ▶ if ( $self->_macros_get($_)->macros_isEmpty ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_macros_get($_)->macros_isEmpty) 26 28 54
2344 26 $self->_macros_delete($_);
2345 }
2346 }
2347 }
2348 51 return '';
2349 }
2350  
2351 2 ▶ method builtin_indir (Undef|Str|M4Macro $name, @args --> Str|M4Macro) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine builtin_indir: called CC=17 SCAR=29.4
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 10 0 10
if @_ < 1 0 10 10
$#_ >= 0 ? : 10 0 10
if ($#_ >= 0) 10 0 10
not defined $name or Type::Tiny::XS::Str($name) or do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } } or _failed_check(141, "Undef|Str|M4Macro", $name, "exception_class", "Error::TypeTiny::Assertion") 10 0 10
$#_ >= 1 ? : 6 4 10
Condition50%6/12
not defined $name or Type::Tiny::XS::Str($name) or do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
l!l&&r!l&&!r
910
not defined $name or Type::Tiny::XS::Str($name)
l!l&&r!l&&!r
091
builtin::blessed($name) && do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
!ll&&!rl&&r
001
$name->can('DOES') || $name->can('isa')
l!l&&r!l&&!r
100
MC/DC0%0/3
not defined $name or Type::Tiny::XS::Str($name) or do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
not defined $name Type::Tiny::XS::Str($name) do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
MC/DC0%0/2
builtin::blessed($name) && do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
builtin::blessed($name) do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
MC/DC0%0/2
$name->can('DOES') || $name->can('isa')
$name->can('DOES') $name->can('isa')
Truth table50%2/4
not(A) or B or C
A= not defined $nameB= Type::Tiny::XS::Str($name)C= do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
ABCresult
1XX1
01X1
0011
0000
Truth table33%1/3
A && B
A= builtin::blessed($name)B= do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
ABresult
0X0
100
111
Truth table33%1/3
A || B
A= $name->can('DOES')B= $name->can('isa')
ABresult
1X1
011
000
2352 10 ▶ if ( Undef->check($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($name)) 0 10 10
2353 0 $self->logger_error(
2354 'too few arguments to builtin %s',
2355 $self->impl_quote('indir')
2356 );
2357 0 return '';
2358 }
2359 #
2360 # If $name is a builtin, check the other arguments
2361 #
2362 10 ▶ if ( M4Macro->check($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&M4Macro()->check($name)) 1 9 10
2363 1 $self->logger_warn(
2364 'indir: invalid macro name ignored',
2365 $self->impl_quote( $name->macro_name )
2366 );
2367 1 return '';
2368 }
2369 9 ▶ if ( $self->_macros_exists($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_macros_exists($name)) { } 7 2 9
2370 7 my $macro = $self->_getMacro($name);
2371 #
2372 # Check the args
2373 #
2374 7 foreach ( 0 .. $#args ) {
2375 6 ▶ if ( M4Macro->check( $args[$_] )
Branch: 1 branch
BranchTrueFalseTotal
if (&M4Macro()->check($args[$_]) and not $macro->macro_paramCanBeMacro($_)) 1 5 6
Condition100%3/3
&M4Macro()->check($args[$_]) and not $macro->macro_paramCanBeMacro($_)
!ll&&!rl&&r
321
MC/DC100%2/2
&M4Macro()->check($args[$_]) and not $macro->macro_paramCanBeMacro($_)
&M4Macro()->check($args[$_]) not $macro->macro_paramCanBeMacro($_)
Truth table100%3/3
A and not(B)
A= &M4Macro()->check($args[$_])B= not $macro->macro_paramCanBeMacro($_)
ABresult
0X0
100
111
2376 && !$macro->macro_paramCanBeMacro($_) )
2377 {
2378 #
2379 # Macro not authorized: flattened to the empty string
2380 #
2381 1 $args[$_] = '';
2382 }
2383 }
2384 #
2385 # macro executed by indir is not traced
2386 #
2387 7 return $macro->macro_execute( $self, @args );
2388  
2389 # return $self->impl_macroExecute( $macro, @args );
2390 }
2391 else {
2392 2 $self->logger_error( 'indir: undefined macro %s',
2393 $self->impl_quote($name) );
2394 2 return '';
2395 }
2396 }
2397  
2398 0 ▶ method builtin_builtin (Undef|Str|M4Macro $name?, @args --> Str|M4Macro) {
Subroutine BEGIN: called CC=1 SCAR=0.3
Subroutine BEGIN: called CC=1 SCAR=0.3
Subroutine builtin_builtin: called CC=13 SCAR=28.5
Subroutine __ANON__: called CC=1 SCAR=0.3
Subroutine __ANON__: called CC=1 SCAR=0.3
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 16 0 16
$#_ >= 0 ? : 15 1 16
if ($#_ >= 0) 15 1 16
not defined $name or Type::Tiny::XS::Str($name) or do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } } or _failed_check(143, "Undef|Str|M4Macro", $name, "exception_class", "Error::TypeTiny::Assertion") 15 0 15
$#_ >= 1 ? : 9 7 16
Condition16%2/12
not defined $name or Type::Tiny::XS::Str($name) or do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
l!l&&r!l&&!r
1500
not defined $name or Type::Tiny::XS::Str($name)
l!l&&r!l&&!r
0150
builtin::blessed($name) && do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
!ll&&!rl&&r
000
$name->can('DOES') || $name->can('isa')
l!l&&r!l&&!r
000
MC/DC0%0/3
not defined $name or Type::Tiny::XS::Str($name) or do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
not defined $name Type::Tiny::XS::Str($name) do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
MC/DC0%0/2
builtin::blessed($name) && do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
builtin::blessed($name) do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
MC/DC0%0/2
$name->can('DOES') || $name->can('isa')
$name->can('DOES') $name->can('isa')
Truth table25%1/4
not(A) or B or C
A= not defined $nameB= Type::Tiny::XS::Str($name)C= do { builtin::blessed($name) and do { my $method = $name->can("DOES") || $name->can("isa"); $name->$method("MarpaX::Languages::M4::Role::Macro") } }
ABCresult
1XX1
01X1
0011
0000
Truth table0%0/3
A && B
A= builtin::blessed($name)B= do { my $method = $name->can('DOES') || $name->can('isa'); $name->$method('MarpaX::Languages::M4::Role::Macro') }
ABresult
0X0
100
111
Truth table0%0/3
A || B
A= $name->can('DOES')B= $name->can('isa')
ABresult
1X1
011
000
2399 16 ▶ if ( Undef->check($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($name)) 1 15 16
2400 1 $self->logger_error(
2401 'too few arguments to builtin %s',
2402 $self->impl_quote('builtin')
2403 );
2404 1 return '';
2405 }
2406 15 ▶ if ( M4Macro->check($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&M4Macro()->check($name)) 0 15 15
2407 #
2408 # Not supported
2409 #
2410 0 $self->logger_error(
2411 '%s: invalid macro name ignored',
2412 $self->impl_quote('builtin')
2413 );
2414 0 return '';
2415 }
2416 15 ▶ if ( $self->_builtins_exists($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_builtins_exists($name)) { } 11 4 15
2417 #
2418 # We do not check the args to eventually flatten them. Thus this
2419 # can throw an exception.
2420 #
2421 11 my $rc = '';
2422 11 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
2423 11 $rc = $self->impl_macroExecute( $self->_builtins_get($name),
2424 @args );
2425 }
2426 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2427 0 $self->logger_error( '%s', "$_" );
2428 0 return;
2429 11 };
2430 11 return $rc;
2431 }
2432 else {
2433 4 $self->logger_error( 'builtin: undefined builtin %s',
2434 $self->impl_quote($name) );
2435 4 return '';
2436 }
2437 }
2438  
2439 2 ▶ method builtin_ifdef (Undef|Str $name?, Undef|Str $string1?, Undef|Str $string2?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_ifdef: called CC=16 SCAR=28.3
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 62 0 62
$#_ >= 0 ? : 62 0 62
if ($#_ >= 0) 62 0 62
Type::Tiny::XS::AUTO::TC5($name) or _failed_check(145, "Undef|Str", $name, "exception_class", "Error::TypeTiny::Assertion") 62 0 62
$#_ >= 1 ? : 62 0 62
if ($#_ >= 1) 62 0 62
Type::Tiny::XS::AUTO::TC5($string1) or _failed_check(146, "Undef|Str", $string1, "exception_class", "Error::TypeTiny::Assertion") 62 0 62
$#_ >= 2 ? : 19 43 62
if ($#_ >= 2) 19 43 62
Type::Tiny::XS::AUTO::TC5($string2) or _failed_check(147, "Undef|Str", $string2, "exception_class", "Error::TypeTiny::Assertion") 19 0 19
$#_ >= 3 ? : 1 61 62
2440 62 ▶ if ( Undef->check($name) || Undef->check($string1) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($name) or &Undef()->check($string1)) 0 62 62
Condition33%1/3
&Undef()->check($name) or &Undef()->check($string1)
l!l&&r!l&&!r
0062
MC/DC0%0/2
&Undef()->check($name) or &Undef()->check($string1)
&Undef()->check($name) &Undef()->check($string1)
Truth table33%1/3
A or B
A= &Undef()->check($name)B= &Undef()->check($string1)
ABresult
1X1
011
000
2441 0 $self->logger_error(
2442 'too few arguments to builtin %s',
2443 $self->impl_quote('ifdef')
2444 );
2445 0 return '';
2446 }
2447  
2448 62 $self->_checkIgnored( 'ifdef', @ignored );
2449  
2450 62 ▶ if ( $self->_macros_exists($name) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_macros_exists($name)) { } 41 21 62
2451 41 return $string1;
2452 }
2453 else {
2454 21 ▶ return $string2 // '';
Condition100%2/2
$string2 // ""
l!l
912
MC/DC100%1/1
$string2 // ""
$string2
Truth table100%2/2
A
A= $string2
Aresult
11
00
2455 }
2456 }
2457  
2458 2 ▶ method builtin_ifelse (@args --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_ifelse: called CC=18 SCAR=29.5
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 252 0 252
$#_ >= 0 ? : 252 0 252
2459 252 ▶ while (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 293 0 293
2460 293 ▶ if ( scalar(@args) <= 1 ) {
Branch: 3 branches
BranchTrueFalseTotal
if (scalar @args <= 1) { } 1 292 293
elsif (scalar @args == 2) { } 1 291 292
elsif (scalar @args >= 3 and scalar @args <= 5) { } 246 45 291
2461 1 return '';
2462 }
2463 elsif ( scalar(@args) == 2 ) {
2464 1 $self->logger_error(
2465 'too few arguments to builtin %s',
2466 $self->impl_quote('ifelse')
2467 );
2468 1 return '';
2469 }
2470 ▶ elsif ( scalar(@args) >= 3 && scalar(@args) <= 5 ) {
Condition66%2/3
scalar @args >= 3 and scalar @args <= 5
!ll&&!rl&&r
045246
MC/DC50%1/2
scalar @args >= 3 and scalar @args <= 5
scalar @args >= 3 scalar @args <= 5
Truth table66%2/3
A and B
A= scalar @args >= 3B= scalar @args <= 5
ABresult
0X0
100
111
2471 246 my ( $string1, $string2, $equal, $notEqual, $ignored )
2472 = @args;
2473 246 ▶ $string1 //= '';
Condition50%1/2
$string1 //= ""
l!l
2460
MC/DC0%0/1
$string1 //= ""
$string1
Truth table50%1/2
A
A= $string1
Aresult
11
00
2474 246 ▶ $string2 //= '';
Condition50%1/2
$string2 //= ""
l!l
2460
MC/DC0%0/1
$string2 //= ""
$string2
Truth table50%1/2
A
A= $string2
Aresult
11
00
2475 246 ▶ $equal //= '';
Condition50%1/2
$equal //= ""
l!l
2460
MC/DC0%0/1
$equal //= ""
$equal
Truth table50%1/2
A
A= $equal
Aresult
11
00
2476 246 ▶ $notEqual //= '';
Condition100%2/2
$notEqual //= ""
l!l
2424
MC/DC100%1/1
$notEqual //= ""
$notEqual
Truth table100%2/2
A
A= $notEqual
Aresult
11
00
2477 246 ▶ if ( !Undef->check($ignored) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Undef()->check($ignored)) 2 244 246
2478 2 $self->logger_warn(
2479 'excess arguments to builtin %s ignored',
2480 $self->impl_quote('ifelse') );
2481 }
2482 246 ▶ return ( $string1 eq $string2 ) ? $equal : $notEqual;
Branch: 1 branch
BranchTrueFalseTotal
$string1 eq $string2 ? : 64 182 246
2483 }
2484 else {
2485 45 my ( $string1, $string2, $equal, @rest ) = @args;
2486 45 ▶ $string1 //= '';
Condition50%1/2
$string1 //= ""
l!l
450
MC/DC0%0/1
$string1 //= ""
$string1
Truth table50%1/2
A
A= $string1
Aresult
11
00
2487 45 ▶ $string2 //= '';
Condition50%1/2
$string2 //= ""
l!l
450
MC/DC0%0/1
$string2 //= ""
$string2
Truth table50%1/2
A
A= $string2
Aresult
11
00
2488 45 ▶ $equal //= '';
Condition50%1/2
$equal //= ""
l!l
450
MC/DC0%0/1
$equal //= ""
$equal
Truth table50%1/2
A
A= $equal
Aresult
11
00
2489 45 ▶ if ( $string1 eq $string2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($string1 eq $string2) 4 41 45
2490 4 return $equal;
2491 }
2492 41 @args = @rest;
2493 }
2494 }
2495 }
2496  
2497 2 ▶ method builtin_shift (@args --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_shift: called CC=4 SCAR=13.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 151 0 151
$#_ >= 0 ? : 151 0 151
2498 151 shift(@args);
2499  
2500 151 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) { } 133 18 151
2501 133 return join( ',', map { $self->impl_quote($_) } @args );
2502 }
2503 else {
2504 18 return '';
2505 }
2506 }
2507  
2508 2 ▶ method builtin_dumpdef (@args --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_dumpdef: called CC=7 SCAR=19.7
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 4 0 4
$#_ >= 0 ? : 4 0 4
2509  
2510 4 ▶ if ( !@args ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@args) 0 4 4
2511 0 @args = $self->_macros_keys;
2512 }
2513  
2514 4 foreach ( sort @args ) {
2515 4 ▶ if ( !$self->_macros_exists($_) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->_macros_exists($_)) { } 1 3 4
2516 1 $self->logger_warn( 'dumpdef: undefined macro %s',
2517 $self->impl_quote($_) );
2518 }
2519 else {
2520 3 ▶ $self->logger_debug(
Branch: 1 branch
BranchTrueFalseTotal
$self->_getMacro($_)->macro_isBuiltin ? : 1 2 3
2521 '%s: %s',
2522 $_,
2523 $self->_getMacro($_)->macro_isBuiltin
2524 ? "<$_>"
2525 : $self->_getMacro($_)->macro_expansion
2526 );
2527 }
2528 }
2529  
2530 4 return '';
2531 }
2532  
2533 0 ▶ method builtin_traceon (@names --> Str) {
Subroutine BEGIN: called CC=1 SCAR=1.0
Subroutine builtin_traceon: not called CC=4 SCAR=19.1
Subroutine __ANON__: called CC=1 SCAR=1.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
$#_ >= 0 ? : 0 0 0
2534 0 foreach (@names) {
2535 0 $self->_trace_set( $_, true );
2536 }
2537 0 return '';
2538 }
2539  
2540 0 ▶ method builtin_traceoff (@names --> Str) {
Subroutine BEGIN: called CC=1 SCAR=1.0
Subroutine builtin_traceoff: not called CC=4 SCAR=19.1
Subroutine __ANON__: called CC=1 SCAR=1.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
$#_ >= 0 ? : 0 0 0
2541 0 foreach (@names) {
2542 0 $self->_trace_set( $_, false );
2543 }
2544 0 return '';
2545 }
2546  
2547 0 ▶ method builtin_debugmode (Undef|Str $flags?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=1.6
Subroutine BEGIN: called CC=1 SCAR=1.6
Subroutine builtin_debugmode: not called CC=9 SCAR=35.9
Subroutine __ANON__: called CC=1 SCAR=1.6
Subroutine __ANON__: called CC=1 SCAR=1.6
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC5($flags) or _failed_check(148, "Undef|Str", $flags, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
2548 0 ▶ if ( Str->check($flags) && length($flags) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Str()->check($flags) and length $flags <= 0) 0 0 0
Condition0%0/3
&Str()->check($flags) and length $flags <= 0
!ll&&!rl&&r
000
MC/DC0%0/2
&Str()->check($flags) and length $flags <= 0
&Str()->check($flags) length $flags <= 0
Truth table0%0/3
A and B
A= &Str()->check($flags)B= length $flags <= 0
ABresult
0X0
100
111
2549 0 $flags = 'aeq';
2550 }
2551 0 ▶ if ( Undef->check($flags) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($flags)) 0 0 0
2552 0 $flags = '';
2553 }
2554  
2555 0 $self->_checkIgnored( 'debugmode', @ignored );
2556 0 $self->debugmode($flags);
2557 0 return '';
2558 }
2559  
2560 0 ▶ method builtin_debugfile (Undef|Str $file?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=1.6
Subroutine BEGIN: called CC=1 SCAR=1.6
Subroutine builtin_debugfile: not called CC=6 SCAR=26.2
Subroutine __ANON__: called CC=1 SCAR=1.6
Subroutine __ANON__: called CC=1 SCAR=1.6
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC5($file) or _failed_check(149, "Undef|Str", $file, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
2561  
2562 0 $self->_checkIgnored( 'debugfile', @ignored );
2563 0 $self->_set_debugfile($file);
2564 0 return '';
2565 }
2566  
2567 2 ▶ method builtin_dnl (@ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_dnl: called CC=3 SCAR=11.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 128 0 128
$#_ >= 0 ? : 1 127 128
2568 128 $self->_checkIgnored( 'dnl', @ignored );
2569 128 return '';
2570 }
2571  
2572 2 ▶ method builtin_changequote (Undef|Str $start?, Undef|Str $end?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_changequote: called CC=14 SCAR=26.5
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 23 0 23
$#_ >= 0 ? : 17 6 23
if ($#_ >= 0) 17 6 23
Type::Tiny::XS::AUTO::TC5($start) or _failed_check(150, "Undef|Str", $start, "exception_class", "Error::TypeTiny::Assertion") 17 0 17
$#_ >= 1 ? : 17 6 23
if ($#_ >= 1) 17 6 23
Type::Tiny::XS::AUTO::TC5($end) or _failed_check(151, "Undef|Str", $end, "exception_class", "Error::TypeTiny::Assertion") 17 0 17
$#_ >= 2 ? : 0 23 23
2573 23 ▶ if ( Undef->check($start) && Undef->check($end) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($start) and &Undef()->check($end)) 6 17 23
Condition66%2/3
&Undef()->check($start) and &Undef()->check($end)
!ll&&!rl&&r
1706
MC/DC50%1/2
&Undef()->check($start) and &Undef()->check($end)
&Undef()->check($start) &Undef()->check($end)
Truth table66%2/3
A and B
A= &Undef()->check($start)B= &Undef()->check($end)
ABresult
0X0
100
111
2574 6 $start = $DEFAULT_QUOTE_START;
2575 6 $end = $DEFAULT_QUOTE_END;
2576 }
2577  
2578 23 $self->_checkIgnored( 'changequote', @ignored );
2579  
2580 23 ▶ $start //= '';
Condition50%1/2
$start //= ""
l!l
230
MC/DC0%0/1
$start //= ""
$start
Truth table50%1/2
A
A= $start
Aresult
11
00
2581 23 ▶ if ( length($start) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $start <= 0) { } 1 22 23
2582 1 $end = '';
2583 }
2584 else {
2585 22 ▶ $end ||= $DEFAULT_QUOTE_END;
Condition66%2/3
$end ||= $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_END
l!l&&r!l&&!r
2110
MC/DC0%0/2
$end ||= $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_END
$end $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_END
Truth table66%2/3
A ||= B
A= $endB= $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_END
ABresult
1X1
011
000
2586 }
2587  
2588 23 $self->_set__quote_start($start);
2589 23 $self->_set__quote_end($end);
2590  
2591 23 return '';
2592 }
2593  
2594 2 ▶ method builtin_changecom (Undef|Str $start?, Undef|Str $end?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_changecom: called CC=14 SCAR=26.5
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 16 0 16
$#_ >= 0 ? : 13 3 16
if ($#_ >= 0) 13 3 16
Type::Tiny::XS::AUTO::TC5($start) or _failed_check(152, "Undef|Str", $start, "exception_class", "Error::TypeTiny::Assertion") 13 0 13
$#_ >= 1 ? : 13 3 16
if ($#_ >= 1) 13 3 16
Type::Tiny::XS::AUTO::TC5($end) or _failed_check(153, "Undef|Str", $end, "exception_class", "Error::TypeTiny::Assertion") 13 0 13
$#_ >= 2 ? : 0 16 16
2595 16 ▶ if ( Undef->check($start) && Undef->check($end) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($start) and &Undef()->check($end)) 3 13 16
Condition66%2/3
&Undef()->check($start) and &Undef()->check($end)
!ll&&!rl&&r
1303
MC/DC50%1/2
&Undef()->check($start) and &Undef()->check($end)
&Undef()->check($start) &Undef()->check($end)
Truth table66%2/3
A and B
A= &Undef()->check($start)B= &Undef()->check($end)
ABresult
0X0
100
111
2596 3 $start = '';
2597 3 $end = '';
2598 }
2599  
2600 16 $self->_checkIgnored( 'changecom', @ignored );
2601  
2602 16 ▶ $start //= '';
Condition50%1/2
$start //= ""
l!l
160
MC/DC0%0/1
$start //= ""
$start
Truth table50%1/2
A
A= $start
Aresult
11
00
2603 16 ▶ if ( length($start) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $start <= 0) { } 3 13 16
2604 3 $end = '';
2605 }
2606 else {
2607 13 ▶ $end ||= $DEFAULT_COMMENT_END;
Condition66%2/3
$end ||= $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_END
l!l&&r!l&&!r
1210
MC/DC0%0/2
$end ||= $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_END
$end $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_END
Truth table66%2/3
A ||= B
A= $endB= $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_END
ABresult
1X1
011
000
2608 }
2609  
2610 16 $self->_set__comment_start($start);
2611 16 $self->_set__comment_end($end);
2612  
2613 16 return '';
2614 }
2615  
2616 2 ▶ method builtin_changeword (Undef|Str $string?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_changeword: called CC=7 SCAR=20.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 11 0 11
$#_ >= 0 ? : 11 0 11
if ($#_ >= 0) 11 0 11
Type::Tiny::XS::AUTO::TC5($string) or _failed_check(154, "Undef|Str", $string, "exception_class", "Error::TypeTiny::Assertion") 11 0 11
$#_ >= 1 ? : 0 11 11
2617 11 ▶ if ( Undef->check($string) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($string)) 0 11 11
2618 0 $self->logger_error(
2619 'too few arguments to builtin %s',
2620 $self->impl_quote('changeword')
2621 );
2622 0 return '';
2623 }
2624 11 $self->_checkIgnored( 'changeword', @ignored );
2625  
2626 11 $self->word_regexp($string);
2627  
2628 11 return '';
2629 }
2630  
2631 2 ▶ method builtin_m4wrap (@args --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_m4wrap: called CC=3 SCAR=11.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 22 0 22
$#_ >= 0 ? : 22 0 22
2632  
2633 22 my $text = join( ' ', grep { !Undef->check($_) } @args );
2634 22 $self->_m4wrap_push($text);
2635  
2636 22 return '';
2637 }
2638  
2639 0 ▶ method builtin_m4exit (Undef|Str $code?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=1.6
Subroutine BEGIN: called CC=1 SCAR=1.6
Subroutine builtin_m4exit: not called CC=11 SCAR=41.1
Subroutine __ANON__: called CC=1 SCAR=1.6
Subroutine __ANON__: called CC=1 SCAR=1.6
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::AUTO::TC5($code) or _failed_check(155, "Undef|Str", $code, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
2640  
2641 0 $self->_checkIgnored( 'm4exit', @ignored );
2642  
2643 0 ▶ if ( !Undef->check($code) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Undef()->check($code)) 0 0 0
2644 0 ▶ if ( !PositiveOrZeroInt->check($code) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&PositiveOrZeroInt()->check($code)) 0 0 0
2645 0 $self->logger_error(
2646 '%s: %s: does not look like a positive or zero integer',
2647 'm4exit', $code );
2648 0 $code = EXIT_FAILURE;
2649 }
2650 }
2651  
2652 #
2653 # Remove all wrapped text, diversions and mark end of input
2654 #
2655 0 $self->_set___m4wrap( [] );
2656 0 foreach ( $self->_diversions_keys ) {
2657 0 my $number = $_;
2658 0 ▶ if ( Int->check($number) && $number == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Int()->check($number) and $number == 0) 0 0 0
Condition0%0/3
&Int()->check($number) and $number == 0
!ll&&!rl&&r
000
MC/DC0%0/2
&Int()->check($number) and $number == 0
&Int()->check($number) $number == 0
Truth table0%0/3
A and B
A= &Int()->check($number)B= $number == 0
ABresult
0X0
100
111
2659 #
2660 # Diversion 0 is special -;
2661 #
2662 0 next;
2663 }
2664 0 $self->_remove_diversion($number);
2665 }
2666  
2667 0 $self->_set__rc($code);
2668 0 $self->impl_setEoi;
2669  
2670 0 return '';
2671 }
2672  
2673 2 ▶ method _includeFile (Bool $silent, Str $wantedFile --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _includeFile: called CC=20 SCAR=30.7
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 33 0 33
if @_ != 2 0 33 33
$#_ >= 0 ? : 33 0 33
if ($#_ >= 0) 33 0 33
Type::Tiny::XS::Bool($silent) or _failed_check(3, "Bool", $silent, "exception_class", "Error::TypeTiny::Assertion") 33 0 33
$#_ >= 1 ? : 33 0 33
if ($#_ >= 1) 33 0 33
Type::Tiny::XS::Str($wantedFile) or _failed_check(9, "Str", $wantedFile, "exception_class", "Error::TypeTiny::Assertion") 33 0 33
2674  
2675 33 ▶ if ( length($wantedFile) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $wantedFile <= 0) 2 31 33
2676 2 ▶ if ( !$silent ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($silent) 1 1 2
2677 #
2678 # Fake a ENOENT
2679 #
2680 1 ▶ if ( exists &Errno::ENOENT ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists &Errno::ENOENT) { } 1 0 1
2681 1 $! = &Errno::ENOENT;
2682 1 $self->logger_error( 'cannot open %s: %s',
2683 $self->impl_quote($wantedFile), $! );
2684 }
2685 else {
2686 0 $self->logger_error( 'cannot open %s',
2687 $self->impl_quote($wantedFile) );
2688 }
2689 }
2690 2 return '';
2691 }
2692 31 my @paths = ();
2693  
2694 my @includes = (
2695 reverse( $self->_prepend_include_elements ),
2696 File::Spec->curdir(),
2697 reverse( $self->_include_elements ),
2698 31 ▶ ( exists( $ENV{M4PATH} ) && defined( $ENV{M4PATH} ) )
Branch: 1 branch
BranchTrueFalseTotal
exists $ENV{'M4PATH'} && defined $ENV{'M4PATH'} ? : 0 31 31
Condition33%1/3
exists $ENV{"M4PATH"} and defined $ENV{"M4PATH"}
!ll&&!rl&&r
0310
MC/DC0%0/2
exists $ENV{"M4PATH"} and defined $ENV{"M4PATH"}
exists $ENV{"M4PATH"} defined $ENV{"M4PATH"}
Truth table33%1/3
A and B
A= exists $ENV{"M4PATH"}B= defined $ENV{"M4PATH"}
ABresult
0X0
100
111
2699 ? M4PATH->List
2700 : ()
2701 );
2702  
2703 31 my $file;
2704 31 ▶ if ( File::Spec->file_name_is_absolute($wantedFile) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ('File::Spec'->file_name_is_absolute($wantedFile)) { } 4 27 31
2705 4 $file = $wantedFile;
2706 }
2707 else {
2708 2 ▶ use filetest 'access';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
2709 27 foreach (
2710 54 grep { -r $_ }
2711 54 map { File::Spec->catfile( $_, $wantedFile ) } @includes
2712 )
2713 {
2714 25 $file = $_;
2715 25 last;
2716 }
2717 }
2718  
2719 31 ▶ if ( !$file ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($file) 2 29 31
2720 #
2721 # It is guaranteed that #includes have at least one element.
2722 # Therefore, $! should be setted
2723 #
2724 2 ▶ if ( !$silent ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($silent) 1 1 2
2725 1 $self->logger_error( 'cannot open %s: %s',
2726 $self->impl_quote($wantedFile), $! );
2727 }
2728 2 return '';
2729 }
2730  
2731 29 ▶ if ( $self->_canDebug('p') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_canDebug("p")) 0 29 29
2732 0 $self->logger_debug(
2733 'path search for %s found %s',
2734 $self->impl_quote($wantedFile),
2735 $self->impl_quote($file)
2736 );
2737 }
2738  
2739 29 my $content = '';
2740 29 my $previousFile = $self->__file__;
2741 29 my $previousLine = $self->__line__;
2742 29 $self->impl_parseIncrementalFile( $file, $silent, false, \$content );
2743 29 ▶ if ( $self->_canDebug('i') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_canDebug("i")) 0 29 29
2744 0 $self->logger_debug(
2745 'input reverted to %s, line %d',
2746 $self->impl_quote($previousFile),
2747 $previousLine
2748 );
2749 }
2750 29 $self->_set___file__($previousFile);
2751 29 $self->_set___line__($previousLine);
2752  
2753 29 return $content;
2754 }
2755  
2756 2 ▶ method builtin_include (Undef|Str $file, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine builtin_include: called CC=8 SCAR=21.6
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 31 0 31
if @_ < 1 0 31 31
$#_ >= 0 ? : 31 0 31
if ($#_ >= 0) 31 0 31
Type::Tiny::XS::AUTO::TC5($file) or _failed_check(156, "Undef|Str", $file, "exception_class", "Error::TypeTiny::Assertion") 31 0 31
$#_ >= 1 ? : 0 31 31
2757 31 ▶ if ( Undef->check($file) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($file)) 0 31 31
2758 0 $self->logger_error(
2759 'too few arguments to builtin %s',
2760 $self->impl_quote('include')
2761 );
2762 0 return '';
2763 }
2764 31 $self->_checkIgnored( 'include', @ignored );
2765  
2766 31 return $self->_includeFile( false, $file );
2767 }
2768  
2769 2 ▶ method builtin_sinclude (Undef|Str $file, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine builtin_sinclude: called CC=8 SCAR=21.6
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 2 0 2
if @_ < 1 0 2 2
$#_ >= 0 ? : 2 0 2
if ($#_ >= 0) 2 0 2
Type::Tiny::XS::AUTO::TC5($file) or _failed_check(157, "Undef|Str", $file, "exception_class", "Error::TypeTiny::Assertion") 2 0 2
$#_ >= 1 ? : 0 2 2
2770 2 ▶ if ( Undef->check($file) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($file)) 0 2 2
2771 0 $self->logger_error(
2772 'too few arguments to builtin %s',
2773 $self->impl_quote('sinclude')
2774 );
2775 0 return '';
2776 }
2777 2 $self->_checkIgnored( 'sinclude', @ignored );
2778  
2779 2 return $self->_includeFile( true, $file );
2780 }
2781  
2782 2 ▶ method _apply_diversion (Int $number, ConsumerOf ['IO::Handle'] $fh --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _apply_diversion: called CC=13 SCAR=26.2
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 218 0 218
if @_ != 2 0 218 218
$#_ >= 0 ? : 218 0 218
if ($#_ >= 0) 218 0 218
Type::Tiny::XS::Int($number) or _failed_check(13, "Int", $number, "exception_class", "Error::TypeTiny::Assertion") 218 0 218
$#_ >= 1 ? : 218 0 218
if ($#_ >= 1) 218 0 218
do { builtin::blessed($fh) and do { my $method = $fh->can("DOES") || $fh->can("isa"); $fh->$method("IO::Handle") } } or _failed_check(158, "ConsumerOf[\"IO::Handle\"]", $fh, "exception_class", "Error::TypeTiny::Assertion") 218 0 218
Condition33%2/6
builtin::blessed($fh) && do { my $method = $fh->can('DOES') || $fh->can('isa'); $fh->$method('IO::Handle') }
!ll&&!rl&&r
00218
$fh->can('DOES') || $fh->can('isa')
l!l&&r!l&&!r
21800
MC/DC0%0/2
builtin::blessed($fh) && do { my $method = $fh->can('DOES') || $fh->can('isa'); $fh->$method('IO::Handle') }
builtin::blessed($fh) do { my $method = $fh->can('DOES') || $fh->can('isa'); $fh->$method('IO::Handle') }
MC/DC0%0/2
$fh->can('DOES') || $fh->can('isa')
$fh->can('DOES') $fh->can('isa')
Truth table33%1/3
A && B
A= builtin::blessed($fh)B= do { my $method = $fh->can('DOES') || $fh->can('isa'); $fh->$method('IO::Handle') }
ABresult
0X0
100
111
Truth table33%1/3
A || B
A= $fh->can('DOES')B= $fh->can('isa')
ABresult
1X1
011
000
2783 my $index
2784 246 ▶ = $self->_lastDiversionNumbers_first_index( sub { $_ == $number }
Subroutine __ANON__: called CC=1 SCAR=0.0
2785 218 );
2786 218 ▶ if ( $index >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index >= 0) 185 33 218
2787 185 $self->_lastDiversionNumbers_splice( $index, 1 );
2788 }
2789 218 $self->_lastDiversionNumbers_push($number);
2790 218 ▶ if ( !$self->_diversions_exists($number) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_diversions_exists($number)) 33 185 218
2791 33 $self->_diversions_set( $number, $fh );
2792 }
2793 218 $fh->autoflush(1);
2794 218 $self->_set__lastDiversion($fh);
2795  
2796 218 return;
2797 }
2798  
2799 2 ▶ method _remove_diversion (Int $number --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _remove_diversion: called CC=7 SCAR=19.8
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 33 0 33
if @_ != 1 0 33 33
$#_ >= 0 ? : 33 0 33
if ($#_ >= 0) 33 0 33
Type::Tiny::XS::Int($number) or _failed_check(13, "Int", $number, "exception_class", "Error::TypeTiny::Assertion") 33 0 33
2800 my $index
2801 37 ▶ = $self->_lastDiversionNumbers_first_index( sub { $_ == $number }
Subroutine __ANON__: called CC=1 SCAR=0.0
2802 33 );
2803 33 ▶ if ( $index >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index >= 0) { } 33 0 33
2804 33 $self->_lastDiversionNumbers_splice( $index, 1 );
2805 33 $self->_diversions_delete($number);
2806 }
2807 else {
2808 #
2809 # This should not happen
2810 #
2811 0 $self->logger_error(
2812 '%s: cannot find internal diversion number %d',
2813 'divert', $number );
2814 }
2815 #
2816 # We don't know the $fh of previous diversion,
2817 # it is stored in diversions hash.
2818 #
2819 33 $self->_set__lastDiversion(
2820 $self->_diversions_get( $self->builtin_divnum ) );
2821 33 return;
2822 }
2823  
2824 2 ▶ method builtin_divert (Undef|Str $number?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_divert: called CC=12 SCAR=25.6
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 218 0 218
$#_ >= 0 ? : 46 172 218
if ($#_ >= 0) 46 172 218
Type::Tiny::XS::AUTO::TC5($number) or _failed_check(159, "Undef|Str", $number, "exception_class", "Error::TypeTiny::Assertion") 46 0 46
$#_ >= 1 ? : 0 218 218
2825 218 $self->_checkIgnored( 'divert', @ignored );
2826  
2827 218 ▶ $number //= 0;
Condition100%2/2
$number //= 0
l!l
46172
MC/DC100%1/1
$number //= 0
$number
Truth table100%2/2
A
A= $number
Aresult
11
00
2828 218 ▶ if ( length("$number") <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length "$number" <= 0) 1 217 218
2829 1 $self->logger_warn( 'empty string treated as 0 in builtin %s',
2830 $self->impl_quote('divert') );
2831 1 $number = 0;
2832 }
2833 218 ▶ if ( !Int->check($number) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Int()->check($number)) 0 218 218
2834 0 $self->logger_error( '%s: %s: does not look like an integer',
2835 'divert', $number );
2836 0 return '';
2837 }
2838  
2839 218 my $fh;
2840 218 ▶ if ( $number == 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($number == 0) { } 176 42 218
2841 #
2842 # Diversion number 0 is a noop and always goes to STDOUT.
2843 # We will just make sure this is current diversion number.
2844 # Per def this diversion always exist.
2845 #
2846 176 $fh = $self->_diversions_get($number);
2847 }
2848 else {
2849 42 ▶ if ( !$self->_diversions_exists($number) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->_diversions_exists($number)) { } 33 9 42
2850 #
2851 # Create diversion
2852 #
2853 33 ▶ try {
Subroutine __ANON__: called CC=2 SCAR=9.2
2854 33 ▶ if ( $self->_divert_type eq 'memory' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_divert_type eq 'memory') { } 33 0 33
2855 33 $fh = IO::Scalar->new;
2856 }
2857 else {
2858 0 $fh = File::Temp->new;
2859 #
2860 # We do not want to be exposed to any wide-character
2861 # warning
2862 #
2863 0 binmode($fh);
2864 }
2865 }
2866 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
2867 0 $self->logger_error("$_");
2868 0 return;
2869 33 };
2870 33 ▶ if ( Undef->check($fh) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($fh)) 0 33 33
2871 0 return '';
2872 }
2873 }
2874 else {
2875 #
2876 # Get diversion $fh
2877 #
2878 9 $fh = $self->_diversions_get($number);
2879 }
2880 }
2881 #
2882 # Make sure latest diversion number is $number
2883 #
2884 218 $self->_apply_diversion( $number, $fh );
2885 218 return '';
2886 }
2887  
2888 2 ▶ method _diversions_sortedKeys {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _diversions_sortedKeys: called CC=2 SCAR=6.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 145 0 145
2889 145 return sort { $a <=> $b } $self->_diversions_keys;
2890 }
2891  
2892 2 ▶ method builtin_undivert (Str @diversions --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_undivert: called CC=14 SCAR=26.4
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 157 0 157
$#_ >= 0 ? : 12 145 157
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 15 0 15
2893  
2894 #
2895 # Undiverting the empty string is the same as specifying diversion 0
2896 #
2897 157 foreach ( 0 .. $#diversions ) {
2898 15 ▶ if ( length( $diversions[$_] ) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $diversions[$_] <= 0) 1 14 15
2899 1 $diversions[$_] = '0';
2900 }
2901 }
2902  
2903 157 ▶ if ( !@diversions ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@diversions) 145 12 157
2904 145 @diversions = $self->_diversions_sortedKeys;
2905 }
2906  
2907 157 foreach (@diversions) {
2908 186 my $number = $_;
2909 186 ▶ if ( Int->check($number) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Int()->check($number)) { } 183 3 186
2910 #
2911 # Undiverting the current diversion, or number 0,
2912 # or a unknown diversion is silently ignored.
2913 #
2914 183 ▶ if ( $number == $self->builtin_divnum
Branch: 1 branch
BranchTrueFalseTotal
if ($number == $self->builtin_divnum or $number == 0 or not $self->_diversions_exists($number)) 150 33 183
Condition100%6/6
$number == $self->builtin_divnum or $number == 0 or not $self->_diversions_exists($number)
l!l&&r!l&&!r
148233
$number == $self->builtin_divnum or $number == 0
l!l&&r!l&&!r
147135
MC/DC100%3/3
$number == $self->builtin_divnum or $number == 0 or not $self->_diversions_exists($number)
$number == $self->builtin_divnum $number == 0 not $self->_diversions_exists($number)
Truth table100%4/4
A or B or not(C)
A= $number == $self->builtin_divnumB= $number == 0C= not $self->_diversions_exists($number)
ABCresult
1XX1
01X1
0011
0000
2915 || $number == 0
2916 || !$self->_diversions_exists($number) )
2917 {
2918 150 next;
2919 }
2920 #
2921 # Only positive numbers are merged
2922 #
2923 33 ▶ if ( $number > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($number > 0) { } 18 15 33
2924 #
2925 # This is per-def a IO::Handle consumer
2926 #
2927 18 my $fh = $self->_diversions_get($number);
2928 #
2929 # Get its size
2930 #
2931 18 $fh->seek( 0, SEEK_END );
2932 18 my $size = $fh->tell;
2933 #
2934 # Go to the beginning
2935 #
2936 18 $fh->seek( 0, SEEK_SET );
2937 #
2938 # Read it
2939 #
2940 18 my $content = '';
2941 18 $fh->read( $content, $size );
2942 #
2943 # Now we can really remove this diversion
2944 #
2945 18 $self->_remove_diversion($number);
2946 #
2947 # And append to the now-current diversion
2948 #
2949 18 $self->impl_appendValue($content);
2950 }
2951 else {
2952 15 $self->_remove_diversion($number);
2953 }
2954 }
2955 else {
2956 #
2957 # Treated as name of a file
2958 #
2959 3 $self->impl_appendValue( $self->builtin_include($number) );
2960 }
2961 }
2962  
2963 157 return '';
2964 }
2965  
2966 2 ▶ method builtin_divnum (@ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_divnum: called CC=3 SCAR=11.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 225 0 225
$#_ >= 0 ? : 0 225 225
2967 225 $self->_checkIgnored( 'divnum', @ignored );
2968  
2969 225 return $self->_lastDiversionNumbers_get(-1);
2970 }
2971  
2972 2 ▶ method builtin_len (Undef|Str $string?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_len: called CC=8 SCAR=21.6
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 6 0 6
$#_ >= 0 ? : 6 0 6
if ($#_ >= 0) 6 0 6
Type::Tiny::XS::AUTO::TC5($string) or _failed_check(160, "Undef|Str", $string, "exception_class", "Error::TypeTiny::Assertion") 6 0 6
$#_ >= 1 ? : 0 6 6
2973 6 ▶ if ( Undef->check($string) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($string)) 0 6 6
2974 0 $self->logger_error( 'too few arguments to builtin %s',
2975 $self->impl_quote('len') );
2976 0 return '';
2977 }
2978 6 $self->_checkIgnored( 'len', @ignored );
2979  
2980 6 ▶ $string //= '';
Condition50%1/2
$string //= ""
l!l
60
MC/DC0%0/1
$string //= ""
$string
Truth table50%1/2
A
A= $string
Aresult
11
00
2981 6 return length($string);
2982 }
2983  
2984 2 ▶ method builtin_index (Undef|Str $string?, Undef|Str $substring?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_index: called CC=12 SCAR=25.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 7 0 7
$#_ >= 0 ? : 6 1 7
if ($#_ >= 0) 6 1 7
Type::Tiny::XS::AUTO::TC5($string) or _failed_check(161, "Undef|Str", $string, "exception_class", "Error::TypeTiny::Assertion") 6 0 6
$#_ >= 1 ? : 5 2 7
if ($#_ >= 1) 5 2 7
Type::Tiny::XS::AUTO::TC5($substring) or _failed_check(162, "Undef|Str", $substring, "exception_class", "Error::TypeTiny::Assertion") 5 0 5
$#_ >= 2 ? : 0 7 7
2985 7 ▶ if ( Undef->check($string) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($string)) 1 6 7
2986 1 $self->logger_error(
2987 'too few arguments to builtin %s',
2988 $self->impl_quote('index')
2989 );
2990 1 return '';
2991 }
2992 6 ▶ if ( Undef->check($substring) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($substring)) 1 5 6
2993 1 $self->logger_error(
2994 'too few arguments to builtin %s',
2995 $self->impl_quote('index')
2996 );
2997 1 return 0;
2998 }
2999 5 $self->_checkIgnored( 'index', @ignored );
3000  
3001 5 ▶ if ( Undef->check($substring) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($substring)) 0 5 5
3002 0 $self->logger_warn( '%s: undefined string to search for',
3003 'index', $_ );
3004 0 $substring = '';
3005 }
3006 5 return index( $string, $substring );
3007 }
3008  
3009 2 ▶ method builtin_regexp (Undef|Str $string?, Undef|Str $regexpString?, Undef|Str $replacement?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_regexp: called CC=18 SCAR=29.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 29 0 29
$#_ >= 0 ? : 29 0 29
if ($#_ >= 0) 29 0 29
Type::Tiny::XS::AUTO::TC5($string) or _failed_check(163, "Undef|Str", $string, "exception_class", "Error::TypeTiny::Assertion") 29 0 29
$#_ >= 1 ? : 28 1 29
if ($#_ >= 1) 28 1 29
Type::Tiny::XS::AUTO::TC5($regexpString) or _failed_check(164, "Undef|Str", $regexpString, "exception_class", "Error::TypeTiny::Assertion") 28 0 28
$#_ >= 2 ? : 16 13 29
if ($#_ >= 2) 16 13 29
Type::Tiny::XS::AUTO::TC5($replacement) or _failed_check(165, "Undef|Str", $replacement, "exception_class", "Error::TypeTiny::Assertion") 16 0 16
$#_ >= 3 ? : 0 29 29
3010 29 ▶ if ( Undef->check($string) || Undef->check($regexpString) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($string) or &Undef()->check($regexpString)) 1 28 29
Condition66%2/3
&Undef()->check($string) or &Undef()->check($regexpString)
l!l&&r!l&&!r
0128
MC/DC50%1/2
&Undef()->check($string) or &Undef()->check($regexpString)
&Undef()->check($string) &Undef()->check($regexpString)
Truth table66%2/3
A or B
A= &Undef()->check($string)B= &Undef()->check($regexpString)
ABresult
1X1
011
000
3011 1 $self->logger_error(
3012 'too few arguments to builtin %s',
3013 $self->impl_quote('regexp')
3014 );
3015 1 return '0';
3016 }
3017  
3018 28 my $r = MarpaX::Languages::M4::Impl::Regexp->new();
3019 28 ▶ if (!$r->regexp_compile( $self, $self->_regexp_type, $regexpString ) )
Branch: 1 branch
BranchTrueFalseTotal
unless ($r->regexp_compile($self, $self->_regexp_type, $regexpString)) 1 27 28
3020 {
3021 1 return '';
3022 }
3023  
3024 27 $self->_checkIgnored( 'regexp', @ignored );
3025  
3026 27 ▶ if ( Undef->check($replacement) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($replacement)) { } 11 16 27
3027 #
3028 # Expands to the index of first match in string
3029 #
3030 11 ▶ if ( $r->regexp_exec( $self, $string ) >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_exec($self, $string) >= 0) { } 7 4 11
3031 7 return $r->regexp_lpos_get(0);
3032 }
3033 else {
3034 4 return -1;
3035 }
3036 }
3037 else {
3038 16 ▶ if ( $r->regexp_exec( $self, $string ) >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_exec($self, $string) >= 0) { } 14 2 16
3039 14 return $r->regexp_substitute( $self, $string, $replacement );
3040 }
3041 else {
3042 2 return '';
3043 }
3044 }
3045 }
3046  
3047 2 ▶ method builtin_substr (Undef|Str $string?, Undef|Str $from?, Undef|Str $length?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_substr: called CC=19 SCAR=30.2
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 4 0 4
$#_ >= 0 ? : 4 0 4
if ($#_ >= 0) 4 0 4
Type::Tiny::XS::AUTO::TC5($string) or _failed_check(166, "Undef|Str", $string, "exception_class", "Error::TypeTiny::Assertion") 4 0 4
$#_ >= 1 ? : 3 1 4
if ($#_ >= 1) 3 1 4
Type::Tiny::XS::AUTO::TC5($from) or _failed_check(167, "Undef|Str", $from, "exception_class", "Error::TypeTiny::Assertion") 3 0 3
$#_ >= 2 ? : 1 3 4
if ($#_ >= 2) 1 3 4
Type::Tiny::XS::AUTO::TC5($length) or _failed_check(168, "Undef|Str", $length, "exception_class", "Error::TypeTiny::Assertion") 1 0 1
$#_ >= 3 ? : 0 4 4
3048 4 ▶ if ( Undef->check($string) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($string)) 0 4 4
3049 0 $self->logger_error(
3050 'too few arguments to builtin %s',
3051 $self->impl_quote('substr')
3052 );
3053 0 return '';
3054 }
3055 4 ▶ if ( Undef->check($from) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($from)) 1 3 4
3056 1 $self->logger_error(
3057 'too few arguments to builtin %s',
3058 $self->impl_quote('substr')
3059 );
3060 1 return $string;
3061 }
3062 3 $self->_checkIgnored( 'substr', @ignored );
3063  
3064 3 ▶ if ( length($from) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $from <= 0) 1 2 3
3065 1 $self->logger_warn( '%s: empty string treated as zero',
3066 'substr' );
3067 1 $from = 0;
3068 }
3069  
3070 3 ▶ if ( !PositiveOrZeroInt->check($from) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&PositiveOrZeroInt()->check($from)) 0 3 3
3071 0 $self->logger_error(
3072 '%s: %s: does not look like a positive or zero integer',
3073 'substr', $from );
3074 0 return '';
3075 }
3076 3 ▶ if ( Str->check($length) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Str()->check($length)) 1 2 3
3077 1 ▶ if ( !Int->check($length) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Int()->check($length)) 0 1 1
3078 0 $self->logger_error( '%s: %s: does not look like an integer',
3079 'substr', $length );
3080 0 return '';
3081 }
3082 }
3083  
3084 3 ▶ return ( !Undef->check($length) )
Branch: 1 branch
BranchTrueFalseTotal
!&Undef()->check($length) ? : 1 2 3
3085 ? substr( $string, $from, $length )
3086 : substr( $string, $from );
3087 }
3088  
3089 2 ▶ method _expandRanges (Str $range --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine _expandRanges: called CC=14 SCAR=26.5
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 25 0 25
if @_ != 1 0 25 25
$#_ >= 0 ? : 25 0 25
if ($#_ >= 0) 25 0 25
Type::Tiny::XS::Str($range) or _failed_check(9, "Str", $range, "exception_class", "Error::TypeTiny::Assertion") 25 0 25
3090 25 my $rc = '';
3091 25 my @chars = split( //, $range );
3092 25 ▶ for (
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $#chars) 56 24 80
3093 my $from = undef, my $i = 0;
3094 $i <= $#chars;
3095 $from = ord( $chars[ $i++ ] )
3096 )
3097 {
3098 56 my $s = $chars[$i];
3099 56 ▶ if ( $s eq '-' && defined($from) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s eq '-' and defined $from) { } 26 30 56
Condition100%3/3
$s eq "-" and defined $from
!ll&&!rl&&r
29126
MC/DC100%2/2
$s eq "-" and defined $from
$s eq "-" defined $from
Truth table100%3/3
A and B
A= $s eq "-"B= defined $from
ABresult
0X0
100
111
3100 26 ▶ my $to = ( ++$i <= $#chars ) ? ord( $chars[$i] ) : undef;
Branch: 1 branch
BranchTrueFalseTotal
++$i <= $#chars ? : 25 1 26
3101 26 ▶ if ( !defined($to) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $to) { } 1 25 26
elsif ($from <= $to) { } 23 2 25
3102 #
3103 # Trailing dash
3104 #
3105 1 $rc .= '-';
3106 1 last;
3107 }
3108 elsif ( $from <= $to ) {
3109 23 ▶ while ( $from++ < $to ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($from++ < $to) 508 23 531
3110 508 $rc .= chr($from);
3111 }
3112 }
3113 else {
3114 2 ▶ while ( --$from >= $to ) {
Branch: 1 branch
BranchTrueFalseTotal
if (--$from >= $to) 27 2 29
3115 27 $rc .= chr($from);
3116 }
3117 }
3118 }
3119 else {
3120 30 $rc .= $chars[$i];
3121 }
3122 }
3123 25 return $rc;
3124 }
3125  
3126 2 ▶ method builtin_translit (Undef|Str $string?, Undef|Str $from?, Undef|Str $to?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_translit: called CC=24 SCAR=32.5
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 16 0 16
$#_ >= 0 ? : 16 0 16
if ($#_ >= 0) 16 0 16
Type::Tiny::XS::AUTO::TC5($string) or _failed_check(169, "Undef|Str", $string, "exception_class", "Error::TypeTiny::Assertion") 16 0 16
$#_ >= 1 ? : 16 0 16
if ($#_ >= 1) 16 0 16
Type::Tiny::XS::AUTO::TC5($from) or _failed_check(170, "Undef|Str", $from, "exception_class", "Error::TypeTiny::Assertion") 16 0 16
$#_ >= 2 ? : 15 1 16
if ($#_ >= 2) 15 1 16
Type::Tiny::XS::AUTO::TC5($to) or _failed_check(171, "Undef|Str", $to, "exception_class", "Error::TypeTiny::Assertion") 15 0 15
$#_ >= 3 ? : 0 16 16
3127 16 ▶ if ( Undef->check($string) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($string)) 0 16 16
3128 0 $self->logger_error(
3129 'too few arguments to builtin %s',
3130 $self->impl_quote('translit')
3131 );
3132 0 return '';
3133 }
3134 16 ▶ if ( Undef->check($from) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($from)) 0 16 16
3135 0 $self->logger_error(
3136 'too few arguments to builtin %s',
3137 $self->impl_quote('translit')
3138 );
3139 0 return $string;
3140 }
3141 16 $self->_checkIgnored( 'translit', @ignored );
3142  
3143 16 my $fromLength = length($from);
3144 16 ▶ if ( $fromLength <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fromLength <= 0) 0 16 16
3145 0 return '';
3146 }
3147  
3148 #
3149 # We duplicate the algorithm of GNU m4: translit
3150 # is part of M4 official spec, so we cannot use
3151 # perl's tr, which is not stricly equivalent.
3152 # De-facto, we will get GNU behaviour.
3153 #
3154 16 ▶ $to //= '';
Condition100%2/2
$to //= ""
l!l
151
MC/DC100%1/1
$to //= ""
$to
Truth table100%2/2
A
A= $to
Aresult
11
00
3155 16 ▶ if ( index( $to, '-' ) >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($to, "-") != -1) 11 5 16
3156 11 $to = $self->_expandRanges($to);
3157 }
3158 #
3159 # In case of small $from, let's go to the range algorithm
3160 # anyway.
3161 # GNU m4 implementation is correct doing direct
3162 # transformation if there is only one or two bytes.
3163 # Well, for us, I'd say one of two characters.
3164  
3165 16 ▶ if ( index( $from, '-' ) >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($from, "-") != -1) 14 2 16
3166 14 $from = $self->_expandRanges($from);
3167 }
3168  
3169 16 my %map = ();
3170 16 my $toMaxIndice = length($to) - 1;
3171 16 my $ito = 0;
3172 16 foreach ( split( //, $from ) ) {
3173 306 ▶ if ( !exists( $map{$_} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $map{$_}) 305 1 306
3174 305 ▶ if ( $ito <= $toMaxIndice ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ito <= $toMaxIndice) { } 277 28 305
3175 277 $map{$_} = substr( $to, $ito, 1 );
3176 }
3177 else {
3178 28 $map{$_} = '';
3179 }
3180 }
3181 306 ▶ if ( $ito <= $toMaxIndice ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ito <= $toMaxIndice) 278 28 306
3182 278 $ito++;
3183 }
3184 }
3185  
3186 16 my $rc = '';
3187 16 foreach ( split( //, $string ) ) {
3188 129 ▶ if ( exists( $map{$_} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $map{$_}) { } 47 82 129
3189 47 $rc .= $map{$_};
3190 }
3191 else {
3192 82 $rc .= $_;
3193 }
3194 }
3195  
3196 16 return $rc;
3197 }
3198  
3199 #
3200 # Almost same thing as regexp but with a /g modifier
3201 #
3202 2 ▶ method builtin_patsubst (Undef|Str $string?, Undef|Str $regexpString?, Undef|Str $replacement?, @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_patsubst: called CC=22 SCAR=31.5
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 11 branches
BranchTrueFalseTotal
@_ ? : 12 0 12
$#_ >= 0 ? : 12 0 12
if ($#_ >= 0) 12 0 12
Type::Tiny::XS::AUTO::TC5($string) or _failed_check(172, "Undef|Str", $string, "exception_class", "Error::TypeTiny::Assertion") 12 0 12
$#_ >= 1 ? : 11 1 12
if ($#_ >= 1) 11 1 12
Type::Tiny::XS::AUTO::TC5($regexpString) or _failed_check(173, "Undef|Str", $regexpString, "exception_class", "Error::TypeTiny::Assertion") 11 0 11
$#_ >= 2 ? : 9 3 12
if ($#_ >= 2) 9 3 12
Type::Tiny::XS::AUTO::TC5($replacement) or _failed_check(174, "Undef|Str", $replacement, "exception_class", "Error::TypeTiny::Assertion") 9 0 9
$#_ >= 3 ? : 0 12 12
3203 12 ▶ if ( Undef->check($string) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($string)) 0 12 12
3204 0 $self->logger_error(
3205 'too few arguments to builtin %s',
3206 $self->impl_quote('patsubst')
3207 );
3208 0 return '';
3209 }
3210  
3211 12 ▶ if ( Undef->check($regexpString) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($regexpString)) 1 11 12
3212 1 $self->logger_error(
3213 'too few arguments to builtin %s',
3214 $self->impl_quote('patsubst')
3215 );
3216 1 return $string;
3217 }
3218  
3219 11 my $r = MarpaX::Languages::M4::Impl::Regexp->new();
3220 11 ▶ if (!$r->regexp_compile( $self, $self->_regexp_type, $regexpString ) )
Branch: 1 branch
BranchTrueFalseTotal
unless ($r->regexp_compile($self, $self->_regexp_type, $regexpString)) 0 11 11
3221 {
3222 0 return '';
3223 }
3224  
3225 11 $self->_checkIgnored( 'patsubst', @ignored );
3226  
3227 #
3228 # If not supplied, default replacement is deletion
3229 #
3230 11 ▶ $replacement //= '';
Condition100%2/2
$replacement //= ""
l!l
92
MC/DC100%1/1
$replacement //= ""
$replacement
Truth table100%2/2
A
A= $replacement
Aresult
11
00
3231 #
3232 # Copy of the GNU M4's algorithm
3233 #
3234 11 my $offset = 0;
3235 11 my $length = length($string);
3236 11 my $rc = '';
3237 11 ▶ while ( $offset <= $length ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($offset <= $length) 39 3 42
3238 39 my $matchPos = $r->regexp_exec( $self, $string, $offset );
3239 39 ▶ if ( $matchPos < 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($matchPos < 0) 8 31 39
3240 8 ▶ if ( $matchPos < -1 ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($matchPos < -1) { } 0 8 8
elsif ($offset < $length) { } 3 5 8
3241 0 $self->logger_error(
3242 'error matching regular expression %s',
3243 $self->impl_quote($regexpString)
3244 );
3245 }
3246 elsif ( $offset < $length ) {
3247 3 $rc .= substr( $string, $offset );
3248 }
3249 8 last;
3250 }
3251 31 ▶ if ( $matchPos > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($matchPos > 0) 23 8 31
3252 #
3253 # Part of the string skipped by regexp_exec
3254 #
3255 23 $rc .= substr( $string, $offset, $matchPos - $offset );
3256 }
3257 #
3258 # Do substitution in string:
3259 #
3260 31 $rc .= $r->regexp_substitute( $self, $string, $replacement );
3261 #
3262 # Continue to the end of the match
3263 #
3264 31 $offset = $r->regexp_rpos_get(0);
3265 #
3266 # If the regexp matched an empty string,
3267 # advance once more
3268 #
3269 31 ▶ if ( $r->regexp_lpos_get(0) == $offset ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_lpos_get(0) == $offset) 15 16 31
3270  
3271 15 $rc .= substr( $string, $offset++, 1 );
3272 }
3273 }
3274  
3275 11 return $rc;
3276 }
3277  
3278 2 ▶ method builtin_format (Undef|Str $format?, Str @arguments --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine builtin_format: called CC=9 SCAR=23.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 18 0 18
$#_ >= 0 ? : 18 0 18
if ($#_ >= 0) 18 0 18
Type::Tiny::XS::AUTO::TC5($format) or _failed_check(175, "Undef|Str", $format, "exception_class", "Error::TypeTiny::Assertion") 18 0 18
$#_ >= 1 ? : 18 0 18
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 32 0 32
3279 18 ▶ if ( Undef->check($format) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($format)) 0 18 18
3280 0 $self->logger_error(
3281 'too few arguments to builtin %s',
3282 $self->impl_quote('format')
3283 );
3284 0 return '';
3285 }
3286 18 my $rc = '';
3287 18 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
3288 18 $rc = sprintf( $format, @arguments );
3289 }
3290 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3291 0 $self->logger_error( 'format: %s', "$_" );
3292 0 return;
3293 18 };
3294 18 return $rc;
3295 }
3296  
3297 0 ▶ method builtin_incr (Undef|Str $number?, Str @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine builtin_incr: called CC=12 SCAR=27.0
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 78 0 78
$#_ >= 0 ? : 78 0 78
if ($#_ >= 0) 78 0 78
Type::Tiny::XS::AUTO::TC5($number) or _failed_check(176, "Undef|Str", $number, "exception_class", "Error::TypeTiny::Assertion") 78 0 78
$#_ >= 1 ? : 0 78 78
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3298 78 $self->_checkIgnored( 'incr', @ignored );
3299 78 ▶ $number //= '';
Condition50%1/2
$number //= ""
l!l
780
MC/DC0%0/1
$number //= ""
$number
Truth table50%1/2
A
A= $number
Aresult
11
00
3300 78 ▶ if ( length($number) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $number <= 0) 1 77 78
3301 1 $self->logger_error( 'empty string treated as 0 in builtin %s',
3302 $self->impl_quote('incr') );
3303 1 $number = 0;
3304 }
3305 78 ▶ if ( !Int->check($number) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Int()->check($number)) 0 78 78
3306 0 $self->logger_error(
3307 '%s: %s: does not look like an integer',
3308 $self->impl_quote('incr'),
3309 $self->impl_quote($number)
3310 );
3311 0 return '';
3312 }
3313 78 my $rc = '';
3314 78 ▶ if ( $self->_integer_type eq 'native' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_integer_type eq 'native') { } 0 78 78
3315 2 ▶ use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
3316 0 $rc = $number + 1;
3317 }
3318 else {
3319 78 $rc = $self->builtin_eval("$number + 1");
3320 }
3321 78 return $rc;
3322 }
3323  
3324 0 ▶ method builtin_decr (Undef|Str $number?, Str @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine builtin_decr: called CC=12 SCAR=27.0
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 21 0 21
$#_ >= 0 ? : 21 0 21
if ($#_ >= 0) 21 0 21
Type::Tiny::XS::AUTO::TC5($number) or _failed_check(177, "Undef|Str", $number, "exception_class", "Error::TypeTiny::Assertion") 21 0 21
$#_ >= 1 ? : 0 21 21
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3325 21 $self->_checkIgnored( 'decr', @ignored );
3326 21 ▶ $number //= '';
Condition50%1/2
$number //= ""
l!l
210
MC/DC0%0/1
$number //= ""
$number
Truth table50%1/2
A
A= $number
Aresult
11
00
3327 21 ▶ if ( length($number) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $number <= 0) 1 20 21
3328 1 $self->logger_error( 'empty string treated as 0 in builtin %s',
3329 $self->impl_quote('decr') );
3330 1 $number = 0;
3331 }
3332 21 ▶ if ( !Int->check($number) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Int()->check($number)) 0 21 21
3333 0 $self->logger_error(
3334 '%s: %s: does not look like an integer',
3335 $self->impl_quote('decr'),
3336 $self->impl_quote($number)
3337 );
3338 0 return '';
3339 }
3340 21 my $rc = '';
3341 21 ▶ if ( $self->_integer_type eq 'native' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_integer_type eq 'native') { } 0 21 21
3342 2 ▶ use integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
3343 0 $rc = $number - 1;
3344 }
3345 else {
3346 21 $rc = $self->builtin_eval("$number - 1");
3347 }
3348 21 return $rc;
3349 }
3350  
3351 0 ▶ method builtin_eval (Undef|Str $expression?, Undef|Str $radix?, Undef|Str $width?, Str @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine builtin_eval: called CC=25 SCAR=33.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 12 branches
BranchTrueFalseTotal
@_ ? : 171 0 171
$#_ >= 0 ? : 171 0 171
if ($#_ >= 0) 171 0 171
Type::Tiny::XS::AUTO::TC5($expression) or _failed_check(178, "Undef|Str", $expression, "exception_class", "Error::TypeTiny::Assertion") 171 0 171
$#_ >= 1 ? : 10 161 171
if ($#_ >= 1) 10 161 171
Type::Tiny::XS::AUTO::TC5($radix) or _failed_check(179, "Undef|Str", $radix, "exception_class", "Error::TypeTiny::Assertion") 10 0 10
$#_ >= 2 ? : 5 166 171
if ($#_ >= 2) 5 166 171
Type::Tiny::XS::AUTO::TC5($width) or _failed_check(180, "Undef|Str", $width, "exception_class", "Error::TypeTiny::Assertion") 5 0 5
$#_ >= 3 ? : 0 171 171
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3352 171 ▶ if ( Undef->check($expression) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($expression)) 0 171 171
3353 0 $self->logger_error(
3354 'too few arguments to builtin %s',
3355 $self->impl_quote('decr')
3356 );
3357 0 return '';
3358 }
3359 171 $self->_checkIgnored( 'eval', @ignored );
3360  
3361 171 ▶ if ( Undef->check($expression) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($expression)) 0 171 171
3362 0 $self->logger_error( '%s: empty string treated as zero',
3363 $self->impl_quote('eval') );
3364 0 return 0;
3365 }
3366 #
3367 # Validate radix
3368 #
3369 171 ▶ if ( Undef->check($radix) || length($radix) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($radix) or length $radix <= 0) 163 8 171
Condition100%3/3
&Undef()->check($radix) or length $radix <= 0
l!l&&r!l&&!r
16128
MC/DC100%2/2
&Undef()->check($radix) or length $radix <= 0
&Undef()->check($radix) length $radix <= 0
Truth table100%3/3
A or B
A= &Undef()->check($radix)B= length $radix <= 0
ABresult
1X1
011
000
3370 163 $radix = 10;
3371 }
3372 171 ▶ if ( !PositiveInt->check($radix) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&PositiveInt()->check($radix)) 0 171 171
3373 0 $self->logger_error(
3374 '%s: %s: does not look like a positive integer',
3375 $self->impl_quote('eval'),
3376 $self->impl_quote($radix)
3377 );
3378 0 return '';
3379 }
3380 171 ▶ if ( $radix < 1 || $radix > 36 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($radix < 1 or $radix > 36) 1 170 171
Condition66%2/3
$radix < 1 or $radix > 36
l!l&&r!l&&!r
01170
MC/DC50%1/2
$radix < 1 or $radix > 36
$radix < 1 $radix > 36
Truth table66%2/3
A or B
A= $radix < 1B= $radix > 36
ABresult
1X1
011
000
3381 1 $self->logger_error(
3382 '%s: %s: should be in the range [1..36]',
3383 $self->impl_quote('eval'),
3384 $self->impl_quote($radix)
3385 );
3386 1 return '';
3387 }
3388 #
3389 # Validate width
3390 #
3391 170 ▶ if ( Undef->check($width) || length($width) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($width) or length $width <= 0) 165 5 170
Condition66%2/3
&Undef()->check($width) or length $width <= 0
l!l&&r!l&&!r
16505
MC/DC50%1/2
&Undef()->check($width) or length $width <= 0
&Undef()->check($width) length $width <= 0
Truth table66%2/3
A or B
A= &Undef()->check($width)B= length $width <= 0
ABresult
1X1
011
000
3392 165 $width = 1;
3393 }
3394 170 ▶ if ( !PositiveOrZeroInt->check($width) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&PositiveOrZeroInt()->check($width)) 1 169 170
3395 1 $self->logger_error(
3396 '%s: %s: width does not look like a positive or zero integer',
3397 $self->impl_quote('eval'), $self->impl_quote($width)
3398 );
3399 1 return '';
3400 }
3401 #
3402 # Check expression
3403 #
3404 169 ▶ if ( length($expression) <= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $expression <= 0) 1 168 169
3405 1 $self->logger_error( '%s: empty string treated as zero',
3406 $self->impl_quote('eval') );
3407 1 $expression = 0;
3408 }
3409 #
3410 # Eval
3411 #
3412 169 my $rc = '';
3413 #
3414 # For $r->value() optimisations: outside of the try {} block
3415 # otherwise state optimisation seems to be off
3416 #
3417 169 state $registrations = undef;
3418 169 ▶ try {
Subroutine __ANON__: called CC=5 SCAR=16.3
3419 169 local $MarpaX::Languages::M4::Impl::Default::INTEGER_BITS
3420 = $self->_integer_bits;
3421 169 local $MarpaX::Languages::M4::Impl::Default::SELF = $self;
3422 #
3423 # Calling parse method will always resolve the actions to the same value...
3424 # As we do in Parser, use our Marpa hack to avoid such repetition
3425 #
3426 169 my $r = Marpa::R2::Scanless::R->new(
3427 { grammar => $EVAL_G,
3428 semantics_package => 'MarpaX::Languages::M4::Impl::Default::Eval'
3429 # trace_terminals => 1,
3430 # trace_values => 1
3431 }
3432 );
3433 169 $r->read(\$expression);
3434 168 my $ambiguous_status = $r->ambiguous;
3435 168 ▶ if ($ambiguous_status) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ambiguous_status) 0 168 168
3436 0 Marpa::R2::exception( "Eval is ambiguous (ambiguous status is" . $ambiguous_status . "): $expression\n");
3437 }
3438  
3439 168 ▶ if (defined($registrations)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $registrations) 167 1 168
3440 167 $r->registrations($registrations);
3441 }
3442 168 my $valuep = $r->value;
3443 162 ▶ if (! defined($registrations)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $registrations) 1 161 162
3444 1 $registrations = $r->registrations();
3445 }
3446 162 ▶ if (! defined($valuep)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $valuep) 0 162 162
3447 0 Marpa::R2::exception( "No eval parse value: $expression\n");
3448 }
3449 $rc = MarpaX::Languages::M4::Impl::Default::BaseConversion
3450 162 ->bitvector_to_base( $radix, ${$valuep}, $width );
3451 }
3452 7 ▶ catch {
Subroutine __ANON__: called CC=1 SCAR=0.0
3453 #
3454 # Marpa::R2::Context::bail() is adding
3455 # something like e.g.:
3456 # User bailed at line 37 in file "xxx"
3457 # we strip this line if any
3458 #
3459 7 $_ =~ s/^User bailed.*?\n//;
3460 7 $self->logger_error( '%s: %s', $self->impl_quote('eval'), "$_" );
3461 7 return;
3462 169 };
3463  
3464 169 return $rc;
3465 }
3466  
3467 0 ▶ method _syscmd (Str $macroName, Bool $appendValue, Undef|Str $command?, Str @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine _syscmd: called CC=22 SCAR=34.8
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 13 branches
BranchTrueFalseTotal
@_ ? : 8 0 8
if @_ < 2 0 8 8
$#_ >= 0 ? : 8 0 8
if ($#_ >= 0) 8 0 8
Type::Tiny::XS::Str($macroName) or _failed_check(9, "Str", $macroName, "exception_class", "Error::TypeTiny::Assertion") 8 0 8
$#_ >= 1 ? : 8 0 8
if ($#_ >= 1) 8 0 8
Type::Tiny::XS::Bool($appendValue) or _failed_check(3, "Bool", $appendValue, "exception_class", "Error::TypeTiny::Assertion") 8 0 8
$#_ >= 2 ? : 8 0 8
if ($#_ >= 2) 8 0 8
Type::Tiny::XS::AUTO::TC5($command) or _failed_check(181, "Undef|Str", $command, "exception_class", "Error::TypeTiny::Assertion") 8 0 8
$#_ >= 3 ? : 0 8 8
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3468 8 ▶ if ( Undef->check($command) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($command)) 0 8 8
3469 0 $self->logger_error(
3470 'too few arguments to builtin %s',
3471 $self->impl_quote($macroName)
3472 );
3473 0 return '';
3474 }
3475 8 $self->_checkIgnored( $macroName, @ignored );
3476  
3477 8 ▶ $command //= '';
Condition50%1/2
$command //= ""
l!l
80
MC/DC0%0/1
$command //= ""
$command
Truth table50%1/2
A
A= $command
Aresult
11
00
3478 8 ▶ if ( length($command) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $command > 0) 8 0 8
3479 8 my ( $stdout, $stderr, $success, $exitCode );
3480 8 my $executed = false;
3481 8 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
3482 8 ( $stdout, $stderr, $success, $exitCode )
3483 = capture_exec($command);
3484 }
3485 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3486 0 $self->logger_error( '%s: %s',
3487 $self->impl_quote($macroName), "$_" );
3488 0 return;
3489 }
3490 8 ▶ finally {
Subroutine __ANON__: called CC=2 SCAR=7.2
3491 8 ▶ if ( !$@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $@) 8 0 8
3492 8 $executed = true;
3493 }
3494 8 };
3495 8 ▶ if ($executed) {
Branch: 1 branch
BranchTrueFalseTotal
if ($executed) 8 0 8
3496 8 $self->_lastSysExitCode( $exitCode >> 8 );
3497 8 ▶ if ( $self->_cmdtounix ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_cmdtounix) 8 0 8
3498 8 $stderr =~ s/\R/\n/g;
3499 8 $stdout =~ s/\R/\n/g;
3500 }
3501 8 ▶ if ( length($stderr) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $stderr > 0) 0 8 8
3502 0 $self->logger_error( '%s', $stderr );
3503 }
3504 8 ▶ if ($appendValue) {
Branch: 1 branch
BranchTrueFalseTotal
if ($appendValue) { } 4 4 8
3505 4 $self->impl_appendValue($stdout);
3506 4 return '';
3507 }
3508 else {
3509 4 return $stdout;
3510 }
3511 }
3512 }
3513 0 return '';
3514 }
3515  
3516 0 ▶ method builtin_syscmd (Undef|Str $command?, Str @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine builtin_syscmd: called CC=8 SCAR=22.4
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 4 0 4
$#_ >= 0 ? : 4 0 4
if ($#_ >= 0) 4 0 4
Type::Tiny::XS::AUTO::TC5($command) or _failed_check(182, "Undef|Str", $command, "exception_class", "Error::TypeTiny::Assertion") 4 0 4
$#_ >= 1 ? : 0 4 4
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3517 4 return $self->_syscmd( 'syscmd', true, $command, @ignored );
3518 }
3519  
3520 0 ▶ method builtin_esyscmd (Undef|Str $command?, Str @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine builtin_esyscmd: called CC=8 SCAR=22.4
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 4 0 4
$#_ >= 0 ? : 4 0 4
if ($#_ >= 0) 4 0 4
Type::Tiny::XS::AUTO::TC5($command) or _failed_check(183, "Undef|Str", $command, "exception_class", "Error::TypeTiny::Assertion") 4 0 4
$#_ >= 1 ? : 0 4 4
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3521 4 return $self->_syscmd( 'esyscmd', false, $command, @ignored );
3522 }
3523  
3524 0 ▶ method builtin_sysval (Str @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine builtin_sysval: called CC=5 SCAR=17.4
Subroutine __ANON__: called CC=1 SCAR=0.4
Subroutine __ANON__: called CC=1 SCAR=0.4
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 7 0 7
$#_ >= 0 ? : 0 7 7
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3525 7 $self->_checkIgnored( 'sysval', @ignored );
3526  
3527 7 return $self->_lastSysExitCode;
3528 }
3529  
3530 0 ▶ method _mkstemp (Str $macro, Undef|Str $template?, Str @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine _mkstemp: called CC=15 SCAR=30.0
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 10 branches
BranchTrueFalseTotal
@_ ? : 2 0 2
if @_ < 1 0 2 2
$#_ >= 0 ? : 2 0 2
if ($#_ >= 0) 2 0 2
Type::Tiny::XS::Str($macro) or _failed_check(9, "Str", $macro, "exception_class", "Error::TypeTiny::Assertion") 2 0 2
$#_ >= 1 ? : 2 0 2
if ($#_ >= 1) 2 0 2
Type::Tiny::XS::AUTO::TC5($template) or _failed_check(184, "Undef|Str", $template, "exception_class", "Error::TypeTiny::Assertion") 2 0 2
$#_ >= 2 ? : 0 2 2
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3531 2 ▶ if ( Undef->check($template) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (&Undef()->check($template)) 0 2 2
3532 0 $self->logger_error(
3533 'too few arguments to builtin %s',
3534 $self->impl_quote($macro)
3535 );
3536 0 return '';
3537 }
3538 2 $self->_checkIgnored( $macro, @ignored );
3539  
3540 2 ▶ $template //= '';
Condition50%1/2
$template //= ""
l!l
20
MC/DC0%0/1
$template //= ""
$template
Truth table50%1/2
A
A= $template
Aresult
11
00
3541 2 ▶ while ( !( $template =~ /XXXXXX$/ ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($template =~ /XXXXXX$/u) 6 2 8
3542 6 $template .= 'X';
3543 }
3544 2 my $tmp = '';
3545 2 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
3546 2 $tmp = File::Temp->new( TEMPLATE => $template );
3547 }
3548 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3549 0 $self->logger_error( '%s: %s', $macro, "$_" );
3550 0 return;
3551 2 };
3552  
3553 2 return $self->impl_quote( $tmp->filename );
3554 }
3555  
3556 2 ▶ method builtin_mkstemp (Str @args --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_mkstemp: called CC=5 SCAR=16.2
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 1 0 1
$#_ >= 0 ? : 1 0 1
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 1 0 1
3557 1 return $self->_mkstemp( 'mkstemp', @args );
3558 }
3559  
3560 2 ▶ method builtin_maketemp (Str @args --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_maketemp: called CC=5 SCAR=16.2
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 1 0 1
$#_ >= 0 ? : 1 0 1
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 1 0 1
3561 1 return $self->_mkstemp( 'maketemp', @args );
3562 }
3563  
3564 2 ▶ method builtin_errprint (Str @args --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine builtin_errprint: called CC=5 SCAR=16.2
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 5 0 5
$#_ >= 0 ? : 5 0 5
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 6 0 6
3565 #
3566 # debugfile is IGNORED
3567 #
3568 5 my $oldDebugfile = $self->_debugfile;
3569  
3570 5 $self->_set__debugfile(undef);
3571 5 $self->logger_error( '%s', join( ' ', @args ) );
3572 5 $self->_set__debugfile($oldDebugfile);
3573  
3574 5 return '';
3575 }
3576  
3577 0 ▶ method builtin___file__ (Str @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine builtin___file__: called CC=5 SCAR=17.4
Subroutine __ANON__: called CC=1 SCAR=0.4
Subroutine __ANON__: called CC=1 SCAR=0.4
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 2 0 2
$#_ >= 0 ? : 0 2 2
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3578 2 $self->_checkIgnored( '__file__', @ignored );
3579 2 return $self->__file__;
3580 }
3581  
3582 0 ▶ method builtin___line__ (Str @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine builtin___line__: called CC=5 SCAR=17.4
Subroutine __ANON__: called CC=1 SCAR=0.4
Subroutine __ANON__: called CC=1 SCAR=0.4
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 2 0 2
$#_ >= 0 ? : 0 2 2
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3583 2 $self->_checkIgnored( '__line__', @ignored );
3584 2 return $self->__line__;
3585 }
3586  
3587 0 ▶ method builtin___program__ (Str @ignored --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine BEGIN: called CC=1 SCAR=0.4
Subroutine builtin___program__: called CC=5 SCAR=17.4
Subroutine __ANON__: called CC=1 SCAR=0.4
Subroutine __ANON__: called CC=1 SCAR=0.4
Branch: 3 branches
BranchTrueFalseTotal
@_ ? : 2 0 2
$#_ >= 0 ? : 0 2 2
Type::Tiny::XS::Str($_) or _failed_check(9, "Str", $_, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3588 2 $self->_checkIgnored( '__program__', @ignored );
3589 2 return $self->__program__;
3590 }
3591 #
3592 # $0 is replaced by $name
3593 # arguments are in the form $1, $2, etc...
3594 # mapped to $_[1], $_[2], etc...
3595 # $# is the number of arguments
3596 # $* is all arguments separated by comma
3597 # $@ is all quoted arguments separated by comma
3598 #
3599 2 ▶ method _expansion2CodeRef (Str $name, Str $expansion --> CodeRef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine _expansion2CodeRef: called CC=21 SCAR=31.3
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 370 0 370
if @_ != 2 0 370 370
$#_ >= 0 ? : 370 0 370
if ($#_ >= 0) 370 0 370
Type::Tiny::XS::Str($name) or _failed_check(9, "Str", $name, "exception_class", "Error::TypeTiny::Assertion") 370 0 370
$#_ >= 1 ? : 370 0 370
if ($#_ >= 1) 370 0 370
Type::Tiny::XS::Str($expansion) or _failed_check(9, "Str", $expansion, "exception_class", "Error::TypeTiny::Assertion") 370 0 370
3600 #
3601 # Check macro content
3602 #
3603 370 ▶ if ( $self->_warn_macro_sequence ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_warn_macro_sequence) 2 368 370
3604 2 my $r = $self->_warn_macro_sequence_regexp;
3605 2 my $offset = 0;
3606 2 my $len = length($expansion);
3607 2 ▶ while ( $offset
Branch: 1 branch
BranchTrueFalseTotal
if ($offset = $r->regexp_exec($self, $expansion, $offset) >= 0) 2 0 2
3608 = $r->regexp_exec( $self, $expansion, $offset ) >= 0 )
3609 {
3610 #
3611 # Skip empty matches
3612 #
3613 2 ▶ if ( $r->regexp_lpos_get(0) == $r->regexp_rpos_get(0) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r->regexp_lpos_get(0) == $r->regexp_rpos_get(0)) { } 0 2 2
3614 0 $offset++;
3615 }
3616 else {
3617 2 $offset = $r->regexp_rpos_get(0);
3618 2 $self->logger_warn(
3619 'Definition of %s contains sequence %s',
3620 $self->impl_quote($name),
3621 $self->impl_quote(
3622 substr(
3623 $expansion,
3624 $r->regexp_lpos_get(0),
3625 $r->regexp_rpos_get(0)
3626 - $r->regexp_lpos_get(0)
3627 )
3628 )
3629 );
3630 }
3631 }
3632 0 ▶ if ( $offset < -1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($offset < -1) 0 0 0
3633 0 $self->logger_warn(
3634 'error checking --warn-macro-sequence for macro %s',
3635 $self->impl_quote($name) );
3636 }
3637 }
3638  
3639 368 my $maxArgumentIndice = -1;
3640 368 my %wantedArgumentIndice = ();
3641 368 my $newExpansion = quotemeta($expansion);
3642 #
3643 # Arguments and $0
3644 #
3645 368 $newExpansion =~ s/\\\$([0-9]+)/
3646 {
3647 #
3648 # Writen like this to show that this is a BLOCK on the right-side of eval
3649 #
3650 276 my $dollarOne = substr($newExpansion, $-[1], $+[1] - $-[1]);
3651 276 ▶ if ($dollarOne > $maxArgumentIndice) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dollarOne > $maxArgumentIndice) 124 152 276
3652 124 $maxArgumentIndice = $dollarOne;
3653 }
3654 276 ▶ if ($dollarOne == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dollarOne == 0) { } 40 236 276
3655 # "\$0";
3656 40 "\" . \"" . quotemeta($name) . "\" . \"";
3657 } else {
3658 236 $wantedArgumentIndice{$dollarOne}++;
3659 236 "\" . " . "\$_\[$dollarOne\]" . " . \"";
3660 }
3661 }/eg;
3662 368 my $prepareArguments = "\n";
3663 #
3664 # We use unused argument indices from now on.
3665 #
3666 # Number of arguments.
3667 #
3668 368 ▶ if ( $newExpansion =~ s/\\\$\\\#/" . \$nbArgs . "/g ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($newExpansion =~ s/\\\$\\\#/" . \$nbArgs . "/gu) 25 343 368
3669 25 $prepareArguments
3670 .= "\tmy \$nbArgs = \$#_; # \$_[0] is \$self\n";
3671 }
3672 #
3673 # Arguments expansion, unquoted.
3674 #
3675 368 ▶ if ( $newExpansion =~ s/\\\$\\\*/" . \$listArgs . "/g ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($newExpansion =~ s/\\\$\\\*/" . \$listArgs . "/gu) 15 353 368
3676 15 $prepareArguments
3677 .= "\tmy \$listArgs = join(',', map {\$_[\$_] // ''} (1..\$#_));\n";
3678 }
3679 #
3680 # Arguments expansion, quoted.
3681 #
3682 368 ▶ if ( $newExpansion =~ s/\\\$\\\@/" . \$listArgsQuoted . "/g ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($newExpansion =~ s/\\\$\\\@/" . \$listArgsQuoted . "/gu) 46 322 368
3683 46 $prepareArguments
3684 .= "\tmy \$listArgsQuoted = join(',', map {\$_[0]->impl_quote(\$_[\$_])} (1..\$#_));\n";
3685 }
3686 #
3687 # Take care: a macro can very well try to access
3688 # something outside of @args
3689 # We do this only NOW, because the //= will eventually
3690 # increase @_
3691 #
3692 368 ▶ if (%wantedArgumentIndice) {
Branch: 1 branch
BranchTrueFalseTotal
if (%wantedArgumentIndice) 78 290 368
3693 78 $prepareArguments .= "\n";
3694 78 foreach ( sort { $a <=> $b } keys %wantedArgumentIndice ) {
3695 132 $prepareArguments .= "\t\$_[$_] //= '';\n";
3696 }
3697 }
3698 368 my $stub;
3699 my $error;
3700 #
3701 # If it fails, our fault
3702 #
3703 368 my $stubSource = <<"STUB";
3704 sub {
3705 $prepareArguments
3706 \treturn "$newExpansion";
3707 }
3708 STUB
3709 368 my $codeRef = eval "$stubSource";
3710 368 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 368 368
3711 #
3712 # Explicitely logged as an internal error, because if I made
3713 # no error in this routine, this must never happen.
3714 #
3715 0 $self->logger_error( 'Internal: %s', $@ );
3716 }
3717 368 return $codeRef;
3718 }
3719  
3720 0 ▶ method _issue_expect_message (Str $expected) {
Subroutine BEGIN: called CC=1 SCAR=2.9
Subroutine BEGIN: called CC=1 SCAR=2.9
Subroutine _issue_expect_message: not called CC=7 SCAR=33.0
Subroutine __ANON__: called CC=1 SCAR=2.9
Subroutine __ANON__: called CC=1 SCAR=2.9
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($expected) or _failed_check(9, "Str", $expected, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
3721 0 ▶ if ( $expected eq "\n" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expected eq "\n") { } 0 0 0
3722 0 $self->logger_error('expecting line feed in frozen file');
3723 }
3724 else {
3725 0 $self->logger_error(
3726 sprintf( 'expecting character %s in frozen file',
3727 $self->impl_quote($expected) )
3728 );
3729 }
3730 }
3731  
3732 2 ▶ method impl_freezeState (--> Bool) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine impl_freezeState: called CC=5 SCAR=27.4
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 142 0 142
if @_ != 0 0 142 142
3733 142 ▶ if ( !$self->_stateFreezed ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_stateFreezed) 140 2 142
3734 140 ▶ if ( length( $self->freeze_state ) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $self->freeze_state > 0) 0 140 140
3735 0 ▶ try {
Subroutine __ANON__: not called CC=12 SCAR=49.0
3736 0 my $file = $self->freeze_state;
3737 my $fh = IO::File->new(
3738 $ENV{M4_ENCODE_LOCALE}
3739 0 ▶ ? encode( locale_fs => $file )
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'M4_ENCODE_LOCALE'} ? : 0 0 0
Condition0%0/2
'IO::File'->new($ENV{'M4_ENCODE_LOCALE'} ? &encode('locale_fs', $file) : $file, 'w') || die("${file}: $!")
l!l
00
MC/DC0%0/1
'IO::File'->new($ENV{'M4_ENCODE_LOCALE'} ? &encode('locale_fs', $file) : $file, 'w') || die("${file}: $!")
'IO::File'->new($ENV{'M4_ENCODE_LOCALE'} ? &encode('locale_fs', $file) : $file, 'w')
Truth table0%0/2
A
A= 'IO::File'->new($ENV{'M4_ENCODE_LOCALE'} ? &encode('locale_fs', $file) : $file, 'w')
Aresult
11
00
3740 : $file,
3741 'w'
3742 )
3743 || die "$file: $!";
3744 0 ▶ if ( $ENV{M4_ENCODE_LOCALE} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{'M4_ENCODE_LOCALE'}) { } 0 0 0
3745 0 binmode( $fh, ':encoding(locale)' );
3746 }
3747 else {
3748 0 binmode($fh);
3749 }
3750  
3751 0 my $CURRENTVERSION;
3752 {
3753 #
3754 # Because $VERSION is generated by dzil, not available in dev. tree
3755 #
3756 0 ▶ no strict 'vars';
Subroutine BEGIN: called CC=1 SCAR=0.2
Subroutine __ANON__: called CC=1 SCAR=0.2
3757 0 $CURRENTVERSION = $VERSION;
3758 }
3759 0 ▶ $CURRENTVERSION ||= 'dev';
Condition0%0/2
$CURRENTVERSION ||= "dev"
l!l
00
MC/DC0%0/1
$CURRENTVERSION ||= "dev"
$CURRENTVERSION
Truth table0%0/2
A
A= $CURRENTVERSION
Aresult
11
00
3760  
3761 0 $fh->print(
3762 sprintf(
3763 "# This is a frozen state file generated by %s version %s\n",
3764 __PACKAGE__, $CURRENTVERSION
3765 )
3766 );
3767 0 $fh->print("V1\n");
3768 #
3769 # Dump quote delimiters
3770 #
3771 0 ▶ if ( $self->_quote_start ne $DEFAULT_QUOTE_START
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_quote_start ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_START or $self->_quote_end ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_END) 0 0 0
Condition0%0/3
$self->_quote_start ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_START or $self->_quote_end ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_END
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->_quote_start ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_START or $self->_quote_end ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_END
$self->_quote_start ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_START $self->_quote_end ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_END
Truth table0%0/3
A or B
A= $self->_quote_start ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_STARTB= $self->_quote_end ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_QUOTE_END
ABresult
1X1
011
000
3772 || $self->_quote_end ne $DEFAULT_QUOTE_END )
3773 {
3774 0 $fh->print(
3775 sprintf( "Q%d,%d\n",
3776 length( $self->_quote_start ),
3777 length( $self->_quote_end ) )
3778 );
3779 0 $fh->print( $self->_quote_start );
3780 0 $fh->print( $self->_quote_end );
3781 0 $fh->print("\n");
3782 }
3783 #
3784 # Dump comment delimiters
3785 #
3786 0 ▶ if ( $self->_comment_start ne $DEFAULT_COMMENT_START
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_comment_start ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_START or $self->_comment_end ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_END) 0 0 0
Condition0%0/3
$self->_comment_start ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_START or $self->_comment_end ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_END
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->_comment_start ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_START or $self->_comment_end ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_END
$self->_comment_start ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_START $self->_comment_end ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_END
Truth table0%0/3
A or B
A= $self->_comment_start ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_STARTB= $self->_comment_end ne $MarpaX::Languages::M4::Impl::Default::DEFAULT_COMMENT_END
ABresult
1X1
011
000
3787 || $self->_comment_end ne $DEFAULT_COMMENT_END )
3788 {
3789 0 $fh->print(
3790 sprintf( "Q%d,%d\n",
3791 length( $self->_comment_start ),
3792 length( $self->_comment_end ) )
3793 );
3794 0 $fh->print( $self->_comment_start );
3795 0 $fh->print( $self->_comment_end );
3796 0 $fh->print("\n");
3797 }
3798 #
3799 # Dump all symbols, for each of them do
3800 # it in reverse order until builtin is reached
3801 #
3802 0 foreach ( $self->_macros_keys ) {
3803 0 foreach (
3804 reverse(
3805 $self->_macros_get($_)->macros_elements
3806 )
3807 )
3808 {
3809 0 my $name = $_->macro_name;
3810 0 my $expansion = $_->macro_expansion;
3811 #
3812 # Expansion is either Str or M4Macro
3813 #
3814 0 ▶ if ( $_->macro_isBuiltin ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_->macro_isBuiltin) { } 0 0 0
3815 0 my $builtinName = $expansion->macro_name;
3816 0 my $F = sprintf( "F%d,%d",
3817 length($name), length($builtinName) );
3818 0 $fh->print("$F\n$name$builtinName\n");
3819 }
3820 else {
3821 0 my $T = sprintf( "T%d,%d",
3822 length($name), length($expansion) );
3823 0 $fh->print("$T\n$name$expansion\n");
3824 }
3825 }
3826 }
3827 0 $fh->print("# End of frozen state file\n");
3828 0 $fh->close;
3829 }
3830 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
3831 0 $self->logger_error( 'failed to freeze state: %s', "$_" );
3832 0 return;
3833 0 };
3834 }
3835 140 $self->_set__stateFreezed(true);
3836 }
3837 142 return true;
3838 }
3839  
3840 0 ▶ method impl_reloadState (--> Bool) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_reloadState: not called CC=5 SCAR=33.3
Subroutine __ANON__: called CC=1 SCAR=1.8
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
3841 0 ▶ if ( !$self->_stateReloaded ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_stateReloaded) 0 0 0
3842 0 ▶ if ( length( $self->reload_state ) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $self->reload_state > 0) 0 0 0
3843 0 ▶ try {
Subroutine __ANON__: not called CC=19 SCAR=59.4
3844 0 my $content;
3845  
3846 0 my $file = $self->reload_state;
3847 0 $self->impl_parseIncrementalFile( $file, false, false,
3848 \$content );
3849 0 my $fh = IO::Scalar->new( \$content );
3850 #
3851 # This is a copy of m4-1.4.17 algorithm
3852 #
3853 0 my $character;
3854 my $operation;
3855 0 my $advance_line = true;
3856 0 my $current_line = 0;
3857 0 my @number = ( undef, undef );
3858 0 my @string = ( undef, undef );
3859  
3860 0 ▶ my $GET_CHARACTER = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
3861 0 my ($self) = @_;
3862  
3863 0 ▶ if ($advance_line) {
Branch: 1 branch
BranchTrueFalseTotal
if ($advance_line) 0 0 0
3864 0 $current_line++;
3865 0 $advance_line = false;
3866 }
3867 0 $character = $fh->getc();
3868 0 ▶ if ( $character eq "\n" ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($character eq "\n") 0 0 0
3869 0 $advance_line = false;
3870 }
3871 0 };
3872 0 ▶ my $GET_NUMBER = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3873 #
3874 # AllowNeg is not used. We let perl croak if there i an overflow
3875 #
3876 0 my ( $self, $allowneg ) = @_;
3877 0 my $n = 0;
3878 0 ▶ while ( $character =~ /[[:digit:]]/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($character =~ /[[:digit:]]/u) 0 0 0
3879 0 $n = 10 * $n + $character;
3880 0 $self->$GET_CHARACTER();
3881 }
3882 0 return $n;
3883 0 };
3884 0 ▶ my $VALIDATE = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
3885 0 my ( $self, $expected ) = @_;
3886  
3887 0 ▶ if ( $character ne $expected ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($character ne $expected) 0 0 0
3888 0 $self->_issue_expect_message($expected);
3889 }
3890 0 };
3891 0 ▶ my $GET_DIRECTIVE = sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
3892 0 my ($self) = @_;
3893  
3894 0 ▶ do {
Branch: 1 branch
BranchTrueFalseTotal
$character eq "\n" and do { do { $self->$GET_CHARACTER; if ($character eq "#") { while (not $fh->eof and $character ne "\n") { $self->$GET_CHARACTER; } ; $self->$VALIDATE("\n"); } } } 0 0 0
3895 0 $self->$GET_CHARACTER();
3896 0 ▶ if ( $character eq '#' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($character eq "#") 0 0 0
3897 0 ▶ while ( !$fh->eof() && $character ne "\n" ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $fh->eof and $character ne "\n") 0 0 0
Condition0%0/3
not $fh->eof and $character ne "\n"
!ll&&!rl&&r
000
MC/DC0%0/2
not $fh->eof and $character ne "\n"
not $fh->eof $character ne "\n"
Truth table0%0/3
not(A) and B
A= not $fh->eofB= $character ne "\n"
ABresult
0X0
100
111
3898 0 $self->$GET_CHARACTER();
3899 }
3900 0 $self->$VALIDATE("\n");
3901 }
3902 } while ( $character eq "\n" );
3903 0 };
3904 0 ▶ my $GET_STRING = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
3905 0 my ( $self, $i ) = @_;
3906  
3907 0 $string[$i] = '';
3908 0 ▶ if ( $number[$i] > 0
Branch: 1 branch
BranchTrueFalseTotal
if ($number[$i] > 0 and not $fh->read($string[$i], $number[$i])) 0 0 0
Condition0%0/3
$number[$i] > 0 and not $fh->read($string[$i], $number[$i])
!ll&&!rl&&r
000
MC/DC0%0/2
$number[$i] > 0 and not $fh->read($string[$i], $number[$i])
$number[$i] > 0 not $fh->read($string[$i], $number[$i])
Truth table0%0/3
A and not(B)
A= $number[$i] > 0B= not $fh->read($string[$i], $number[$i])
ABresult
0X0
100
111
3909 && !$fh->read( $string[$i], $number[$i] ) )
3910 {
3911 0 $self->impl_raiseException(
3912 'premature end of frozen file');
3913 }
3914 0 $current_line += $string[$i] =~ tr/\n//;
3915 0 };
3916  
3917 0 $self->$GET_DIRECTIVE();
3918 0 $self->$VALIDATE('V');
3919 0 $self->$GET_CHARACTER();
3920 0 $number[0] = $self->$GET_NUMBER(false);
3921 0 ▶ if ( $number[0] > 1 ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($number[0] > 1) { } 0 0 0
elsif ($number[0] < 1) { } 0 0 0
3922 0 die sprintf(
3923 'frozen file version %d greater than max supported of 1',
3924 $number[0] );
3925 }
3926 elsif ( $number[0] < 1 ) {
3927 0 die
3928 'ill-formed frozen file, version directive expected';
3929 }
3930 0 $self->$VALIDATE("\n");
3931  
3932 0 $self->$GET_DIRECTIVE();
3933 0 ▶ while ( !$fh->eof() ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $fh->eof) 0 0 0
3934 0 ▶ if ( $character eq 'C'
Branch: 1 branch
BranchTrueFalseTotal
if ($character eq 'C' or $character eq 'D' or $character eq 'F' or $character eq 'T' or $character eq 'Q') { } 0 0 0
Condition0%0/12
$character eq "C" or $character eq "D" or $character eq "F" or $character eq "T" or $character eq "Q"
l!l&&r!l&&!r
000
$character eq "C" or $character eq "D" or $character eq "F" or $character eq "T"
l!l&&r!l&&!r
000
$character eq "C" or $character eq "D" or $character eq "F"
l!l&&r!l&&!r
000
$character eq "C" or $character eq "D"
l!l&&r!l&&!r
000
MC/DC0%0/5
$character eq "C" or $character eq "D" or $character eq "F" or $character eq "T" or $character eq "Q"
$character eq "C" $character eq "D" $character eq "F" $character eq "T" $character eq "Q"
Truth table0%0/6
A or B or C or D or E
A= $character eq "C"B= $character eq "D"C= $character eq "F"D= $character eq "T"E= $character eq "Q"
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
3935 || $character eq 'D'
3936 || $character eq 'F'
3937 || $character eq 'T'
3938 || $character eq 'Q' )
3939 {
3940 0 $operation = $character;
3941 0 $self->$GET_CHARACTER();
3942  
3943 # Get string lengths. Accept a negative diversion number
3944  
3945 0 ▶ if ( $operation eq 'D' && $character eq '-' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($operation eq 'D' and $character eq '-') { } 0 0 0
Condition0%0/3
$operation eq "D" and $character eq "-"
!ll&&!rl&&r
000
MC/DC0%0/2
$operation eq "D" and $character eq "-"
$operation eq "D" $character eq "-"
Truth table0%0/3
A and B
A= $operation eq "D"B= $character eq "-"
ABresult
0X0
100
111
3946 0 $self->$GET_CHARACTER();
3947 0 $number[0] = -$self->$GET_NUMBER(true);
3948 }
3949 else {
3950 0 $number[0] = $self->$GET_NUMBER(false);
3951 }
3952 0 $self->$VALIDATE(',');
3953 0 $self->$GET_CHARACTER();
3954 0 $number[1] = $self->$GET_NUMBER(false);
3955 0 $self->$VALIDATE("\n");
3956 0 ▶ if ( $operation ne 'D' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($operation ne "D") 0 0 0
3957 0 $self->$GET_STRING(0);
3958 }
3959 0 $self->$GET_STRING(1);
3960 0 $self->$GET_CHARACTER();
3961 0 $self->$VALIDATE("\n");
3962  
3963 0 ▶ if ( $operation eq 'C' ) {
Branch: 5 branches
BranchTrueFalseTotal
if ($operation eq 'C') { } 0 0 0
elsif ($operation eq 'D') { } 0 0 0
elsif ($operation eq 'F') { } 0 0 0
elsif ($operation eq 'T') { } 0 0 0
elsif ($operation eq 'Q') { } 0 0 0
3964 0 $self->builtin_changecom( $string[0],
3965 $string[1] );
3966 }
3967 elsif ( $operation eq 'D' ) {
3968 0 $self->builtin_divert( $number[0] );
3969 0 ▶ if ( $number[1] > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($number[1] > 0) 0 0 0
3970 0 $self->impl_appendValue( $string[1] );
3971 }
3972 }
3973 elsif ( $operation eq 'F' ) {
3974 0 ▶ if ( $self->_builtins_exists( $string[1] ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_builtins_exists($string[1])) 0 0 0
3975 0 my $macro
3976 = $self->_builtins_get( $string[1] );
3977 0 $self->builtin_pushdef( $string[0],
3978 $macro );
3979 }
3980 #
3981 # Failure is silent
3982 #
3983 }
3984 elsif ( $operation eq 'T' ) {
3985 0 $self->builtin_pushdef( $string[0],
3986 $string[1] );
3987 }
3988 elsif ( $operation eq 'Q' ) {
3989 0 $self->builtin_changequote( $string[0],
3990 $string[1] );
3991 }
3992 else {
3993 # Cannot happen
3994 }
3995 }
3996 else {
3997 0 die 'ill-formed frozen file';
3998 }
3999 0 $self->$GET_DIRECTIVE();
4000 }
4001 }
4002 0 ▶ catch {
Subroutine __ANON__: not called CC=1 SCAR=6.9
4003 0 $self->logger_error( 'failed to reload state: %s', "$_" );
4004 0 return;
4005 0 };
4006 }
4007 0 $self->_set__stateReloaded(true);
4008 }
4009  
4010 0 return true;
4011 }
4012  
4013 2 ▶ method impl_parseIncrementalFile (Str $file, Bool $silent?, Bool $parse?, Ref['SCALAR'] $contentp? --> ConsumerOf[M4Impl]) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine impl_parseIncrementalFile: called CC=44 SCAR=59.0
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 15 branches
BranchTrueFalseTotal
@_ ? : 29 0 29
if @_ < 1 0 29 29
if @_ > 4 0 29 29
$#_ >= 0 ? : 29 0 29
if ($#_ >= 0) 29 0 29
Type::Tiny::XS::Str($file) or _failed_check(9, "Str", $file, "exception_class", "Error::TypeTiny::Assertion") 29 0 29
$#_ >= 1 ? : 29 0 29
if ($#_ >= 1) 29 0 29
Type::Tiny::XS::Bool($silent) or _failed_check(3, "Bool", $silent, "exception_class", "Error::TypeTiny::Assertion") 29 0 29
$#_ >= 2 ? : 29 0 29
if ($#_ >= 2) 29 0 29
Type::Tiny::XS::Bool($parse) or _failed_check(3, "Bool", $parse, "exception_class", "Error::TypeTiny::Assertion") 29 0 29
$#_ >= 3 ? : 29 0 29
if ($#_ >= 3) 29 0 29
ref $contentp and builtin::reftype($contentp) eq "SCALAR" or _failed_check(98, "Ref[SCALAR]", $contentp, "exception_class", "Error::TypeTiny::Assertion") 29 0 29
Condition33%1/3
ref $contentp and builtin::reftype($contentp) eq "SCALAR"
!ll&&!rl&&r
0029
MC/DC0%0/2
ref $contentp and builtin::reftype($contentp) eq "SCALAR"
ref $contentp builtin::reftype($contentp) eq "SCALAR"
Truth table33%1/3
A and B
A= ref $contentpB= builtin::reftype($contentp) eq "SCALAR"
ABresult
0X0
100
111
4014 29 ▶ $silent //= false;
Condition33%1/3
$silent //= false()
l!l&&r!l&&!r
2900
MC/DC0%0/2
$silent //= false()
$silent false()
Truth table33%1/3
A //= B
A= $silentB= false()
ABresult
1X1
011
000
4015 29 ▶ $parse //= true;
Condition33%1/3
$parse //= true()
l!l&&r!l&&!r
2900
MC/DC0%0/2
$parse //= true()
$parse true()
Truth table33%1/3
A //= B
A= $parseB= true()
ABresult
1X1
011
000
4016  
4017 my $uni_file
4018 29 ▶ = $ENV{M4_ENCODE_LOCALE} ? decode( locale => $file ) : $file;
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'M4_ENCODE_LOCALE'} ? : 0 29 29
4019  
4020 29 ▶ if ( $uni_file ne '-' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($uni_file ne '-') { } 29 0 29
4021 29 my $fh;
4022 29 ▶ try {
Subroutine __ANON__: called CC=4 SCAR=16.9
4023 $fh = IO::File->new(
4024 $ENV{M4_ENCODE_LOCALE}
4025 29 ▶ ? encode( locale_fs => $uni_file )
Branch: 1 branch
BranchTrueFalseTotal
$ENV{'M4_ENCODE_LOCALE'} ? : 0 29 29
Condition50%1/2
'IO::File'->new($ENV{'M4_ENCODE_LOCALE'} ? &encode('locale_fs', $uni_file) : $uni_file, 'r') || die($!)
l!l
290
MC/DC0%0/1
'IO::File'->new($ENV{'M4_ENCODE_LOCALE'} ? &encode('locale_fs', $uni_file) : $uni_file, 'r') || die($!)
'IO::File'->new($ENV{'M4_ENCODE_LOCALE'} ? &encode('locale_fs', $uni_file) : $uni_file, 'r')
Truth table50%1/2
A
A= 'IO::File'->new($ENV{'M4_ENCODE_LOCALE'} ? &encode('locale_fs', $uni_file) : $uni_file, 'r')
Aresult
11
00
4026 : $uni_file,
4027 'r'
4028 )
4029 || die $!;
4030 29 ▶ if ( $ENV{M4_ENCODE_LOCALE} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"M4_ENCODE_LOCALE"}) 0 29 29
4031 0 binmode( $fh, ':encoding(locale)' );
4032 }
4033 }
4034 0 ▶ catch {
Subroutine __ANON__: not called CC=2 SCAR=17.9
4035 0 ▶ if ( !$silent ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($silent) 0 0 0
4036 0 $self->logger_error( '%s: %s', $file, "$_" );
4037 }
4038 0 return;
4039 29 };
4040  
4041 29 ▶ if ( !Undef->check($fh) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Undef()->check($fh)) 29 0 29
4042 29 $self->_set__nbInputProcessed( $self->_nbInputProcessed + 1 );
4043  
4044 29 $self->_set___file__( $self->impl_quote($file) );
4045 29 $self->_set___line__(0);
4046  
4047 29 ▶ if ( $self->_canDebug('i') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_canDebug("i")) 0 29 29
4048 0 $self->logger_debug( 'input read from %s', $file );
4049 }
4050 29 $self->_set__eof(true);
4051 29 my $content;
4052 29 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
4053 29 $content = do { local $/; <$fh>; };
4054 }
4055 0 ▶ catch {
Subroutine __ANON__: not called CC=2 SCAR=17.9
4056 0 ▶ if ( !$silent ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($silent) 0 0 0
4057 0 $self->logger_warn( '%s: %s', $file, "$_" );
4058 }
4059 0 return;
4060 29 };
4061 29 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
4062 29 $fh->close;
4063 }
4064 0 ▶ catch {
Subroutine __ANON__: not called CC=2 SCAR=17.9
4065 0 ▶ if ( !$silent ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($silent) 0 0 0
4066 0 $self->logger_warn( '%s: %s', $file, "$_" );
4067 }
4068 0 return;
4069 29 };
4070 29 ▶ if ( !Undef->check($content) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Undef()->check($content)) 29 0 29
4071 29 ▶ if ( $self->_inctounix ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_inctounix) 29 0 29
4072 29 $content =~ s/\R/\n/g;
4073 }
4074 }
4075 29 ▶ if ( !Undef->check($contentp) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Undef()->check($contentp)) 29 0 29
4076 29 ${$contentp} = $content;
4077 }
4078 29 ▶ if ($parse) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parse) 0 29 29
4079 0 $self->impl_parseIncremental($content);
4080 }
4081 29 ▶ if ( $self->_canDebug('i') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_canDebug("i")) 0 29 29
4082 0 $self->logger_debug( '%s: input exhausted', $file );
4083 }
4084 29 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
4085 29 $fh->close;
4086 }
4087 0 ▶ catch {
Subroutine __ANON__: not called CC=2 SCAR=17.9
4088 0 ▶ if ( !$silent ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($silent) 0 0 0
4089 0 $self->logger_warn( '%s', "$_" );
4090 }
4091 0 return;
4092 29 };
4093 }
4094 }
4095 else {
4096 0 my $fh;
4097 0 ▶ if ( !open( $fh, '<&STDIN' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not open($fh, '<&STDIN')) { } 0 0 0
4098 0 ▶ if ( !$silent ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($silent) 0 0 0
4099 0 $self->logger_error( 'Failed to duplicate STDIN: %s',
4100 $! );
4101 }
4102 }
4103 else {
4104 0 ▶ if ( $ENV{M4_ENCODE_LOCALE} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{"M4_ENCODE_LOCALE"}) 0 0 0
4105 0 ▶ if ( is_interactive($fh) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_interactive($fh)) { } 0 0 0
4106 0 binmode( $fh, ':encoding(console_in)' );
4107 }
4108 else {
4109 0 binmode( $fh, ':encoding(locale)' );
4110 }
4111 }
4112 0 $self->_set___file__( $self->impl_quote('stdin') );
4113 0 $self->_set___line__(0);
4114  
4115 0 $self->_set__nbInputProcessed( $self->_nbInputProcessed + 1 );
4116  
4117 0 ▶ if ( $self->_canDebug('i') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_canDebug("i")) 0 0 0
4118 0 $self->logger_debug('input read from stdin');
4119 }
4120 0 $self->_set__eof(false);
4121 0 ▶ if ( $parse && is_interactive($fh) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parse and is_interactive($fh)) 0 0 0
Condition0%0/3
$parse and is_interactive($fh)
!ll&&!rl&&r
000
MC/DC0%0/2
$parse and is_interactive($fh)
$parse is_interactive($fh)
Truth table0%0/3
A and B
A= $parseB= is_interactive($fh)
ABresult
0X0
100
111
4122 0 $self->_dumpCurrent();
4123 }
4124 0 ▶ while ( !$self->_eof ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_eof) 0 0 0
4125 0 my $content;
4126 0 ▶ if ( !defined( $content = <$fh> ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined($content = readline $fh)) 0 0 0
4127 0 last;
4128 }
4129 0 ▶ if ( $self->_inctounix ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_inctounix) 0 0 0
4130 0 $content =~ s/\R/\n/g;
4131 }
4132 0 ▶ if ( !Undef->check($contentp) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (&Undef()->check($contentp)) 0 0 0
4133 0 ${$contentp} .= $content;
4134 }
4135 0 ▶ if ($parse) {
Branch: 1 branch
BranchTrueFalseTotal
if ($parse) 0 0 0
4136 0 $self->impl_parseIncremental($content);
4137 0 ▶ if ( is_interactive($fh) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_interactive($fh)) 0 0 0
4138 0 $self->_dumpCurrent();
4139 }
4140 }
4141 0 $self->_set__eof(false);
4142 }
4143 0 $self->_set__eof(true);
4144 0 ▶ if ( $self->_canDebug('i') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_canDebug("i")) 0 0 0
4145 0 $self->logger_debug('input exhausted');
4146 }
4147 0 ▶ if ( !close($fh) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (close $fh) 0 0 0
4148 0 ▶ if ( !$silent ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($silent) 0 0 0
4149 0 $self->logger_warn(
4150 'Failed to close STDIN duplicate: %s', $! );
4151 }
4152 }
4153 }
4154 }
4155  
4156 29 return $self;
4157 }
4158  
4159 2 ▶ method impl_parseIncremental (Str $input --> ConsumerOf[M4Impl]) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine impl_parseIncremental: called CC=6 SCAR=18.4
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 164 0 164
if @_ != 1 0 164 164
$#_ >= 0 ? : 164 0 164
if ($#_ >= 0) 164 0 164
Type::Tiny::XS::Str($input) or _failed_check(9, "Str", $input, "exception_class", "Error::TypeTiny::Assertion") 164 0 164
4160 164 ▶ try {
Subroutine __ANON__: called CC=1 SCAR=0.0
4161 #
4162 # This can throw an exception
4163 #
4164 164 $self->_set__unparsed(
4165 $self->parser_parse( $self->_unparsed . $input ) );
4166 }
4167 3 ▶ catch {
Subroutine __ANON__: called CC=2 SCAR=7.6
4168 #
4169 # Every ImplException must be preceeded by
4170 # a call to $self->logger_error.
4171 #
4172 3 ▶ if ( !$self->impl_isImplException($_) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->impl_isImplException($_)) 0 3 3
4173 #
4174 # "$_" explicitely: if this is an object,
4175 # this will call the stringify overload
4176 #
4177 0 $self->logger_error( '%s', "$_" );
4178 }
4179 #
4180 # The whole thing is unparsed!
4181 #
4182 3 $self->_set__unparsed($input);
4183 3 return;
4184 164 };
4185 164 return $self;
4186 }
4187  
4188 2 ▶ method impl_isImplException (Any $obj --> Bool) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine impl_isImplException: called CC=8 SCAR=21.8
Subroutine __ANON__: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 4 branches
BranchTrueFalseTotal
@_ ? : 3 0 3
if @_ != 1 0 3 3
$#_ >= 0 ? : 3 0 3
if ($#_ >= 0) 3 0 3
4189 3 my $blessed = blessed($obj);
4190 3 ▶ if ( !$blessed ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($blessed) 0 3 3
4191 0 return false;
4192 }
4193 3 ▶ my $DOES = $obj->can('DOES') || 'isa';
Condition50%1/2
$obj->can('DOES') || 'isa'
l!l
30
MC/DC0%0/1
$obj->can('DOES') || 'isa'
$obj->can('DOES')
Truth table50%1/2
A
A= $obj->can('DOES')
Aresult
11
00
4194 3 ▶ if ( !grep { $obj->$DOES($_) } (ImplException) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (grep {$obj->$DOES($_);} &ImplException()) 0 3 3
4195 0 return false;
4196 }
4197 3 return true;
4198 }
4199  
4200 2 ▶ method impl_appendValue (Str $result --> ConsumerOf[M4Impl]) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine impl_appendValue: called CC=6 SCAR=18.3
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 2904 0 2904
if @_ != 1 0 2904 2904
$#_ >= 0 ? : 2904 0 2904
if ($#_ >= 0) 2904 0 2904
Type::Tiny::XS::Str($result) or _failed_check(9, "Str", $result, "exception_class", "Error::TypeTiny::Assertion") 2904 0 2904
4201 2904 $self->_lastDiversion->print($result);
4202 2904 return $self;
4203 }
4204  
4205 2 ▶ method impl_parse (Str $input --> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine impl_parse: called CC=7 SCAR=20.4
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 140 0 140
if @_ != 1 0 140 140
$#_ >= 0 ? : 140 0 140
if ($#_ >= 0) 140 0 140
Type::Tiny::XS::Str($input) or _failed_check(9, "Str", $input, "exception_class", "Error::TypeTiny::Assertion") 140 0 140
4206 140 ▶ if ( $self->_eoi ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_eoi) 0 140 140
4207 0 $self->logger_error('No more input is accepted');
4208 0 return '';
4209 }
4210 140 $self->_set__eof(true);
4211 140 return $self->impl_parseIncremental($input)->impl_value;
4212 }
4213  
4214 2 ▶ method impl_setEoi (--> ConsumerOf[M4Impl]) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine impl_setEoi: called CC=3 SCAR=11.1
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 142 0 142
if @_ != 0 0 142 142
4215 142 $self->_set__eoi(true);
4216 142 $self->impl_freezeState;
4217 142 return $self;
4218 }
4219  
4220 2 ▶ method impl_valueRef (--> Ref['SCALAR']) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine impl_valueRef: called CC=4 SCAR=13.9
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 140 0 140
if @_ != 0 0 140 140
4221 #
4222 # If not already done, say input is over
4223 #
4224 140 $self->impl_setEoi;
4225 #
4226 # Something left over ?
4227 #
4228 140 ▶ if ( $self->_unparsed ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_unparsed) 3 137 140
4229 3 $self->impl_parseIncremental('');
4230 }
4231 #
4232 # Return a reference to the value
4233 #
4234 140 return $self->_diversions_get(0)->sref;
4235 }
4236  
4237 2 ▶ method impl_value (--> Str) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine impl_value: called CC=3 SCAR=11.1
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 140 0 140
if @_ != 0 0 140 140
4238 140 return ${ $self->impl_valueRef };
4239 }
4240  
4241 0 ▶ method impl_file (--> Str) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_file: not called CC=3 SCAR=16.3
Subroutine __ANON__: called CC=1 SCAR=1.8
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
4242 0 return $self->__file__;
4243 }
4244  
4245 0 ▶ method impl_program (--> Str) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_program: not called CC=3 SCAR=16.3
Subroutine __ANON__: called CC=1 SCAR=1.8
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
4246 0 return $self->__program__;
4247 }
4248  
4249 0 ▶ method impl_debugfile (--> Str) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_debugfile: not called CC=3 SCAR=16.3
Subroutine __ANON__: called CC=1 SCAR=1.8
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
4250 0 return $self->debugfile;
4251 }
4252  
4253 0 ▶ method impl_canLog (Str $what --> Bool) {
Subroutine BEGIN: called CC=1 SCAR=2.9
Subroutine BEGIN: called CC=1 SCAR=2.9
Subroutine impl_canLog: not called CC=6 SCAR=29.2
Subroutine __ANON__: called CC=1 SCAR=2.9
Subroutine __ANON__: called CC=1 SCAR=2.9
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($what) or _failed_check(9, "Str", $what, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
4254 0 return $self->_canDebug($what);
4255 }
4256  
4257 0 ▶ method impl_line (--> PositiveOrZeroInt) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_line: not called CC=3 SCAR=16.3
Subroutine __ANON__: called CC=1 SCAR=1.8
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
4258 0 return $self->__line__;
4259 }
4260  
4261 0 ▶ method impl_rc (--> Int) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_rc: not called CC=3 SCAR=16.3
Subroutine __ANON__: called CC=1 SCAR=1.8
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
4262 0 return $self->_rc;
4263 }
4264  
4265 0 ▶ method _printable (Str|M4Macro $input, Bool $noQuote? --> Str) {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine _printable: not called CC=17 SCAR=52.2
Subroutine __ANON__: called CC=1 SCAR=4.1
Subroutine __ANON__: called CC=1 SCAR=4.1
Subroutine __ANON__: called CC=1 SCAR=4.1
Branch: 9 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ < 1 0 0 0
if @_ > 2 0 0 0
$#_ >= 0 ? : 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($input) or do { builtin::blessed($input) and do { my $method = $input->can("DOES") || $input->can("isa"); $input->$method("MarpaX::Languages::M4::Role::Macro") } } or _failed_check(185, "Str|M4Macro", $input, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
$#_ >= 1 ? : 0 0 0
if ($#_ >= 1) 0 0 0
Type::Tiny::XS::Bool($noQuote) or _failed_check(3, "Bool", $noQuote, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/9
Type::Tiny::XS::Str($input) or do { builtin::blessed($input) and do { my $method = $input->can("DOES") || $input->can("isa"); $input->$method("MarpaX::Languages::M4::Role::Macro") } }
l!l&&r!l&&!r
000
builtin::blessed($input) && do { my $method = $input->can('DOES') || $input->can('isa'); $input->$method('MarpaX::Languages::M4::Role::Macro') }
!ll&&!rl&&r
000
$input->can('DOES') || $input->can('isa')
l!l&&r!l&&!r
000
MC/DC0%0/2
Type::Tiny::XS::Str($input) or do { builtin::blessed($input) and do { my $method = $input->can("DOES") || $input->can("isa"); $input->$method("MarpaX::Languages::M4::Role::Macro") } }
Type::Tiny::XS::Str($input) do { builtin::blessed($input) and do { my $method = $input->can("DOES") || $input->can("isa"); $input->$method("MarpaX::Languages::M4::Role::Macro") } }
MC/DC0%0/2
builtin::blessed($input) && do { my $method = $input->can('DOES') || $input->can('isa'); $input->$method('MarpaX::Languages::M4::Role::Macro') }
builtin::blessed($input) do { my $method = $input->can('DOES') || $input->can('isa'); $input->$method('MarpaX::Languages::M4::Role::Macro') }
MC/DC0%0/2
$input->can('DOES') || $input->can('isa')
$input->can('DOES') $input->can('isa')
Truth table0%0/3
A or B
A= Type::Tiny::XS::Str($input)B= do { builtin::blessed($input) and do { my $method = $input->can("DOES") || $input->can("isa"); $input->$method("MarpaX::Languages::M4::Role::Macro") } }
ABresult
1X1
011
000
Truth table0%0/3
A && B
A= builtin::blessed($input)B= do { my $method = $input->can('DOES') || $input->can('isa'); $input->$method('MarpaX::Languages::M4::Role::Macro') }
ABresult
0X0
100
111
Truth table0%0/3
A || B
A= $input->can('DOES')B= $input->can('isa')
ABresult
1X1
011
000
4266 0 ▶ $noQuote //= false;
Condition0%0/3
$noQuote //= false()
l!l&&r!l&&!r
000
MC/DC0%0/2
$noQuote //= false()
$noQuote false()
Truth table0%0/3
A //= B
A= $noQuoteB= false()
ABresult
1X1
011
000
4267 #
4268 # If M4Macro let's get the object representation stringified
4269 #
4270 0 ▶ my $printable = Str->check($input) ? $input : "$input";
Branch: 1 branch
BranchTrueFalseTotal
&Str()->check($input) ? : 0 0 0
4271  
4272 0 ▶ return Str->check($input)
Branch: 2 branches
BranchTrueFalseTotal
&Str()->check($input) ? : 0 0 0
$noQuote ? : 0 0 0
4273 ? ( $noQuote ? $printable : $self->impl_quote($printable) )
4274 : $printable;
4275 }
4276  
4277 2 ▶ method impl_macroExecute (ConsumerOf[M4Macro] $macro, @args --> Str|M4Macro) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine impl_macroExecute: called CC=12 SCAR=26.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 6 branches
BranchTrueFalseTotal
@_ ? : 11 0 11
if @_ < 1 0 11 11
$#_ >= 0 ? : 11 0 11
if ($#_ >= 0) 11 0 11
do { builtin::blessed($macro) and do { my $method = $macro->can("DOES") || $macro->can("isa"); $macro->$method("MarpaX::Languages::M4::Role::Macro") } } or _failed_check(83, "M4Macro", $macro, "exception_class", "Error::TypeTiny::Assertion") 11 0 11
$#_ >= 1 ? : 9 2 11
Condition33%2/6
builtin::blessed($macro) && do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
!ll&&!rl&&r
0011
$macro->can('DOES') || $macro->can('isa')
l!l&&r!l&&!r
1100
MC/DC0%0/2
builtin::blessed($macro) && do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
builtin::blessed($macro) do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
MC/DC0%0/2
$macro->can('DOES') || $macro->can('isa')
$macro->can('DOES') $macro->can('isa')
Truth table33%1/3
A && B
A= builtin::blessed($macro)B= do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
ABresult
0X0
100
111
Truth table33%1/3
A || B
A= $macro->can('DOES')B= $macro->can('isa')
ABresult
1X1
011
000
4278 #
4279 # m4wrap is not traced
4280 # include is not traced
4281 # sinclude is not traced
4282 #
4283 11 ▶ if ( $macro->stub == \&builtin_m4wrap
Branch: 1 branch
BranchTrueFalseTotal
if ($macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_m4wrap or $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_include or $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_sinclude) { } 2 9 11
Condition66%4/6
$macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_m4wrap or $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_include or $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_sinclude
l!l&&r!l&&!r
209
$macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_m4wrap or $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_include
l!l&&r!l&&!r
209
MC/DC33%1/3
$macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_m4wrap or $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_include or $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_sinclude
$macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_m4wrap $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_include $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_sinclude
Truth table50%2/4
A or B or C
A= $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_m4wrapB= $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_includeC= $macro->stub == \&MarpaX::Languages::M4::Impl::Default::builtin_sinclude
ABCresult
1XX1
01X1
0011
0000
4284 || $macro->stub == \&builtin_include
4285 || $macro->stub == \&builtin_sinclude )
4286 {
4287 2 return $macro->macro_execute( $self, @args );
4288 }
4289 else {
4290 9 my $canTrace = $self->_canTrace($macro);
4291 9 return $self->impl_macroExecuteNoHeader( $macro,
4292 $self->impl_macroExecuteHeader( $macro, $canTrace ),
4293 $canTrace, @args );
4294 }
4295 }
4296  
4297 2 ▶ method impl_macroExecuteHeader (ConsumerOf[M4Macro] $macro, Bool $canTrace --> PositiveOrZeroInt) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine impl_macroExecuteHeader: called CC=12 SCAR=26.8
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 8 branches
BranchTrueFalseTotal
@_ ? : 2450 0 2450
if @_ != 2 0 2450 2450
$#_ >= 0 ? : 2450 0 2450
if ($#_ >= 0) 2450 0 2450
do { builtin::blessed($macro) and do { my $method = $macro->can("DOES") || $macro->can("isa"); $macro->$method("MarpaX::Languages::M4::Role::Macro") } } or _failed_check(83, "M4Macro", $macro, "exception_class", "Error::TypeTiny::Assertion") 2450 0 2450
$#_ >= 1 ? : 2450 0 2450
if ($#_ >= 1) 2450 0 2450
Type::Tiny::XS::Bool($canTrace) or _failed_check(3, "Bool", $canTrace, "exception_class", "Error::TypeTiny::Assertion") 2450 0 2450
Condition33%2/6
builtin::blessed($macro) && do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
!ll&&!rl&&r
002450
$macro->can('DOES') || $macro->can('isa')
l!l&&r!l&&!r
245000
MC/DC0%0/2
builtin::blessed($macro) && do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
builtin::blessed($macro) do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
MC/DC0%0/2
$macro->can('DOES') || $macro->can('isa')
$macro->can('DOES') $macro->can('isa')
Truth table33%1/3
A && B
A= builtin::blessed($macro)B= do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
ABresult
0X0
100
111
Truth table33%1/3
A || B
A= $macro->can('DOES')B= $macro->can('isa')
ABresult
1X1
011
000
4298 2450 local $MarpaX::Languages::M4::MACRO = $macro;
4299 2450 local $MarpaX::Languages::M4::MACROCALLID
4300 = $self->_set__macroCallId( $self->_macroCallId + 1 );
4301 #
4302 # Log the macro
4303 # We avoid these unnecessary calls by calling ourself _canTrace
4304 #
4305 2450 ▶ if ($canTrace) {
Branch: 1 branch
BranchTrueFalseTotal
if ($canTrace) 0 2450 2450
4306 0 my $printableMacroName = $self->_printable( $macro->name, true );
4307  
4308 0 $self->logger_trace( '%s ...', $printableMacroName );
4309 }
4310  
4311 2450 return $MarpaX::Languages::M4::MACROCALLID;
4312 }
4313  
4314 2 ▶ method impl_macroExecuteNoHeader (ConsumerOf[M4Macro] $macro, PositiveOrZeroInt $macroCallId, Bool $canTrace, @args --> Str|M4Macro) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine impl_macroExecuteNoHeader: called CC=25 SCAR=43.4
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 12 branches
BranchTrueFalseTotal
@_ ? : 2449 0 2449
if @_ < 3 0 2449 2449
$#_ >= 0 ? : 2449 0 2449
if ($#_ >= 0) 2449 0 2449
do { builtin::blessed($macro) and do { my $method = $macro->can("DOES") || $macro->can("isa"); $macro->$method("MarpaX::Languages::M4::Role::Macro") } } or _failed_check(83, "M4Macro", $macro, "exception_class", "Error::TypeTiny::Assertion") 2449 0 2449
$#_ >= 1 ? : 2449 0 2449
if ($#_ >= 1) 2449 0 2449
Type::Tiny::XS::PositiveOrZeroInt($macroCallId) or _failed_check(48, "PositiveOrZeroInt", $macroCallId, "exception_class", "Error::TypeTiny::Assertion") 2449 0 2449
$#_ >= 2 ? : 2449 0 2449
if ($#_ >= 2) 2449 0 2449
Type::Tiny::XS::Bool($canTrace) or _failed_check(3, "Bool", $canTrace, "exception_class", "Error::TypeTiny::Assertion") 2449 0 2449
$#_ >= 3 ? : 1860 589 2449
Condition33%2/6
builtin::blessed($macro) && do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
!ll&&!rl&&r
002449
$macro->can('DOES') || $macro->can('isa')
l!l&&r!l&&!r
244900
MC/DC0%0/2
builtin::blessed($macro) && do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
builtin::blessed($macro) do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
MC/DC0%0/2
$macro->can('DOES') || $macro->can('isa')
$macro->can('DOES') $macro->can('isa')
Truth table33%1/3
A && B
A= builtin::blessed($macro)B= do { my $method = $macro->can('DOES') || $macro->can('isa'); $macro->$method('MarpaX::Languages::M4::Role::Macro') }
ABresult
0X0
100
111
Truth table33%1/3
A || B
A= $macro->can('DOES')B= $macro->can('isa')
ABresult
1X1
011
000
4315 #
4316 # Execute the macro
4317 #
4318 2449 local $MarpaX::Languages::M4::MACRO = $macro;
4319 2449 local $MarpaX::Languages::M4::MACROCALLID = $macroCallId;
4320 2449 my $printableMacroName;
4321  
4322 2449 ▶ if ( $canTrace && ( $self->_canDebug('a') || $self->_canDebug('c') ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($canTrace and $self->_canDebug("a") || $self->_canDebug("c")) 0 2449 2449
Condition16%1/6
$canTrace and $self->_canDebug("a") || $self->_canDebug("c")
!ll&&!rl&&r
244900
$self->_canDebug("a") or $self->_canDebug("c")
l!l&&r!l&&!r
000
MC/DC0%0/3
$canTrace and $self->_canDebug("a") || $self->_canDebug("c")
$canTrace $self->_canDebug("a") $self->_canDebug("c")
Truth table25%1/4
A and B or C
A= $canTraceB= $self->_canDebug("a")C= $self->_canDebug("c")
ABCresult
0XX0
1000
11X1
1011
4323 {
4324 0 $printableMacroName = $self->_printable( $macro->name, true );
4325  
4326 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) { } 0 0 0
4327 my $printableArguments
4328 0 = join( ', ', map { $self->_printable($_) } @args );
4329 0 $self->logger_trace( '%s(%s) -> ???',
4330 $printableMacroName, $printableArguments );
4331 }
4332 else {
4333 0 $self->logger_trace( '%s -> ???', $printableMacroName );
4334 }
4335 }
4336  
4337 2449 my $rc = $macro->macro_execute( $self, @args );
4338  
4339 2447 ▶ if ( $canTrace && ( $self->_canDebug('e') || $self->_canDebug('c') ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($canTrace and $self->_canDebug("e") || $self->_canDebug("c")) 0 2447 2447
Condition16%1/6
$canTrace and $self->_canDebug("e") || $self->_canDebug("c")
!ll&&!rl&&r
244700
$self->_canDebug("e") or $self->_canDebug("c")
l!l&&r!l&&!r
000
MC/DC0%0/3
$canTrace and $self->_canDebug("e") || $self->_canDebug("c")
$canTrace $self->_canDebug("e") $self->_canDebug("c")
Truth table25%1/4
A and B or C
A= $canTraceB= $self->_canDebug("e")C= $self->_canDebug("c")
ABCresult
0XX0
1000
11X1
1011
4340 {
4341 0 ▶ if ( length($rc) > 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $rc > 0) { } 0 0 0
4342 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) { } 0 0 0
4343 0 $self->logger_trace( '%s(...) -> %s',
4344 $printableMacroName, $self->_printable($rc) );
4345 }
4346 else {
4347 0 $self->logger_trace( '%s -> %s', $printableMacroName,
4348 $self->_printable($rc) );
4349 }
4350 }
4351 else {
4352 0 ▶ if (@args) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) { } 0 0 0
4353 0 $self->logger_trace( '%s(...)', $printableMacroName );
4354 }
4355 else {
4356 0 $self->logger_trace( '%s', $printableMacroName );
4357 }
4358 }
4359 }
4360  
4361 2447 return $rc;
4362 }
4363  
4364 0 ▶ method impl_macroCallId (--> PositiveOrZeroInt) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_macroCallId: not called CC=3 SCAR=16.3
Subroutine __ANON__: called CC=1 SCAR=1.8
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
4365 0 return $self->_macroCallId;
4366 }
4367  
4368 0 ▶ method impl_unparsed (--> Str) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_unparsed: not called CC=3 SCAR=16.3
Subroutine __ANON__: called CC=1 SCAR=1.8
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
4369 0 return $self->_unparsed;
4370 }
4371  
4372 2 ▶ method impl_eoi (--> Bool) {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine impl_eoi: called CC=3 SCAR=11.1
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 1 0 1
if @_ != 0 0 1 1
4373 1 return $self->_eoi;
4374 }
4375  
4376 2 ▶ method impl_raiseException (Str $message --> Undef) {
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine BEGIN: called CC=1 SCAR=0.1
Subroutine impl_raiseException: called CC=6 SCAR=18.3
Subroutine __ANON__: called CC=1 SCAR=0.1
Subroutine __ANON__: called CC=1 SCAR=0.1
Branch: 5 branches
BranchTrueFalseTotal
@_ ? : 7 0 7
if @_ != 1 0 7 7
$#_ >= 0 ? : 7 0 7
if ($#_ >= 0) 7 0 7
Type::Tiny::XS::Str($message) or _failed_check(9, "Str", $message, "exception_class", "Error::TypeTiny::Assertion") 7 0 7
4377 7 $self->logger_error($message);
4378 7 ImplException->throw($message);
4379 }
4380  
4381 2 has _nbInputProcessed => (
4382 is => 'rwp',
4383 isa => PositiveOrZeroInt,
4384 handles_via => 'Number',
4385 default => 0
4386 );
4387  
4388 0 ▶ method impl_nbInputProcessed (--> PositiveOrZeroInt) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_nbInputProcessed: not called CC=3 SCAR=16.3
Subroutine __ANON__: called CC=1 SCAR=1.8
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
4389 0 return $self->_nbInputProcessed;
4390 }
4391  
4392 0 ▶ method impl_readFromStdin (--> ConsumerOf[M4Impl]) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_readFromStdin: not called CC=3 SCAR=16.8
Subroutine __ANON__: called CC=1 SCAR=1.8
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
4393 0 $self->interactive(true);
4394 0 return $self;
4395 }
4396  
4397 0 ▶ method impl_debugFile (--> Undef|Str) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_debugFile: not called CC=3 SCAR=16.3
Subroutine __ANON__: called CC=1 SCAR=1.8
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
4398 0 return $self->_debugfile;
4399 }
4400  
4401 0 ▶ method impl_nestingLimit (--> PositiveOrZeroInt) {
Subroutine BEGIN: called CC=1 SCAR=1.8
Subroutine impl_nestingLimit: not called CC=3 SCAR=16.3
Branch: 2 branches
BranchTrueFalseTotal
@_ ? : 0 0 0
if @_ != 0 0 0 0
4402 0 return $self->_nesting_limit;
4403 }
4404  
4405 2 with 'MarpaX::Languages::M4::Role::Impl';
4406 2 with 'MooX::Role::Logger';
4407 }
4408  
4409 3 1;
4410  
4411 __END__
« M4/Impl/Parser.pm ↑ Summary M4/Impl/Input.pm »