File Coverage

blib/lib/MarpaX/Languages/PowerBuilder/SRJ.pm
Criterion Covered Total %
statement 57 61 93.4
branch 7 12 58.3
condition 2 4 50.0
subroutine 35 37 94.5
pod 0 36 0.0
total 101 150 67.3


line stmt bran cond sub pod time code
1             package MarpaX::Languages::PowerBuilder::SRJ;
2 2     2   1808 use base qw(MarpaX::Languages::PowerBuilder::base);
  2         4  
  2         1209  
3             #a SRJ parser by Nicolas Georges
4              
5             #helper methods
6              
7             #retrieve pbd entries
8 0     0 0 0 sub pbd { @{$_[0]->value->{pbd}} }
  0         0  
9             #retrieve object entries
10 0     0 0 0 sub obj { @{$_[0]->value->{obj}} }
  0         0  
11              
12             #build and executable options
13 1     1 0 2963 sub executable_name { $_[0]->value->{exe}[0] }
14 1     1 0 420 sub application_pbr { $_[0]->value->{exe}[1] }
15 1     1 0 401 sub prompt_for_overwrite { $_[0]->value->{exe}[2] }
16 1 50   1 0 398 sub rebuild_type { $_[0]->value->{exe}[3] ? 'full' : 'incremental' }
17 1     1 0 398 sub rebuild_type_int { $_[0]->value->{exe}[3] }
18 1 50   1 0 396 sub windows_classic_style { $_[0]->value->{exe}[4] ? 0 : 1 }
19 1     1 0 455 sub new_visual_style_controls { $_[0]->value->{exe}[4] }
20              
21             #code generation options
22             #TODO: find meaning of {cmp}[3, 5 and 7]
23 1 50   1 0 408 sub build_type { $_[0]->value->{cmp}[0] ? 'machinecode' : '' } #empty is for pcode
24 1     1 0 394 sub build_type_int { $_[0]->value->{cmp}[0] }
25 1     1 0 725 sub with_error_context { $_[0]->value->{cmp}[1] }
26 1     1 0 395 sub with_trace_information { $_[0]->value->{cmp}[2] }
27 1   50 1 0 394 sub optimisation { qw(speed space none)[ $_[0]->value->{cmp}[4] ] // '?' }
28 1     1 0 393 sub optimisation_int { $_[0]->value->{cmp}[4] }
29 1     1 0 393 sub enable_debug_symbol { $_[0]->value->{cmp}[6] }
30              
31             #manifest information
32 1   50 1 0 406 sub manifest_type { qw(none embedded external)[$_[0]->value->{man}[0]] // '?' }
33 1     1 0 440 sub manifest_type_int { $_[0]->value->{man}[0] }
34 1     1 0 402 sub execution_level { $_[0]->value->{man}[1] }
35 1 50   1 0 396 sub access_protected_sys_ui { $_[0]->value->{man}[2] ? 'true' : 'false' }
36 1     1 0 390 sub access_protected_sys_ui_int { $_[0]->value->{man}[2] }
37             sub manifestinfo_string {
38             #this string is usable in orcascript for the manifestinfo argument of the 'set exeinfo property' command
39 1     1 0 393 my $self = shift;
40            
41 1         2 my $manifest = join ';', @{ $self->value->{man} };
  1         4  
42 1 50       10 $manifest =~ s/1$/true/ or $manifest =~ s/0$/false/;
43            
44 1         4 return $manifest;
45             }
46              
47             #others
48 1     1 0 390 sub product_name { $_[0]->value->{prd}[0] }
49 1     1 0 388 sub company_name { $_[0]->value->{com}[0] }
50 1     1 0 388 sub description { $_[0]->value->{des}[0] }
51 1     1 0 388 sub copyright { $_[0]->value->{cpy}[0] }
52 1     1 0 388 sub product_version_string { $_[0]->value->{pvs}[0] }
53 1     1 0 445 sub product_version_number { join('.', @{ $_[0]->value->{pvn} }) }
  1         5  
54 1     1 0 391 sub product_version_numbers { @{ $_[0]->value->{pvn} } }
  1         5  
55 1     1 0 399 sub file_version_string { $_[0]->value->{fvs}[0] }
56 1     1 0 388 sub file_version_number { join('.', @{ $_[0]->value->{fvn} }) }
  1         4  
57 1     1 0 429 sub file_version_numbers { @{ $_[0]->value->{fvn} } }
  1         5  
58              
59             #Grammar action methods
60             sub project {
61 1     1 0 33 my ($ppa, $items) = @_;
62            
63 1         2 my %attrs;
64             ITEM:
65 1         2 for(@$items){
66 16         20 my $item = $_->[0];
67 16         32 my ($name, @children) = @$item;
68 16 100       34 if($name =~ /^(PBD|OBJ)$/i){
69 5         5 push @{$attrs{$name}}, \@children;
  5         12  
70             }
71             else{
72 11         22 $attrs{$name} = \@children;
73             }
74             }
75            
76 1         3 return \%attrs;
77             }
78              
79             sub compiler{
80 1     1 0 32 my ($ppa, $ary) = @_;
81            
82 1         4 return [ cmp => @$ary ];
83             }
84              
85             sub string {
86 22     22 0 11723 my ($ppa, $str) = @_;
87 22         37 return $str;
88             }
89              
90             sub integer {
91 22     22 0 646 my ($ppa, $int) = @_;
92 22         37 return $int;
93             }
94              
95             1;