| 1 | # ABSTRACT Math Notation for Postfix and Infix Expressions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ## Copyright (C) Carlos Celso | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ## This program is free software: you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ## it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | ## the Free Software Foundation, either version 3 of the License, or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | ## (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | package Math::Notation::PostfixInfix; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use Exporter; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | use vars qw( @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1 | our @ISA = qw( Exporter ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1 | our @EXPORT = qw( new Infix_to_Postfix Postfix_to_Infix Postfix_Test ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1 | our @EXPORT_OK = qw( new Infix_to_Postfix Postfix_to_Infix Postfix_Test ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1 | our %EXPORT_TAGS = ( all => [@EXPORT_OK] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1 | our $VERSION = "2023.111.1"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | # create object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | sub new() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | my $class = shift; $class = ref($class) || $class || 'Math::Notation::PostfixInfix'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/5
ref $class || $class || 'Math::Notation::PostfixInfix'
ref $class or $class
MC/DC0%0/2
ref $class || $class || 'Math::Notation::PostfixInfix'
ref $class
$class
Truth table0%0/3
A or B
A= ref $classB= $class
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ## save options | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $self = {@_}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | ## new object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | my $bless = bless($self,$class); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | return 0 if (!defined($bless)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | $bless; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | # polish test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | sub Postfix_Test() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Postfix_Test: not called CC=27 SCAR=66.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | my $array = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | my $call = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | my @opts = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my @rc; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | my $is_code = (ref($call) eq "CODE"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | ## scan and test the rules | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 0 | ▶ | for (my $ix=0; $ix < @{$array}; $ix++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | my $rule = $array->[$ix]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | ## make 'or' operator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | if ($rule eq "|") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 8 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my $rc1 = pop(@rc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | my $rc2 = pop(@rc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | push(@rc,($rc1 | $rc2)+0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | ## make 'and' operator | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | elsif ($rule eq "&") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my $rc1 = pop(@rc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my $rc2 = pop(@rc); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | push(@rc,($rc1 & $rc2)+0); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | ## parsing format val1 [operand] val2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ▶ | elsif (($rule =~ /^(.*)\s+=\s+(.*)$/) || ($rule =~ /^(.*)\s+==\s+(.*)$/) || ($rule =~ /^(.*)\s+eq\s+(.*)$/i)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$rule =~ /^(.*)\s+=\s+(.*)$/ or $rule =~ /^(.*)\s+==\s+(.*)$/ or $rule =~ /^(.*)\s+eq\s+(.*)$/i
$rule =~ /^(.*)\s+=\s+(.*)$/ or $rule =~ /^(.*)\s+==\s+(.*)$/
MC/DC0%0/3
$rule =~ /^(.*)\s+=\s+(.*)$/ or $rule =~ /^(.*)\s+==\s+(.*)$/ or $rule =~ /^(.*)\s+eq\s+(.*)$/i
$rule =~ /^(.*)\s+=\s+(.*)$/
$rule =~ /^(.*)\s+==\s+(.*)$/
$rule =~ /^(.*)\s+eq\s+(.*)$/i
Truth table0%0/4
A or B or C
A= $rule =~ /^(.*)\s+=\s+(.*)$/B= $rule =~ /^(.*)\s+==\s+(.*)$/C= $rule =~ /^(.*)\s+eq\s+(.*)$/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | ($is_code) ? push(@rc,&{$call}($rule,"eq",$1,$2,@opts)+0) : push(@rc,($1 == $2)+0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ▶ | elsif (($rule =~ /^(.*)\s+!=\s+(.*)$/) || ($rule =~ /^(.*)\s+<>\s+(.*)$/) ||( $rule =~ /^(.*)\s+ne\s+(.*)$/i)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$rule =~ /^(.*)\s+!=\s+(.*)$/ or $rule =~ /^(.*)\s+<>\s+(.*)$/ or $rule =~ /^(.*)\s+ne\s+(.*)$/i
$rule =~ /^(.*)\s+!=\s+(.*)$/ or $rule =~ /^(.*)\s+<>\s+(.*)$/
MC/DC0%0/3
$rule =~ /^(.*)\s+!=\s+(.*)$/ or $rule =~ /^(.*)\s+<>\s+(.*)$/ or $rule =~ /^(.*)\s+ne\s+(.*)$/i
$rule =~ /^(.*)\s+!=\s+(.*)$/
$rule =~ /^(.*)\s+<>\s+(.*)$/
$rule =~ /^(.*)\s+ne\s+(.*)$/i
Truth table0%0/4
A or B or C
A= $rule =~ /^(.*)\s+!=\s+(.*)$/B= $rule =~ /^(.*)\s+<>\s+(.*)$/C= $rule =~ /^(.*)\s+ne\s+(.*)$/i
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | ($is_code) ? push(@rc,&{$call}($rule,"ne",$1,$2,@opts)+0) : push(@rc,($1 != $2)+0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | ▶ | elsif (($rule =~ /^(.*)\s+>\s+(.*)$/) || ($rule =~ /^(.*)\s+gt\s+(.*)$/)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$rule =~ /^(.*)\s+>\s+(.*)$/ or $rule =~ /^(.*)\s+gt\s+(.*)$/
MC/DC0%0/2
$rule =~ /^(.*)\s+>\s+(.*)$/ or $rule =~ /^(.*)\s+gt\s+(.*)$/
$rule =~ /^(.*)\s+>\s+(.*)$/
$rule =~ /^(.*)\s+gt\s+(.*)$/
Truth table0%0/3
A or B
A= $rule =~ /^(.*)\s+>\s+(.*)$/B= $rule =~ /^(.*)\s+gt\s+(.*)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | ▶ | ($is_code) ? push(@rc,&{$call}($rule,"gt",$1,$2,@opts)+0) : push(@rc,($1 > $2)+0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | ▶ | elsif (($rule =~ /^(.*)\s+<\s+(.*)$/) || ($rule =~ /^(.*)\s+lt\s+(.*)$/)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$rule =~ /^(.*)\s+<\s+(.*)$/ or $rule =~ /^(.*)\s+lt\s+(.*)$/
MC/DC0%0/2
$rule =~ /^(.*)\s+<\s+(.*)$/ or $rule =~ /^(.*)\s+lt\s+(.*)$/
$rule =~ /^(.*)\s+<\s+(.*)$/
$rule =~ /^(.*)\s+lt\s+(.*)$/
Truth table0%0/3
A or B
A= $rule =~ /^(.*)\s+<\s+(.*)$/B= $rule =~ /^(.*)\s+lt\s+(.*)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | ($is_code) ? push(@rc,&{$call}($rule,"lt",$1,$2,@opts)+0) : push(@rc,($1 < $2)+0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | ▶ | elsif (($rule =~ /^(.*)\s+>=\s+(.*)$/) || ($rule =~ /^(.*)\s+ge\s+(.*)$/)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$rule =~ /^(.*)\s+>=\s+(.*)$/ or $rule =~ /^(.*)\s+ge\s+(.*)$/
MC/DC0%0/2
$rule =~ /^(.*)\s+>=\s+(.*)$/ or $rule =~ /^(.*)\s+ge\s+(.*)$/
$rule =~ /^(.*)\s+>=\s+(.*)$/
$rule =~ /^(.*)\s+ge\s+(.*)$/
Truth table0%0/3
A or B
A= $rule =~ /^(.*)\s+>=\s+(.*)$/B= $rule =~ /^(.*)\s+ge\s+(.*)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | ($is_code) ? push(@rc,&{$call}($rule,"ge",$1,$2,@opts)+0) : push(@rc,($1 >= $2)+0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ▶ | elsif (($rule =~ /^(.*)\s+<=\s+(.*)$/) || ($rule =~ /^(.*)\s+le\s+(.*)$/)) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$rule =~ /^(.*)\s+<=\s+(.*)$/ or $rule =~ /^(.*)\s+le\s+(.*)$/
MC/DC0%0/2
$rule =~ /^(.*)\s+<=\s+(.*)$/ or $rule =~ /^(.*)\s+le\s+(.*)$/
$rule =~ /^(.*)\s+<=\s+(.*)$/
$rule =~ /^(.*)\s+le\s+(.*)$/
Truth table0%0/3
A or B
A= $rule =~ /^(.*)\s+<=\s+(.*)$/B= $rule =~ /^(.*)\s+le\s+(.*)$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | ($is_code) ? push(@rc,&{$call}($rule,"le",$1,$2,@opts)+0) : push(@rc,($1 <= $2)+0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | ## use nom parsed format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | ($is_code) ? push(@rc,&{$call}($rule,"*",0,0,@opts)+0) : push(@rc,1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | foreach my $rc(@rc) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | next if ($rc); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ############################################################################### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | # convert polish to text format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | sub Postfix_to_Infix() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Postfix_to_Infix: called CC=6 SCAR=18.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 10 | my $array = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 10 | my @temp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 10 | ▶ | for (my $ix=0; $ix < @{$array}; $ix++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 42 | my $rule = $array->[$ix]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 42 | ▶ | if ($rule eq "|") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 7 | my $st2 = pop(@temp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 7 | my $st1 = pop(@temp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 7 | ▶ | ($ix+1 >= @{$array}) ? push(@temp,$st1." or ".$st2) : push(@temp,"(".$st1." or ".$st2.")"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | elsif ($rule eq "&") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 9 | my $st2 = pop(@temp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 9 | my $st1 = pop(@temp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 9 | push(@temp,$st1." and ".$st2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 26 | push(@temp,$rule); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 10 | ▶ | for (my $ix=1; $ix<@temp; $ix++) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | my $st2 = pop(@temp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | my $st1 = pop(@temp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | push(@temp,$st1." and ".$st2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 10 | return $Math::Notation::PostfixInfix{unpolish} = join(" ",@temp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | # convert text to polish format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | sub Infix_to_Postfix | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
Infix_to_Postfix: called CC=5 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 10 | my $txt = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 10 | @{$Math::Notation::PostfixInfix{polish}} = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 10 | @{$Math::Notation::PostfixInfix{operand}{0}} = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 10 | $Math::Notation::PostfixInfix{square} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 10 | ▶ | if (($txt =~ /^(and|or|\&\&|\|\|)/) || ($txt =~ /^\s+(and|or|\&\&|\|\|)/) || ($txt =~ /(and|or|\&\&|\|\|)$/) || ($txt =~ /(and|or|\&\&|\|\|)\s+$/)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$txt =~ /^(and|or|\&\&|\|\|)/ or $txt =~ /^\s+(and|or|\&\&|\|\|)/ or $txt =~ /(and|or|\&\&|\|\|)$/ or $txt =~ /(and|or|\&\&|\|\|)\s+$/
$txt =~ /^(and|or|\&\&|\|\|)/ or $txt =~ /^\s+(and|or|\&\&|\|\|)/ or $txt =~ /(and|or|\&\&|\|\|)$/
$txt =~ /^(and|or|\&\&|\|\|)/ or $txt =~ /^\s+(and|or|\&\&|\|\|)/
MC/DC0%0/4
$txt =~ /^(and|or|\&\&|\|\|)/ or $txt =~ /^\s+(and|or|\&\&|\|\|)/ or $txt =~ /(and|or|\&\&|\|\|)$/ or $txt =~ /(and|or|\&\&|\|\|)\s+$/
$txt =~ /^(and|or|\&\&|\|\|)/
$txt =~ /^\s+(and|or|\&\&|\|\|)/
$txt =~ /(and|or|\&\&|\|\|)$/
$txt =~ /(and|or|\&\&|\|\|)\s+$/
Truth table20%1/5
A or B or C or D
A= $txt =~ /^(and|or|\&\&|\|\|)/B= $txt =~ /^\s+(and|or|\&\&|\|\|)/C= $txt =~ /(and|or|\&\&|\|\|)$/D= $txt =~ /(and|or|\&\&|\|\|)\s+$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $! = "and/or at begin/end detected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 10 | else {Math::Notation::PostfixInfix->_Parse($txt);} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 10 | return @{$Math::Notation::PostfixInfix{polish}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | sub _Parse() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 10 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_Parse: called CC=14 SCAR=27.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 10 | my $txt = shift; $txt =~ s/^\s+|\s+$//g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 10 | $Math::Notation::PostfixInfix{text} = \$txt; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 10 | my $tmp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 10 | ▶ | while ($txt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 48 | ▶ | if ($txt =~ /^\((.*)/) {Math::Notation::PostfixInfix->_ParseSquareNew(); $txt=$1;} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 1 | elsif ($txt =~ /^\)(.*)/) {Math::Notation::PostfixInfix->_ParseSquareEnd(); $txt=$1;} | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 46 | my ($a1,$b1) = ($txt =~ /^(.*?)\s+(.*)$/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 46 | my ($a2,$b2,$c2) = ($txt =~ /^(.*?)(\(\))(.*)$/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | if ($a1 && $a2) { ($tmp,$txt) = (length($a1) < length($a2)) ? ($a1,$b1) : ($a2,"(".$b2.")".$c2); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition66%2/3
$a1 and $a2
MC/DC0%0/2
$a1 and $a2
$a1
$a2
Truth table66%2/3
A and B
A= $a1B= $a2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | elsif ($b2) { ($tmp,$txt) = ($a2,"(".$b2.")".$c2); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 36 | elsif ($b1) { ($tmp,$txt) = ($a1,$b1); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 10 | else { ($tmp,$txt) = ($txt,""); } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 46 | ▶ | ($tmp,$txt) = ($1,")".$txt) if ($tmp =~ /(.*)\)$/); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 46 | ▶ | if ($tmp =~ /(^and|^or|^\&\&|^\|\|)/) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 16 | Math::Notation::PostfixInfix->_ParseOperator($tmp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 30 | Math::Notation::PostfixInfix->_ParseOperand($tmp); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 10 | ▶ | if ($Math::Notation::PostfixInfix{square} > 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | print STDERR "Square mismatch, too many open ($Math::Notation::PostfixInfix{square})\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | exit(-1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 10 | ▶ | while ($Math::Notation::PostfixInfix{square} > -1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 10 | ▶ | while (@{$Math::Notation::PostfixInfix{operand}{$Math::Notation::PostfixInfix{square}}}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 12 | $Math::Notation::PostfixInfix{last} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 12 | Math::Notation::PostfixInfix->_ParseOperand(pop(@{$Math::Notation::PostfixInfix{operand}{$Math::Notation::PostfixInfix{square}}})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 10 | $Math::Notation::PostfixInfix{square}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | sub _ParseOperator() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ParseOperator: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 16 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 16 | my $oper = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 16 | ▶ | if ($oper =~ /^and$/i) { $oper = "&"; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 1 | elsif ($oper =~ /^\&\&$/i) { $oper = "&"; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 6 | elsif ($oper =~ /^or$/i) { $oper = "|"; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 1 | elsif ($oper =~ /^\|\|$/i) { $oper = "|"; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 16 | my $no = @{$Math::Notation::PostfixInfix{operand}{$Math::Notation::PostfixInfix{square}}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 16 | ▶ | if ($no && $Math::Notation::PostfixInfix{operand}{$Math::Notation::PostfixInfix{square}}->[$no-1] eq "&") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$no and $Math::Notation::PostfixInfix{"operand"}{$Math::Notation::PostfixInfix{"square"}}[$no - 1] eq "&"
MC/DC100%2/2
$no and $Math::Notation::PostfixInfix{"operand"}{$Math::Notation::PostfixInfix{"square"}}[$no - 1] eq "&"
$no
$Math::Notation::PostfixInfix{"operand"}{$Math::Notation::PostfixInfix{"square"}}[$no - 1] eq "&"
Truth table100%3/3
A and B
A= $noB= $Math::Notation::PostfixInfix{"operand"}{$Math::Notation::PostfixInfix{"square"}}[$no - 1] eq "&"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 3 | $Math::Notation::PostfixInfix{last} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 3 | Math::Notation::PostfixInfix->_ParseOperand(pop(@{$Math::Notation::PostfixInfix{operand}{$Math::Notation::PostfixInfix{square}}})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 16 | push(@{$Math::Notation::PostfixInfix{operand}{$Math::Notation::PostfixInfix{square}}},$oper); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | 16 | $Math::Notation::PostfixInfix{last} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | sub _ParseOperand() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 46 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ParseOperand: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 46 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | 46 | my $info = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 46 | ▶ | if ($Math::Notation::PostfixInfix{last} || @{$Math::Notation::PostfixInfix{polish}} == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$Math::Notation::PostfixInfix{"last"} or @{$Math::Notation::PostfixInfix{"polish"};} == 0
MC/DC100%2/2
$Math::Notation::PostfixInfix{"last"} or @{$Math::Notation::PostfixInfix{"polish"};} == 0
$Math::Notation::PostfixInfix{"last"}
@{$Math::Notation::PostfixInfix{"polish"};} == 0
Truth table100%3/3
A or B
A= $Math::Notation::PostfixInfix{"last"}B= @{$Math::Notation::PostfixInfix{"polish"};} == 0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | 42 | push(@{$Math::Notation::PostfixInfix{polish}},$info); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 42 | $Math::Notation::PostfixInfix{last} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 4 | else { $Math::Notation::PostfixInfix{polish}->[@{$Math::Notation::PostfixInfix{polish}}-1] .= " ".$info; } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | sub _ParseSquareNew() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ParseSquareNew: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 1 | $Math::Notation::PostfixInfix{square}++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 1 | @{$Math::Notation::PostfixInfix{operand}{$Math::Notation::PostfixInfix{square}}} = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | ############################################################################## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | sub _ParseSquareEnd() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 1 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_ParseSquareEnd: called CC=2 SCAR=7.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 1 | $Math::Notation::PostfixInfix{last} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 1 | Math::Notation::PostfixInfix->_ParseOperand(pop(@{$Math::Notation::PostfixInfix{operand}{$Math::Notation::PostfixInfix{square}}})); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 1 | $Math::Notation::PostfixInfix{square}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 1 | ▶ | if ($Math::Notation::PostfixInfix{square} < 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | print STDERR "Square mismatch, too many close\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | exit(-1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||