| 1 | package Business::UDC::Grammar; | ||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||
| 3 | 12 | ▶ | use base qw(Exporter); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 4 | 12 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 5 | 12 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||
| 7 | 12 | ▶ | use List::Util 1.33 qw(any); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 8 | 12 | ▶ | use Readonly; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||
| 10 | 12 | Readonly::Array our @EXPORT_OK => qw(can_be_standalone can_follow_operator | |||||||||||||||||||||||||||||||||
| 11 | can_follow_primary can_follow_term can_precede_number | ||||||||||||||||||||||||||||||||||
| 12 | can_start_expression_with describe_token_type group_subtype is_modifier_token | ||||||||||||||||||||||||||||||||||
| 13 | is_operator_token is_primary_token is_valid_operator operator_info); | ||||||||||||||||||||||||||||||||||
| 14 | 12 | Readonly::Hash our %DESC => ( | |||||||||||||||||||||||||||||||||
| 15 | ALPHA_SPEC => 'direct alphabetical specification', | ||||||||||||||||||||||||||||||||||
| 16 | APOS_AUX => 'apostrophe auxiliary', | ||||||||||||||||||||||||||||||||||
| 17 | AUX_DOT => 'dot auxiliary', | ||||||||||||||||||||||||||||||||||
| 18 | AUX_GROUP => 'parenthesized auxiliary', | ||||||||||||||||||||||||||||||||||
| 19 | AUX_LANG => 'language auxiliary', | ||||||||||||||||||||||||||||||||||
| 20 | AUX_TIME => 'quoted time auxiliary', | ||||||||||||||||||||||||||||||||||
| 21 | FORM => 'special auxiliary subdivision', | ||||||||||||||||||||||||||||||||||
| 22 | LBRACK => 'left subgroup bracket', | ||||||||||||||||||||||||||||||||||
| 23 | NUMBER => 'main UDC number', | ||||||||||||||||||||||||||||||||||
| 24 | OP => 'operator', | ||||||||||||||||||||||||||||||||||
| 25 | PARTIAL_FORM => 'partial form for range shorthand', | ||||||||||||||||||||||||||||||||||
| 26 | PARTIAL_NUMBER => 'partial number for range shorthand', | ||||||||||||||||||||||||||||||||||
| 27 | RBRACK => 'right subgroup bracket', | ||||||||||||||||||||||||||||||||||
| 28 | WHITESPACE => 'whitespace', | ||||||||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||||||||
| 30 | 12 | Readonly::Hash our %TOKEN_RULES => ( | |||||||||||||||||||||||||||||||||
| 31 | ALPHA_SPEC => { | ||||||||||||||||||||||||||||||||||
| 32 | standalone => 0, | ||||||||||||||||||||||||||||||||||
| 33 | primary => 0, | ||||||||||||||||||||||||||||||||||
| 34 | modifier => 1, | ||||||||||||||||||||||||||||||||||
| 35 | }, | ||||||||||||||||||||||||||||||||||
| 36 | APOS_AUX => { | ||||||||||||||||||||||||||||||||||
| 37 | standalone => 0, | ||||||||||||||||||||||||||||||||||
| 38 | primary => 0, | ||||||||||||||||||||||||||||||||||
| 39 | modifier => 1, | ||||||||||||||||||||||||||||||||||
| 40 | }, | ||||||||||||||||||||||||||||||||||
| 41 | AUX_DOT => { | ||||||||||||||||||||||||||||||||||
| 42 | standalone => 0, | ||||||||||||||||||||||||||||||||||
| 43 | primary => 0, | ||||||||||||||||||||||||||||||||||
| 44 | modifier => 1, | ||||||||||||||||||||||||||||||||||
| 45 | }, | ||||||||||||||||||||||||||||||||||
| 46 | AUX_GROUP => { | ||||||||||||||||||||||||||||||||||
| 47 | standalone => 1, | ||||||||||||||||||||||||||||||||||
| 48 | primary => 1, | ||||||||||||||||||||||||||||||||||
| 49 | modifier => 1, | ||||||||||||||||||||||||||||||||||
| 50 | }, | ||||||||||||||||||||||||||||||||||
| 51 | AUX_LANG => { | ||||||||||||||||||||||||||||||||||
| 52 | standalone => 1, | ||||||||||||||||||||||||||||||||||
| 53 | primary => 1, | ||||||||||||||||||||||||||||||||||
| 54 | modifier => 1, | ||||||||||||||||||||||||||||||||||
| 55 | }, | ||||||||||||||||||||||||||||||||||
| 56 | AUX_TIME => { | ||||||||||||||||||||||||||||||||||
| 57 | standalone => 1, | ||||||||||||||||||||||||||||||||||
| 58 | primary => 1, | ||||||||||||||||||||||||||||||||||
| 59 | modifier => 1, | ||||||||||||||||||||||||||||||||||
| 60 | }, | ||||||||||||||||||||||||||||||||||
| 61 | FORM => { | ||||||||||||||||||||||||||||||||||
| 62 | standalone => 0, | ||||||||||||||||||||||||||||||||||
| 63 | primary => 0, | ||||||||||||||||||||||||||||||||||
| 64 | modifier => 1, | ||||||||||||||||||||||||||||||||||
| 65 | }, | ||||||||||||||||||||||||||||||||||
| 66 | NUMBER => { | ||||||||||||||||||||||||||||||||||
| 67 | standalone => 1, | ||||||||||||||||||||||||||||||||||
| 68 | primary => 1, | ||||||||||||||||||||||||||||||||||
| 69 | modifier => 0, | ||||||||||||||||||||||||||||||||||
| 70 | }, | ||||||||||||||||||||||||||||||||||
| 71 | OP => { | ||||||||||||||||||||||||||||||||||
| 72 | standalone => 0, | ||||||||||||||||||||||||||||||||||
| 73 | primary => 0, | ||||||||||||||||||||||||||||||||||
| 74 | modifier => 0, | ||||||||||||||||||||||||||||||||||
| 75 | }, | ||||||||||||||||||||||||||||||||||
| 76 | PARTIAL_FORM => { | ||||||||||||||||||||||||||||||||||
| 77 | standalone => 0, | ||||||||||||||||||||||||||||||||||
| 78 | primary => 0, | ||||||||||||||||||||||||||||||||||
| 79 | modifier => 0, | ||||||||||||||||||||||||||||||||||
| 80 | }, | ||||||||||||||||||||||||||||||||||
| 81 | PARTIAL_NUMBER => { | ||||||||||||||||||||||||||||||||||
| 82 | standalone => 0, | ||||||||||||||||||||||||||||||||||
| 83 | primary => 0, | ||||||||||||||||||||||||||||||||||
| 84 | modifier => 0, | ||||||||||||||||||||||||||||||||||
| 85 | }, | ||||||||||||||||||||||||||||||||||
| 86 | ); | ||||||||||||||||||||||||||||||||||
| 87 | 12 | Readonly::Hash our %OPERATORS => ( | |||||||||||||||||||||||||||||||||
| 88 | '+' => { | ||||||||||||||||||||||||||||||||||
| 89 | name => 'addition', | ||||||||||||||||||||||||||||||||||
| 90 | precedence => 10, | ||||||||||||||||||||||||||||||||||
| 91 | associativity => 'left', | ||||||||||||||||||||||||||||||||||
| 92 | right_types => [qw(AUX_GROUP AUX_LANG AUX_TIME NUMBER)], | ||||||||||||||||||||||||||||||||||
| 93 | }, | ||||||||||||||||||||||||||||||||||
| 94 | ':' => { | ||||||||||||||||||||||||||||||||||
| 95 | name => 'relation', | ||||||||||||||||||||||||||||||||||
| 96 | precedence => 20, | ||||||||||||||||||||||||||||||||||
| 97 | associativity => 'left', | ||||||||||||||||||||||||||||||||||
| 98 | right_types => [qw(AUX_GROUP AUX_LANG AUX_TIME NUMBER)], | ||||||||||||||||||||||||||||||||||
| 99 | }, | ||||||||||||||||||||||||||||||||||
| 100 | '::' => { | ||||||||||||||||||||||||||||||||||
| 101 | name => 'fixed_relation', | ||||||||||||||||||||||||||||||||||
| 102 | precedence => 20, | ||||||||||||||||||||||||||||||||||
| 103 | associativity => 'left', | ||||||||||||||||||||||||||||||||||
| 104 | right_types => [qw(AUX_GROUP AUX_LANG AUX_TIME NUMBER)], | ||||||||||||||||||||||||||||||||||
| 105 | }, | ||||||||||||||||||||||||||||||||||
| 106 | '/' => { | ||||||||||||||||||||||||||||||||||
| 107 | name => 'consecutive_extension', | ||||||||||||||||||||||||||||||||||
| 108 | precedence => 15, | ||||||||||||||||||||||||||||||||||
| 109 | associativity => 'left', | ||||||||||||||||||||||||||||||||||
| 110 | right_types => [qw(APOS_AUX AUX_DOT AUX_GROUP AUX_LANG AUX_TIME FORM NUMBER)], | ||||||||||||||||||||||||||||||||||
| 111 | }, | ||||||||||||||||||||||||||||||||||
| 112 | ); | ||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||
| 114 | 12 | our $VERSION = 0.12; | |||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | sub can_be_standalone { | ||||||||||||||||||||||||||||||||
|
Subroutine
can_be_standalone: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 117 | 0 | my $type = shift; | |||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | if (! $TOKEN_RULES{$type}) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 120 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||
| 123 | 0 | ▶ | if ($type eq 'AUX_GROUP') { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 124 | 0 | return 1; | |||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||
| 127 | 0 | ▶ | return $TOKEN_RULES{$type}{'standalone'} ? 1 : 0; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||
| 130 | 33 | ▶ | sub can_follow_operator { | ||||||||||||||||||||||||||||||||
|
Subroutine
can_follow_operator: called CC=4 SCAR=14.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 131 | 33 | my ($op, $type) = @_; | |||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||
| 133 | 33 | ▶ | if (! is_valid_operator($op)) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 134 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||
| 137 | 33 | ▶ | my %allowed = map { $_ => 1 } @{$OPERATORS{$op}{'right_types'} || []}; | ||||||||||||||||||||||||||||||||
|
Condition50%1/2
$Business::UDC::Grammar::OPERATORS{$op}{'right_types'} || []
MC/DC0%0/1
$Business::UDC::Grammar::OPERATORS{$op}{'right_types'} || []
$Business::UDC::Grammar::OPERATORS{$op}{'right_types'}
Truth table50%1/2
A
A= $Business::UDC::Grammar::OPERATORS{$op}{'right_types'}
| |||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||
| 139 | 33 | ▶ | return $allowed{$type} ? 1 : 0; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||
| 142 | 108 | ▶ | sub can_follow_primary { | ||||||||||||||||||||||||||||||||
|
Subroutine
can_follow_primary: called CC=18 SCAR=32.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 143 | 108 | my ($type, $value, $primary_type, $primary_value) = @_; | |||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||
| 145 | 108 | ▶ | if (! is_modifier_token($type)) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 146 | 43 | return 0; | |||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||
| 149 | 65 | ▶ | if ($type eq 'FORM') { | ||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||
| 150 | 14 | ▶ | if (defined $primary_type | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $primary_type and &any(sub {
$primary_type eq $_;
}
, "ALPHA_SPEC", "APOS_AUX", "AUX_DOT", "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
MC/DC0%0/2
defined $primary_type and &any(sub {
$primary_type eq $_;
}
, "ALPHA_SPEC", "APOS_AUX", "AUX_DOT", "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
defined $primary_type
&any(sub {
$primary_type eq $_;
}
, "ALPHA_SPEC", "APOS_AUX", "AUX_DOT", "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
Truth table33%1/3
A and B
A= defined $primary_typeB= &any(sub {
$primary_type eq $_;
}
, "ALPHA_SPEC", "APOS_AUX", "AUX_DOT", "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
| |||||||||||||||||||||||||||||||||||
| 151 | 78 | ▶ | && any { $primary_type eq $_ } qw(ALPHA_SPEC APOS_AUX AUX_DOT AUX_GROUP AUX_LANG AUX_TIME FORM NUMBER SUBGROUP)) { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||
| 153 | 14 | return 1; | |||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||
| 155 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 156 | } elsif ($type eq 'AUX_DOT') { | ||||||||||||||||||||||||||||||||||
| 157 | 3 | ▶ | if (defined $primary_type | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $primary_type and &any(sub {
$primary_type eq $_;
}
, "NUMBER", "AUX_GROUP", "SUBGROUP")
MC/DC0%0/2
defined $primary_type and &any(sub {
$primary_type eq $_;
}
, "NUMBER", "AUX_GROUP", "SUBGROUP")
defined $primary_type
&any(sub {
$primary_type eq $_;
}
, "NUMBER", "AUX_GROUP", "SUBGROUP")
Truth table33%1/3
A and B
A= defined $primary_typeB= &any(sub {
$primary_type eq $_;
}
, "NUMBER", "AUX_GROUP", "SUBGROUP")
| |||||||||||||||||||||||||||||||||||
| 158 | 7 | ▶ | && any { $primary_type eq $_ } qw(NUMBER AUX_GROUP SUBGROUP)) { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||||||||
| 160 | 3 | return 1; | |||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||
| 162 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 163 | } elsif ($type eq 'AUX_GROUP') { | ||||||||||||||||||||||||||||||||||
| 164 | 20 | my $subtype = group_subtype($value); | |||||||||||||||||||||||||||||||||
| 165 | 20 | ▶ | if ($subtype eq 'AUX_FORM') { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 166 | 5 | return 1; | |||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||
| 169 | # XXX | ||||||||||||||||||||||||||||||||||
| 170 | 15 | return 1; | |||||||||||||||||||||||||||||||||
| 171 | } elsif ($type eq 'AUX_TIME') { | ||||||||||||||||||||||||||||||||||
| 172 | 5 | return 1; | |||||||||||||||||||||||||||||||||
| 173 | } elsif ($type eq 'AUX_LANG') { | ||||||||||||||||||||||||||||||||||
| 174 | 1 | return 1; | |||||||||||||||||||||||||||||||||
| 175 | } elsif ($type eq 'ALPHA_SPEC') { | ||||||||||||||||||||||||||||||||||
| 176 | 14 | ▶ | if (defined $primary_type | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $primary_type and &any(sub {
$primary_type eq $_;
}
, "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
MC/DC0%0/2
defined $primary_type and &any(sub {
$primary_type eq $_;
}
, "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
defined $primary_type
&any(sub {
$primary_type eq $_;
}
, "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
Truth table33%1/3
A and B
A= defined $primary_typeB= &any(sub {
$primary_type eq $_;
}
, "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
| |||||||||||||||||||||||||||||||||||
| 177 | 59 | ▶ | && any { $primary_type eq $_ } qw(AUX_GROUP AUX_LANG AUX_TIME FORM NUMBER SUBGROUP)) { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||
| 179 | 14 | return 1; | |||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||
| 181 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 182 | } elsif ($type eq 'APOS_AUX') { | ||||||||||||||||||||||||||||||||||
| 183 | 8 | ▶ | if (defined $primary_type | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $primary_type and &any(sub {
$primary_type eq $_;
}
, "APOS_AUX", "AUX_DOT", "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
MC/DC0%0/2
defined $primary_type and &any(sub {
$primary_type eq $_;
}
, "APOS_AUX", "AUX_DOT", "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
defined $primary_type
&any(sub {
$primary_type eq $_;
}
, "APOS_AUX", "AUX_DOT", "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
Truth table33%1/3
A and B
A= defined $primary_typeB= &any(sub {
$primary_type eq $_;
}
, "APOS_AUX", "AUX_DOT", "AUX_GROUP", "AUX_LANG", "AUX_TIME", "FORM", "NUMBER", "SUBGROUP")
| |||||||||||||||||||||||||||||||||||
| 184 | 46 | ▶ | && any { $primary_type eq $_ } qw(APOS_AUX AUX_DOT AUX_GROUP AUX_LANG AUX_TIME FORM NUMBER SUBGROUP)) { | ||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||
| 186 | 8 | return 1; | |||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||
| 188 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||
| 191 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | sub can_follow_term { | ||||||||||||||||||||||||||||||||
|
Subroutine
can_follow_term: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 195 | 0 | my $type = shift; | |||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||
| 197 | 0 | return is_operator_token($type); | |||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||
| 200 | 4 | ▶ | sub can_precede_number { | ||||||||||||||||||||||||||||||||
|
Subroutine
can_precede_number: called CC=8 SCAR=26.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 201 | 4 | my ($type, $value) = @_; | |||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||
| 203 | 4 | ▶ | return 0 unless defined $type; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||
| 205 | 4 | ▶ | if ($type eq 'SUBGROUP') { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 206 | 1 | return 1; | |||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||
| 209 | 3 | ▶ | if ($type eq 'AUX_GROUP') { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 210 | 3 | my $subtype = group_subtype($value); | |||||||||||||||||||||||||||||||||
| 211 | 3 | ▶ | return $subtype eq 'AUX_FORM' || $subtype eq 'AUX_OTHER' ? 1 : 0; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$subtype eq "AUX_FORM" or $subtype eq "AUX_OTHER"
MC/DC0%0/2
$subtype eq "AUX_FORM" or $subtype eq "AUX_OTHER"
$subtype eq "AUX_FORM"
$subtype eq "AUX_OTHER"
Truth table66%2/3
A or B
A= $subtype eq "AUX_FORM"B= $subtype eq "AUX_OTHER"
| |||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | if ($type eq 'AUX_TIME' || $type eq 'AUX_LANG') { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$type eq "AUX_TIME" or $type eq "AUX_LANG"
MC/DC0%0/2
$type eq "AUX_TIME" or $type eq "AUX_LANG"
$type eq "AUX_TIME"
$type eq "AUX_LANG"
Truth table0%0/3
A or B
A= $type eq "AUX_TIME"B= $type eq "AUX_LANG"
| |||||||||||||||||||||||||||||||||||
| 215 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||
| 218 | 0 | return 0; | |||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||
| 221 | 0 | ▶ | sub can_start_expression_with { | ||||||||||||||||||||||||||||||||
|
Subroutine
can_start_expression_with: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 222 | 0 | my $type = shift; | |||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||
| 224 | 0 | return can_be_standalone($type); | |||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | sub describe_token_type { | ||||||||||||||||||||||||||||||||
|
Subroutine
describe_token_type: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 228 | 0 | my $type = shift; | |||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | return $DESC{$type} || 'unknown token'; | ||||||||||||||||||||||||||||||||
|
Condition0%0/2
$Business::UDC::Grammar::DESC{$type} || 'unknown token'
MC/DC0%0/1
$Business::UDC::Grammar::DESC{$type} || 'unknown token'
$Business::UDC::Grammar::DESC{$type}
Truth table0%0/2
A
A= $Business::UDC::Grammar::DESC{$type}
| |||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||
| 233 | 23 | ▶ | sub group_subtype { | ||||||||||||||||||||||||||||||||
|
Subroutine
group_subtype: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 234 | 23 | my $value = shift; | |||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||
| 236 | 23 | ▶ | if (! defined $value) { | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 237 | 0 | return 'UNKNOWN'; | |||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||
| 240 | # Common auxiliaries of form: (0...) | ||||||||||||||||||||||||||||||||||
| 241 | 23 | ▶ | return 'AUX_FORM' if $value =~ /^\(0(?:[^)]*)\)$/; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||
| 243 | # Place and other special auxiliaries typically begin with non-zero digit | ||||||||||||||||||||||||||||||||||
| 244 | 16 | ▶ | return 'AUX_OTHER' if $value =~ /^\([1-9][^)]*\)$/; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||
| 246 | 1 | return 'UNKNOWN'; | |||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||
| 249 | 108 | ▶ | sub is_modifier_token { | ||||||||||||||||||||||||||||||||
|
Subroutine
is_modifier_token: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 250 | 108 | my $type = shift; | |||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||
| 252 | 108 | ▶ | return ($TOKEN_RULES{$type} && $TOKEN_RULES{$type}{'modifier'}) ? 1 : 0; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$Business::UDC::Grammar::TOKEN_RULES{$type} and $Business::UDC::Grammar::TOKEN_RULES{$type}{"modifier"}
MC/DC100%2/2
$Business::UDC::Grammar::TOKEN_RULES{$type} and $Business::UDC::Grammar::TOKEN_RULES{$type}{"modifier"}
$Business::UDC::Grammar::TOKEN_RULES{$type}
$Business::UDC::Grammar::TOKEN_RULES{$type}{"modifier"}
Truth table100%3/3
A and B
A= $Business::UDC::Grammar::TOKEN_RULES{$type}B= $Business::UDC::Grammar::TOKEN_RULES{$type}{"modifier"}
| |||||||||||||||||||||||||||||||||||
| 253 | } | ||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||
| 255 | 44 | ▶ | sub is_operator_token { | ||||||||||||||||||||||||||||||||
|
Subroutine
is_operator_token: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 256 | 44 | my $type = shift; | |||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||
| 258 | 44 | ▶ | return (defined $type && $type eq 'OP') ? 1 : 0; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $type and $type eq "OP"
MC/DC50%1/2
defined $type and $type eq "OP"
defined $type
$type eq "OP"
Truth table66%2/3
A and B
A= defined $typeB= $type eq "OP"
| |||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||
| 261 | 95 | ▶ | sub is_primary_token { | ||||||||||||||||||||||||||||||||
|
Subroutine
is_primary_token: called CC=3 SCAR=11.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 262 | 95 | my $type = shift; | |||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||
| 264 | 95 | ▶ | return ($TOKEN_RULES{$type} && $TOKEN_RULES{$type}{'primary'}) ? 1 : 0; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$Business::UDC::Grammar::TOKEN_RULES{$type} and $Business::UDC::Grammar::TOKEN_RULES{$type}{"primary"}
MC/DC50%1/2
$Business::UDC::Grammar::TOKEN_RULES{$type} and $Business::UDC::Grammar::TOKEN_RULES{$type}{"primary"}
$Business::UDC::Grammar::TOKEN_RULES{$type}
$Business::UDC::Grammar::TOKEN_RULES{$type}{"primary"}
Truth table66%2/3
A and B
A= $Business::UDC::Grammar::TOKEN_RULES{$type}B= $Business::UDC::Grammar::TOKEN_RULES{$type}{"primary"}
| |||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||
| 267 | 68 | ▶ | sub is_valid_operator { | ||||||||||||||||||||||||||||||||
|
Subroutine
is_valid_operator: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 268 | 68 | my $op = shift; | |||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||
| 270 | 68 | ▶ | return exists $OPERATORS{$op} ? 1 : 0; | ||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | sub operator_info { | ||||||||||||||||||||||||||||||||
|
Subroutine
operator_info: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||
| 274 | 0 | my $op = shift; | |||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||
| 276 | 0 | return $OPERATORS{$op}; | |||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||
| 279 | 12 | 1; | |||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||
| 281 | __END__ | ||||||||||||||||||||||||||||||||||