ClassFile/BNF/ElementValue.pm

filter: Statementstmt 42.8% 15 / 35 Branchbran 0.0% 0 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 5 / 10 Podpod n/a totaltotal 28.1% 20 / 71 SCAR 45.9
CC
14
Cov
25%
__ANON__
210.0
grammar
2.0
__ANON__
2.0
CRAP 98.1
« ClassFile/BNF/ConstantPoolArray.pm ↑ Summary ClassFile/Util/FrameTypeStringification.pm »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package MarpaX::Java::ClassFile::BNF::ElementValue;
5 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # ABSTRACT: Parsing of a element_value
8  
9 our $VERSION = '0.008'; # VERSION
10  
11 our $AUTHORITY = 'cpan:JDDPAUSE'; # AUTHORITY
12  
13 #
14 # Note: this union is easy, no need to subclass the BNFs
15 #
16  
17 1 ▶use Data::Section -setup;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use MarpaX::Java::ClassFile::Util::BNF qw/:all/;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 #
20 # require because we do not import ANYTHING from these module, just require they are loaded
21 #
22 require Marpa::R2;
23 require MarpaX::Java::ClassFile::Struct::ElementValue;
24 require MarpaX::Java::ClassFile::BNF::ConstValueIndex;
25 require MarpaX::Java::ClassFile::BNF::EnumConstValue;
26 require MarpaX::Java::ClassFile::BNF::ClassInfoIndex;
27 require MarpaX::Java::ClassFile::BNF::Annotation;
28 require MarpaX::Java::ClassFile::BNF::ArrayValue;
29  
30 my $_data = ${ __PACKAGE__->section_data('bnf') };
31 my $_grammar = Marpa::R2::Scanless::G->new( { source => \__PACKAGE__->bnf($_data) } );
32  
33 # --------------------------------------------------------
34 # What role MarpaX::Java::ClassFile::Role::Parser requires
35 # --------------------------------------------------------
36 0 ▶sub grammar { $_grammar }
Subroutine grammar: not called CC=1 SCAR=6.9
37 sub callbacks { return {
38 0 ▶ "'exhausted" => sub { $_[0]->exhausted },
Subroutine __ANON__: not called CC=1 SCAR=6.9
39 'tag$' => sub {
40 0 ▶ my $tag = $_[0]->literalU1('tag');
Subroutine __ANON__: not called CC=14 SCAR=53.5
41 0 ▶ if ($tag == ord('B')) { $_[0]->inner('ConstValueIndex') }
Branch: 13 branches
BranchTrueFalseTotal
if ($tag == 66) { } 0 0 0
elsif ($tag == 67) { } 0 0 0
elsif ($tag == 68) { } 0 0 0
elsif ($tag == 70) { } 0 0 0
elsif ($tag == 73) { } 0 0 0
elsif ($tag == 74) { } 0 0 0
elsif ($tag == 83) { } 0 0 0
elsif ($tag == 90) { } 0 0 0
elsif ($tag == 115) { } 0 0 0
elsif ($tag == 101) { } 0 0 0
elsif ($tag == 99) { } 0 0 0
elsif ($tag == 64) { } 0 0 0
elsif ($tag == 91) { } 0 0 0
42 0 elsif ($tag == ord('C')) { $_[0]->inner('ConstValueIndex') }
43 0 elsif ($tag == ord('D')) { $_[0]->inner('ConstValueIndex') }
44 0 elsif ($tag == ord('F')) { $_[0]->inner('ConstValueIndex') }
45 0 elsif ($tag == ord('I')) { $_[0]->inner('ConstValueIndex') }
46 0 elsif ($tag == ord('J')) { $_[0]->inner('ConstValueIndex') }
47 0 elsif ($tag == ord('S')) { $_[0]->inner('ConstValueIndex') }
48 0 elsif ($tag == ord('Z')) { $_[0]->inner('ConstValueIndex') }
49 0 elsif ($tag == ord('s')) { $_[0]->inner('ConstValueIndex') }
50 0 elsif ($tag == ord('e')) { $_[0]->inner('EnumConstValue') }
51 0 elsif ($tag == ord('c')) { $_[0]->inner('ClassInfoIndex') }
52 0 elsif ($tag == ord('@')) { $_[0]->inner('Annotation') }
53 0 elsif ($tag == ord('[')) { $_[0]->inner('ArrayValue') }
54 0 else { $_[0]->fatalf('Unmanaged element value tag %d', $tag) }
55 }
56 }
57 0 ▶ }
Subroutine callbacks: not called CC=1 SCAR=6.9
58  
59 # ---------------
60 # Grammar actions
61 # ---------------
62 sub _ElementValue {
63 # my ($self, $tag, $value) = @_;
64  
65 0 ▶ MarpaX::Java::ClassFile::Struct::ElementValue->new(
Subroutine _ElementValue: not called CC=1 SCAR=6.9
66 tag => $_[1],
67 value => $_[2]
68 )
69 }
70  
71 with 'MarpaX::Java::ClassFile::Role::Parser';
72  
73 1;
74  
75 =pod
76  
77 =encoding UTF-8
78  
79 =head1 NAME
80  
81 MarpaX::Java::ClassFile::BNF::ElementValue - Parsing of a element_value
82  
83 =head1 VERSION
84  
85 version 0.008
86  
87 =head1 AUTHOR
88  
89 Jean-Damien Durand <jeandamiendurand@free.fr>
90  
91 =head1 COPYRIGHT AND LICENSE
92  
93 This software is copyright (c) 2016 by Jean-Damien Durand.
94  
95 This is free software; you can redistribute it and/or modify it under
96 the same terms as the Perl 5 programming language system itself.
97  
98 =cut
99  
100 __DATA__
101 __[ bnf ]__
102 event 'tag$' = completed tag
103 ElementValue ::= tag managed action => _ElementValue
104 tag ::= U1 action => u1
105 managed ::= MANAGED action => ::first
« ClassFile/BNF/ConstantPoolArray.pm ↑ Summary ClassFile/Util/FrameTypeStringification.pm »