| 1 | package TSQL::AST::Factory; | ||||||||||||||||||||
| 2 | 4 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | |||||||||||||||||||||
| 4 | 4 | ▶ | use feature "switch"; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 4 | ▶ | use 5.014; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 4 | ▶ | use TSQL::AST::Token::Begin; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 4 | ▶ | use TSQL::AST::Token::BeginCatch; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 4 | ▶ | use TSQL::AST::Token::BeginTry; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 4 | ▶ | use TSQL::AST::Token::Else; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 4 | ▶ | use TSQL::AST::Token::End; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 4 | ▶ | use TSQL::AST::Token::EndCatch; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 4 | ▶ | use TSQL::AST::Token::EndTry; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | 4 | ▶ | use TSQL::AST::Token::GO; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | 4 | ▶ | use TSQL::AST::Token::If; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 4 | ▶ | use TSQL::AST::Token::While; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 4 | ▶ | use TSQL::AST::SQLFragment; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | 4 | ▶ | use TSQL::AST::SQLConditionalExpression; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | 4 | ▶ | use TSQL::AST::SQLIfStatement; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | 4 | ▶ | use TSQL::AST::SQLTryCatchBlock; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | 4 | ▶ | use TSQL::AST::SQLWhileStatement; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 23 | 4 | ▶ | use TSQL::AST::SQLStatement; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 4 | ▶ | use TSQL::AST::Token::CreateOrAlterFunction; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 26 | 4 | ▶ | use TSQL::AST::Token::CreateOrAlterProcedure; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 27 | 4 | ▶ | use TSQL::AST::Token::CreateOrAlterTrigger; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 28 | 4 | ▶ | use TSQL::AST::Token::CreateOrAlterView; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 4 | ▶ | use TSQL::Common::Regexp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 4 | ▶ | use Data::Dumper; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 34 | 4 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | =head1 NAME | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | TSQL::AST::Factory - Builds various parsing objects. | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | =head1 VERSION | ||||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | Version 0.03 | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | =cut | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | |||||||||||||||||||||
| 47 | #our \$VERSION = '0.03'; | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 4 | ▶ | my $qr_begintoken //= TSQL::Common::Regexp->qr_begintoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_begintoken //= "TSQL::Common::Regexp"->qr_begintoken
MC/DC0%0/2
my $qr_begintoken //= "TSQL::Common::Regexp"->qr_begintoken
my $qr_begintoken
"TSQL::Common::Regexp"->qr_begintoken
Truth table33%1/3
A //= B
A= my $qr_begintokenB= "TSQL::Common::Regexp"->qr_begintoken
| |||||||||||||||||||||
| 50 | 4 | ▶ | my $qr_endtoken //= TSQL::Common::Regexp->qr_endtoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_endtoken //= "TSQL::Common::Regexp"->qr_endtoken
MC/DC0%0/2
my $qr_endtoken //= "TSQL::Common::Regexp"->qr_endtoken
my $qr_endtoken
"TSQL::Common::Regexp"->qr_endtoken
Truth table33%1/3
A //= B
A= my $qr_endtokenB= "TSQL::Common::Regexp"->qr_endtoken
| |||||||||||||||||||||
| 51 | 4 | ▶ | my $qr_begintrytoken //= TSQL::Common::Regexp->qr_begintrytoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_begintrytoken //= "TSQL::Common::Regexp"->qr_begintrytoken
MC/DC0%0/2
my $qr_begintrytoken //= "TSQL::Common::Regexp"->qr_begintrytoken
my $qr_begintrytoken
"TSQL::Common::Regexp"->qr_begintrytoken
Truth table33%1/3
A //= B
A= my $qr_begintrytokenB= "TSQL::Common::Regexp"->qr_begintrytoken
| |||||||||||||||||||||
| 52 | 4 | ▶ | my $qr_endtrytoken //= TSQL::Common::Regexp->qr_endtrytoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_endtrytoken //= "TSQL::Common::Regexp"->qr_endtrytoken
MC/DC0%0/2
my $qr_endtrytoken //= "TSQL::Common::Regexp"->qr_endtrytoken
my $qr_endtrytoken
"TSQL::Common::Regexp"->qr_endtrytoken
Truth table33%1/3
A //= B
A= my $qr_endtrytokenB= "TSQL::Common::Regexp"->qr_endtrytoken
| |||||||||||||||||||||
| 53 | 4 | ▶ | my $qr_begincatchtoken //= TSQL::Common::Regexp->qr_begincatchtoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_begincatchtoken //= "TSQL::Common::Regexp"->qr_begincatchtoken
MC/DC0%0/2
my $qr_begincatchtoken //= "TSQL::Common::Regexp"->qr_begincatchtoken
my $qr_begincatchtoken
"TSQL::Common::Regexp"->qr_begincatchtoken
Truth table33%1/3
A //= B
A= my $qr_begincatchtokenB= "TSQL::Common::Regexp"->qr_begincatchtoken
| |||||||||||||||||||||
| 54 | 4 | ▶ | my $qr_endcatchtoken //= TSQL::Common::Regexp->qr_endcatchtoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_endcatchtoken //= "TSQL::Common::Regexp"->qr_endcatchtoken
MC/DC0%0/2
my $qr_endcatchtoken //= "TSQL::Common::Regexp"->qr_endcatchtoken
my $qr_endcatchtoken
"TSQL::Common::Regexp"->qr_endcatchtoken
Truth table33%1/3
A //= B
A= my $qr_endcatchtokenB= "TSQL::Common::Regexp"->qr_endcatchtoken
| |||||||||||||||||||||
| 55 | 4 | ▶ | my $qr_iftoken //= TSQL::Common::Regexp->qr_iftoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_iftoken //= "TSQL::Common::Regexp"->qr_iftoken
MC/DC0%0/2
my $qr_iftoken //= "TSQL::Common::Regexp"->qr_iftoken
my $qr_iftoken
"TSQL::Common::Regexp"->qr_iftoken
Truth table33%1/3
A //= B
A= my $qr_iftokenB= "TSQL::Common::Regexp"->qr_iftoken
| |||||||||||||||||||||
| 56 | 4 | ▶ | my $qr_elsetoken //= TSQL::Common::Regexp->qr_elsetoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_elsetoken //= "TSQL::Common::Regexp"->qr_elsetoken
MC/DC0%0/2
my $qr_elsetoken //= "TSQL::Common::Regexp"->qr_elsetoken
my $qr_elsetoken
"TSQL::Common::Regexp"->qr_elsetoken
Truth table33%1/3
A //= B
A= my $qr_elsetokenB= "TSQL::Common::Regexp"->qr_elsetoken
| |||||||||||||||||||||
| 57 | 4 | ▶ | my $qr_whiletoken //= TSQL::Common::Regexp->qr_whiletoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_whiletoken //= "TSQL::Common::Regexp"->qr_whiletoken
MC/DC0%0/2
my $qr_whiletoken //= "TSQL::Common::Regexp"->qr_whiletoken
my $qr_whiletoken
"TSQL::Common::Regexp"->qr_whiletoken
Truth table33%1/3
A //= B
A= my $qr_whiletokenB= "TSQL::Common::Regexp"->qr_whiletoken
| |||||||||||||||||||||
| 58 | 4 | ▶ | my $qr_GOtoken //= TSQL::Common::Regexp->qr_GOtoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_GOtoken //= "TSQL::Common::Regexp"->qr_GOtoken
MC/DC0%0/2
my $qr_GOtoken //= "TSQL::Common::Regexp"->qr_GOtoken
my $qr_GOtoken
"TSQL::Common::Regexp"->qr_GOtoken
Truth table33%1/3
A //= B
A= my $qr_GOtokenB= "TSQL::Common::Regexp"->qr_GOtoken
| |||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 4 | ▶ | my $qr_createproceduretoken //= TSQL::Common::Regexp->qr_createproceduretoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_createproceduretoken //= "TSQL::Common::Regexp"->qr_createproceduretoken
MC/DC0%0/2
my $qr_createproceduretoken //= "TSQL::Common::Regexp"->qr_createproceduretoken
my $qr_createproceduretoken
"TSQL::Common::Regexp"->qr_createproceduretoken
Truth table33%1/3
A //= B
A= my $qr_createproceduretokenB= "TSQL::Common::Regexp"->qr_createproceduretoken
| |||||||||||||||||||||
| 62 | 4 | ▶ | my $qr_alterproceduretoken //= TSQL::Common::Regexp->qr_alterproceduretoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_alterproceduretoken //= "TSQL::Common::Regexp"->qr_alterproceduretoken
MC/DC0%0/2
my $qr_alterproceduretoken //= "TSQL::Common::Regexp"->qr_alterproceduretoken
my $qr_alterproceduretoken
"TSQL::Common::Regexp"->qr_alterproceduretoken
Truth table33%1/3
A //= B
A= my $qr_alterproceduretokenB= "TSQL::Common::Regexp"->qr_alterproceduretoken
| |||||||||||||||||||||
| 63 | 4 | ▶ | my $qr_createtriggertoken //= TSQL::Common::Regexp->qr_createtriggertoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_createtriggertoken //= "TSQL::Common::Regexp"->qr_createtriggertoken
MC/DC0%0/2
my $qr_createtriggertoken //= "TSQL::Common::Regexp"->qr_createtriggertoken
my $qr_createtriggertoken
"TSQL::Common::Regexp"->qr_createtriggertoken
Truth table33%1/3
A //= B
A= my $qr_createtriggertokenB= "TSQL::Common::Regexp"->qr_createtriggertoken
| |||||||||||||||||||||
| 64 | 4 | ▶ | my $qr_altertriggertoken //= TSQL::Common::Regexp->qr_altertriggertoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_altertriggertoken //= "TSQL::Common::Regexp"->qr_altertriggertoken
MC/DC0%0/2
my $qr_altertriggertoken //= "TSQL::Common::Regexp"->qr_altertriggertoken
my $qr_altertriggertoken
"TSQL::Common::Regexp"->qr_altertriggertoken
Truth table33%1/3
A //= B
A= my $qr_altertriggertokenB= "TSQL::Common::Regexp"->qr_altertriggertoken
| |||||||||||||||||||||
| 65 | 4 | ▶ | my $qr_createviewtoken //= TSQL::Common::Regexp->qr_createviewtoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_createviewtoken //= "TSQL::Common::Regexp"->qr_createviewtoken
MC/DC0%0/2
my $qr_createviewtoken //= "TSQL::Common::Regexp"->qr_createviewtoken
my $qr_createviewtoken
"TSQL::Common::Regexp"->qr_createviewtoken
Truth table33%1/3
A //= B
A= my $qr_createviewtokenB= "TSQL::Common::Regexp"->qr_createviewtoken
| |||||||||||||||||||||
| 66 | 4 | ▶ | my $qr_alterviewtoken //= TSQL::Common::Regexp->qr_alterviewtoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_alterviewtoken //= "TSQL::Common::Regexp"->qr_alterviewtoken
MC/DC0%0/2
my $qr_alterviewtoken //= "TSQL::Common::Regexp"->qr_alterviewtoken
my $qr_alterviewtoken
"TSQL::Common::Regexp"->qr_alterviewtoken
Truth table33%1/3
A //= B
A= my $qr_alterviewtokenB= "TSQL::Common::Regexp"->qr_alterviewtoken
| |||||||||||||||||||||
| 67 | 4 | ▶ | my $qr_createfunctiontoken //= TSQL::Common::Regexp->qr_createfunctiontoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_createfunctiontoken //= "TSQL::Common::Regexp"->qr_createfunctiontoken
MC/DC0%0/2
my $qr_createfunctiontoken //= "TSQL::Common::Regexp"->qr_createfunctiontoken
my $qr_createfunctiontoken
"TSQL::Common::Regexp"->qr_createfunctiontoken
Truth table33%1/3
A //= B
A= my $qr_createfunctiontokenB= "TSQL::Common::Regexp"->qr_createfunctiontoken
| |||||||||||||||||||||
| 68 | 4 | ▶ | my $qr_alterfunctiontoken //= TSQL::Common::Regexp->qr_alterfunctiontoken(); | ||||||||||||||||||
|
Condition33%1/3
my $qr_alterfunctiontoken //= "TSQL::Common::Regexp"->qr_alterfunctiontoken
MC/DC0%0/2
my $qr_alterfunctiontoken //= "TSQL::Common::Regexp"->qr_alterfunctiontoken
my $qr_alterfunctiontoken
"TSQL::Common::Regexp"->qr_alterfunctiontoken
Truth table33%1/3
A //= B
A= my $qr_alterfunctiontokenB= "TSQL::Common::Regexp"->qr_alterfunctiontoken
| |||||||||||||||||||||
| 69 | |||||||||||||||||||||
| 70 | 210 | ▶ | sub makeToken { | ||||||||||||||||||
|
Subroutine
makeToken: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 210 | local $_ = undef ; | |||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | 210 | my $invocant = shift ; | |||||||||||||||||||
| 75 | 210 | ▶ | my $class = ref($invocant) || $invocant ; | ||||||||||||||||||
|
Condition33%1/3
ref $invocant || $invocant
MC/DC0%0/2
ref $invocant || $invocant
ref $invocant
$invocant
Truth table33%1/3
A || B
A= ref $invocantB= $invocant
| |||||||||||||||||||||
| 76 | |||||||||||||||||||||
| 77 | 210 | my $input = shift ; | |||||||||||||||||||
| 78 | 210 | ▶ | carp "Missing token input" if ! defined $input; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | 210 | my $o ; | |||||||||||||||||||
| 81 | |||||||||||||||||||||
| 82 | 210 | given ($input) { | |||||||||||||||||||
| 83 | |||||||||||||||||||||
| 84 | when ( m{$qr_begintoken}ix ) | ||||||||||||||||||||
| 85 | 210 | { $o = TSQL::AST::Token::Begin->new( tokenString => $input ) ; } | |||||||||||||||||||
| 86 | |||||||||||||||||||||
| 87 | when ( m{$qr_endtoken}ix ) | ||||||||||||||||||||
| 88 | 185 | { $o = TSQL::AST::Token::End->new( tokenString => $input ) ; } | |||||||||||||||||||
| 89 | |||||||||||||||||||||
| 90 | when ( m{$qr_begintrytoken}ix ) | ||||||||||||||||||||
| 91 | 160 | { $o = TSQL::AST::Token::BeginTry->new( tokenString => $input ) ; } | |||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | when ( m{$qr_endtrytoken}ix ) | ||||||||||||||||||||
| 94 | 146 | { $o = TSQL::AST::Token::EndTry->new( tokenString => $input ) ; } | |||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | when ( m{$qr_begincatchtoken}ix ) | ||||||||||||||||||||
| 97 | 132 | { $o = TSQL::AST::Token::BeginCatch->new( tokenString => $input ) ; } | |||||||||||||||||||
| 98 | |||||||||||||||||||||
| 99 | when ( m{$qr_endcatchtoken}ix ) | ||||||||||||||||||||
| 100 | 118 | { $o = TSQL::AST::Token::EndCatch->new( tokenString => $input ) ; } | |||||||||||||||||||
| 101 | |||||||||||||||||||||
| 102 | when ( m{$qr_elsetoken}ix ) | ||||||||||||||||||||
| 103 | 104 | { $o = TSQL::AST::Token::Else->new( tokenString => $input ) ; } | |||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | when ( m{$qr_iftoken}ix ) | ||||||||||||||||||||
| 106 | 97 | { $o = TSQL::AST::Token::If->new( tokenString => $input ) ; } | |||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | when ( m{$qr_GOtoken}ix ) | ||||||||||||||||||||
| 109 | 87 | { $o = TSQL::AST::Token::GO->new( tokenString => $input ) ; } | |||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | when ( m{$qr_whiletoken}ix ) | ||||||||||||||||||||
| 112 | 77 | { $o = TSQL::AST::Token::While->new( tokenString => $input ) ; } | |||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | when ( m{$qr_createproceduretoken}ix ) | ||||||||||||||||||||
| 116 | 0 | { $o = TSQL::AST::Token::CreateOrAlterProcedure->new( tokenString => $input ) ; } | |||||||||||||||||||
| 117 | |||||||||||||||||||||
| 118 | when ( m{$qr_alterproceduretoken}ix ) | ||||||||||||||||||||
| 119 | 0 | { $o = TSQL::AST::Token::CreateOrAlterProcedure->new( tokenString => $input ) ; } | |||||||||||||||||||
| 120 | |||||||||||||||||||||
| 121 | when ( m{$qr_createtriggertoken}ix ) | ||||||||||||||||||||
| 122 | 0 | { $o = TSQL::AST::Token::CreateOrAlterTrigger->new( tokenString => $input ) ; } | |||||||||||||||||||
| 123 | |||||||||||||||||||||
| 124 | when ( m{$qr_altertriggertoken}ix ) | ||||||||||||||||||||
| 125 | 0 | { $o = TSQL::AST::Token::CreateOrAlterTrigger->new( tokenString => $input ) ; } | |||||||||||||||||||
| 126 | |||||||||||||||||||||
| 127 | when ( m{$qr_createviewtoken}ix ) | ||||||||||||||||||||
| 128 | 0 | { $o = TSQL::AST::Token::CreateOrAlterView->new( tokenString => $input ) ; } | |||||||||||||||||||
| 129 | |||||||||||||||||||||
| 130 | when ( m{$qr_alterviewtoken}ix ) | ||||||||||||||||||||
| 131 | 0 | { $o = TSQL::AST::Token::CreateOrAlterView->new( tokenString => $input ) ; } | |||||||||||||||||||
| 132 | |||||||||||||||||||||
| 133 | when ( m{$qr_createfunctiontoken}ix ) | ||||||||||||||||||||
| 134 | 0 | { $o = TSQL::AST::Token::CreateOrAlterFunction->new( tokenString => $input ) ; } | |||||||||||||||||||
| 135 | |||||||||||||||||||||
| 136 | when ( m{$qr_alterfunctiontoken}ix ) | ||||||||||||||||||||
| 137 | 0 | { $o = TSQL::AST::Token::CreateOrAlterFunction->new( tokenString => $input ) ; } | |||||||||||||||||||
| 138 | |||||||||||||||||||||
| 139 | } | ||||||||||||||||||||
| 140 | |||||||||||||||||||||
| 141 | 210 | return $o; | |||||||||||||||||||
| 142 | } | ||||||||||||||||||||
| 143 | |||||||||||||||||||||
| 144 | 63 | ▶ | sub makeStatement { | ||||||||||||||||||
|
Subroutine
makeStatement: called CC=3 SCAR=11.5
Pod
undocumented
| |||||||||||||||||||||
| 145 | |||||||||||||||||||||
| 146 | 63 | local $_ = undef ; | |||||||||||||||||||
| 147 | |||||||||||||||||||||
| 148 | 63 | my $invocant = shift ; | |||||||||||||||||||
| 149 | 63 | ▶ | my $class = ref($invocant) || $invocant ; | ||||||||||||||||||
|
Condition33%1/3
ref $invocant || $invocant
MC/DC0%0/2
ref $invocant || $invocant
ref $invocant
$invocant
Truth table33%1/3
A || B
A= ref $invocantB= $invocant
| |||||||||||||||||||||
| 150 | |||||||||||||||||||||
| 151 | 63 | my $input = shift ; | |||||||||||||||||||
| 152 | 63 | ▶ | carp "Missing statement input" if ! defined $input; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 153 | |||||||||||||||||||||
| 154 | 63 | my $o ; | |||||||||||||||||||
| 155 | |||||||||||||||||||||
| 156 | 63 | given ($input) { | |||||||||||||||||||
| 157 | # when ( m{\A \s* (?:\b if \b) \s* }xi ) | ||||||||||||||||||||
| 158 | # { $o = TSQL::AST::SQLIfStatement->new( tokenString => $input ) ; } | ||||||||||||||||||||
| 159 | # when ( m{\A \s* (?:\b begin \b \s* \b try \b ) \s* \z }xi ) | ||||||||||||||||||||
| 160 | # { $o = TSQL::AST::SQLTryCatchBlock->new( tokenString => $input ) ; | ||||||||||||||||||||
| 161 | # } | ||||||||||||||||||||
| 162 | # when ( m{\A \s* (?:\b while \b)}xi ) | ||||||||||||||||||||
| 163 | # { $o = TSQL::AST::SQLWhileStatement->new( tokenString => $input ) ; } | ||||||||||||||||||||
| 164 | 63 | default { $o = TSQL::AST::SQLStatement->new( tokenString => $input ) ; | |||||||||||||||||||
| 165 | } | ||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | 0 | return $o; | |||||||||||||||||||
| 168 | } | ||||||||||||||||||||
| 169 | } | ||||||||||||||||||||
| 170 | |||||||||||||||||||||
| 171 | 10 | ▶ | sub makeIfStatement { | ||||||||||||||||||
|
Subroutine
makeIfStatement: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||
| 172 | |||||||||||||||||||||
| 173 | 10 | local $_ = undef ; | |||||||||||||||||||
| 174 | |||||||||||||||||||||
| 175 | 10 | my $invocant = shift ; | |||||||||||||||||||
| 176 | 10 | ▶ | my $class = ref($invocant) || $invocant ; | ||||||||||||||||||
|
Condition33%1/3
ref $invocant || $invocant
MC/DC0%0/2
ref $invocant || $invocant
ref $invocant
$invocant
Truth table33%1/3
A || B
A= ref $invocantB= $invocant
| |||||||||||||||||||||
| 177 | |||||||||||||||||||||
| 178 | 10 | my $condition = shift ; | |||||||||||||||||||
| 179 | 10 | ▶ | carp "Missing statement input" if ! defined $condition; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 180 | |||||||||||||||||||||
| 181 | 10 | $condition =~ s{$qr_iftoken}{}xmis; | |||||||||||||||||||
| 182 | 10 | my $fr = TSQL::AST::SQLFragment->new( tokenString => $condition ) ; | |||||||||||||||||||
| 183 | 10 | my $co = TSQL::AST::SQLConditionalExpression->new( expression => $fr ) ; | |||||||||||||||||||
| 184 | 10 | return TSQL::AST::SQLIfStatement->new( condition => $co ) ; | |||||||||||||||||||
| 185 | |||||||||||||||||||||
| 186 | } | ||||||||||||||||||||
| 187 | |||||||||||||||||||||
| 188 | 12 | ▶ | sub makeWhileStatement { | ||||||||||||||||||
|
Subroutine
makeWhileStatement: called CC=3 SCAR=11.3
Pod
undocumented
| |||||||||||||||||||||
| 189 | |||||||||||||||||||||
| 190 | 12 | local $_ = undef ; | |||||||||||||||||||
| 191 | |||||||||||||||||||||
| 192 | 12 | my $invocant = shift ; | |||||||||||||||||||
| 193 | 12 | ▶ | my $class = ref($invocant) || $invocant ; | ||||||||||||||||||
|
Condition33%1/3
ref $invocant || $invocant
MC/DC0%0/2
ref $invocant || $invocant
ref $invocant
$invocant
Truth table33%1/3
A || B
A= ref $invocantB= $invocant
| |||||||||||||||||||||
| 194 | |||||||||||||||||||||
| 195 | 12 | my $condition = shift ; | |||||||||||||||||||
| 196 | 12 | ▶ | carp "Missing statement input" if ! defined $condition; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 197 | |||||||||||||||||||||
| 198 | 12 | $condition =~ s{$qr_whiletoken}{}xmis; | |||||||||||||||||||
| 199 | 12 | my $fr = TSQL::AST::SQLFragment->new( tokenString => $condition ) ; | |||||||||||||||||||
| 200 | 12 | my $co = TSQL::AST::SQLConditionalExpression->new( expression => $fr ) ; | |||||||||||||||||||
| 201 | 12 | return TSQL::AST::SQLWhileStatement->new( condition => $co ) ; | |||||||||||||||||||
| 202 | |||||||||||||||||||||
| 203 | } | ||||||||||||||||||||
| 204 | |||||||||||||||||||||
| 205 | 4 | 1; | |||||||||||||||||||
| 206 | |||||||||||||||||||||
| 207 | __DATA__ | ||||||||||||||||||||