| 1 | 4 | ▶ | use Moops; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # PODNAME: MarpaX::Languages::M4::Impl::Macro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # ABSTRACT: M4 Macro generic implementation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | class MarpaX::Languages::M4::Impl::Macro { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | our $VERSION = '0.020'; # VERSION | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 4 | our $AUTHORITY = 'cpan:JDDPAUSE'; # AUTHORITY | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 4 | ▶ | use MarpaX::Languages::M4::Role::Macro; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | use MarpaX::Languages::M4::Type::Macro -all; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use MooX::HandlesVia; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | ▶ | use Types::Common::Numeric -all; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | has name => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | isa => Str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | required => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 4 | has stub => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | isa => CodeRef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | required => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | handles_via => 'Code', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | handles => { macro_execute => 'execute' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 4 | has expansion => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | isa => Undef | Str, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | required => 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 4 | has needParams => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | isa => Bool, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | default => false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | has paramCanBeMacro => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | isa => HashRef [ PositiveOrZeroInt | Enum [qw/*/] ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 6843 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 6843 | {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 4 | handles_via => 'Hash', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | handles => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | _paramCanBeMacro_get => 'get', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | _paramCanBeMacro_exists => 'exists', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # We do not hold references in values, so shallow_clone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | # is a real clone | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | _paramCanBeMacro_clone => 'shallow_clone' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | has postMatchLength => ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | isa => CodeRef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 6843 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 2310 | ▶ | sub { return 0; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 6843 | }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 4 | handles_via => 'Code', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | handles => { macro_postMatchLengthExecute => 'execute' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 3 | ▶ | method macro_name (--> Str) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
macro_name: called CC=3 SCAR=11.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 4 | return $self->name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 3 | ▶ | method macro_expansion (--> Undef | Str) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
macro_expansion: called CC=3 SCAR=11.1
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 62 | return $self->expansion; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 3 | ▶ | method macro_needParams (--> Bool ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
macro_needParams: called CC=3 SCAR=11.1
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 589 | return $self->needParams; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 3 | ▶ | method macro_isBuiltin (--> Bool) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
macro_isBuiltin: called CC=3 SCAR=11.1
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 81 | return Undef->check( $self->expansion ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 3 | ▶ | method macro_paramCanBeMacro (PositiveOrZeroInt $paramPos --> Bool) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
macro_paramCanBeMacro: called CC=10 SCAR=23.5
Subroutine
__ANON__: called CC=1 SCAR=0.1
Subroutine
__ANON__: called CC=1 SCAR=0.1
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 17 | ▶ | if (( $self->_paramCanBeMacro_exists($paramPos) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
$self->_paramCanBeMacro_exists($paramPos) and $self->_paramCanBeMacro_get($paramPos) or $self->_paramCanBeMacro_exists("*") and $self->_paramCanBeMacro_get("*")
$self->_paramCanBeMacro_exists($paramPos) and $self->_paramCanBeMacro_get($paramPos)
$self->_paramCanBeMacro_exists("*") and $self->_paramCanBeMacro_get("*")
MC/DC50%2/4
$self->_paramCanBeMacro_exists($paramPos) and $self->_paramCanBeMacro_get($paramPos) or $self->_paramCanBeMacro_exists("*") and $self->_paramCanBeMacro_get("*")
$self->_paramCanBeMacro_exists($paramPos)
$self->_paramCanBeMacro_get($paramPos)
$self->_paramCanBeMacro_exists("*")
$self->_paramCanBeMacro_get("*")
Truth table42%3/7
A and B or C and D
A= $self->_paramCanBeMacro_exists($paramPos)B= $self->_paramCanBeMacro_get($paramPos)C= $self->_paramCanBeMacro_exists("*")D= $self->_paramCanBeMacro_get("*")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | && $self->_paramCanBeMacro_get($paramPos) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | || ( $self->_paramCanBeMacro_exists('*') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | && $self->_paramCanBeMacro_get('*') ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 14 | return true; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 3 | return false; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 3 | ▶ | method macro_clone (Str $name --> M4Macro) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
BEGIN: called CC=1 SCAR=0.1
Subroutine
macro_clone: called CC=6 SCAR=18.3
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 8 | my $macro = __PACKAGE__->new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | name => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | stub => $self->stub, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | needParams => $self->needParams, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | # Cloning a builtin is a builtin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | expansion => $self->expansion, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | # No need of clone: the hash is ro once created | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | paramCanBeMacro => $self->_paramCanBeMacro_clone, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | postMatchLength => $self->postMatchLength | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 8 | return $macro; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 4 | with 'MarpaX::Languages::M4::Role::Macro'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||