line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!perl |
2
|
1
|
|
|
1
|
|
1295
|
use 5.008001; use utf8; use strict; use warnings; |
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
1
|
|
41
|
|
|
1
|
|
|
1
|
|
7
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
31
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
|
1
|
|
|
|
|
32
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
60
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
382
|
use only 'Locale::KeyedText' => '1.6.0-'; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use only 'Rosetta::Model' => '0.71.0-'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Rosetta::Utility::SQLParser; |
8
|
|
|
|
|
|
|
use version; our $VERSION = qv('0.3.0'); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
###################################################################### |
11
|
|
|
|
|
|
|
###################################################################### |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# These are constant values used by this module. |
14
|
|
|
|
|
|
|
my $EMPTY_STR = q{}; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
###################################################################### |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
19
|
|
|
|
|
|
|
my ($class) = @_; |
20
|
|
|
|
|
|
|
my $parser = bless {}, ref $class || $class; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
return $parser; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
###################################################################### |
28
|
|
|
|
|
|
|
# This is a 'protected' method; only sub-classes should invoke it. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _throw_error_message { |
31
|
|
|
|
|
|
|
my ($parser, $msg_key, $msg_vars) = @_; |
32
|
|
|
|
|
|
|
# Throws an exception consisting of an object. |
33
|
|
|
|
|
|
|
ref $msg_vars eq 'HASH' or $msg_vars = {}; |
34
|
|
|
|
|
|
|
for my $var_key (keys %{$msg_vars}) { |
35
|
|
|
|
|
|
|
if (ref $msg_vars->{$var_key} eq 'ARRAY') { |
36
|
|
|
|
|
|
|
$msg_vars->{$var_key} = 'PERL_ARRAY:[' . (join q{,},map {$_||$EMPTY_STR} @{$msg_vars->{$var_key}}) . ']'; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
die Locale::KeyedText->new_message( $msg_key, $msg_vars ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub _assert_arg_node_type { |
43
|
|
|
|
|
|
|
my ($parser, $meth_name, $arg_name, $exp_node_types, $arg_value) = @_; |
44
|
|
|
|
|
|
|
$parser->_throw_error_message( 'ROS_U_SP_METH_ARG_UNDEF', |
45
|
|
|
|
|
|
|
{ 'METH' => $meth_name, 'ARGNM' => $arg_name } ) |
46
|
|
|
|
|
|
|
if !defined $arg_value; |
47
|
|
|
|
|
|
|
$parser->_throw_error_message( 'ROS_U_SP_METH_ARG_NO_NODE', |
48
|
|
|
|
|
|
|
{ 'METH' => $meth_name, 'ARGNM' => $arg_name, 'ARGVL' => $arg_value } ) |
49
|
|
|
|
|
|
|
if !ref $arg_value or !UNIVERSAL::isa( $arg_value, 'Rosetta::Model::Node' ); |
50
|
|
|
|
|
|
|
return |
51
|
|
|
|
|
|
|
if @{$exp_node_types} == 0; # any Node type is acceptable |
52
|
|
|
|
|
|
|
my $given_node_type = $arg_value->get_node_type(); |
53
|
|
|
|
|
|
|
$parser->_throw_error_message( 'ROS_U_SP_METH_ARG_WRONG_NODE_TYPE', |
54
|
|
|
|
|
|
|
{ 'METH' => $meth_name, 'ARGNM' => $arg_name, |
55
|
|
|
|
|
|
|
'EXPNTYPE' => $exp_node_types, 'ARGNTYPE' => $given_node_type } ) |
56
|
|
|
|
|
|
|
if !grep { $given_node_type eq $_ } @{$exp_node_types}; |
57
|
|
|
|
|
|
|
# If we get here, $arg_value is acceptable to the method. |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
###################################################################### |
61
|
|
|
|
|
|
|
###################################################################### |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
__END__ |