ClassFile/Util/BNF.pm

filter: Statementstmt 91.3% 21 / 23 Branchbran n/a Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 1 totaltotal 64.1% 25 / 39 SCAR 11.6
CC
3
Cov
72%
bnf
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.2
« ClassFile/Util/MarpaTrace.pm ↑ Summary ClassFile/Struct/Class.pm »
1 88 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 88 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 package MarpaX::Java::ClassFile::Util::BNF;
5  
6 # ABSTRACT: Provides common BNF top and header contents
7  
8 88 our $VERSION = '0.008'; # VERSION
9  
10 88 our $AUTHORITY = 'cpan:JDDPAUSE'; # AUTHORITY
11  
12 88 ▶use Data::Section -setup;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 88 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 88 our @EXPORT_OK = qw/bnf/;
16 88 our %EXPORT_TAGS = (all => \@EXPORT_OK);
17  
18 88 my $_bnf_top = ${__PACKAGE__->section_data('bnf_top')};
19 88 my $_bnf_bottom = ${__PACKAGE__->section_data('bnf_bottom')};
20  
21 #
22 # Class method
23 #
24 sub bnf {
25 0 ▶ my ($class, $bnf, $top, $bottom) = @_;
Subroutine bnf: not called CC=3 SCAR=24.8
Pod undocumented
26 0 ▶ join('', $top // $_bnf_top, $bnf, $bottom // $_bnf_bottom)
Condition0%0/6
$top // $_bnf_top
l!l&&r!l&&!r
000
$bottom // $_bnf_bottom
l!l&&r!l&&!r
000
MC/DC0%0/2
$top // $_bnf_top
$top $_bnf_top
MC/DC0%0/2
$bottom // $_bnf_bottom
$bottom $_bnf_bottom
Truth table0%0/3
A // B
A= $topB= $_bnf_top
ABresult
1X1
011
000
Truth table0%0/3
A // B
A= $bottomB= $_bnf_bottom
ABresult
1X1
011
000
27 }
28  
29 88 1;
30  
31 =pod
32  
33 =encoding UTF-8
34  
35 =head1 NAME
36  
37 MarpaX::Java::ClassFile::Util::BNF - Provides common BNF top and header contents
38  
39 =head1 VERSION
40  
41 version 0.008
42  
43 =head1 AUTHOR
44  
45 Jean-Damien Durand <jeandamiendurand@free.fr>
46  
47 =head1 COPYRIGHT AND LICENSE
48  
49 This software is copyright (c) 2016 by Jean-Damien Durand.
50  
51 This is free software; you can redistribute it and/or modify it under
52 the same terms as the Perl 5 programming language system itself.
53  
54 =cut
55  
56 __DATA__
57 __[ bnf_top ]__
58 #
59 # latm is a sane default that can be common to all grammars
60 #
61 lexeme default = latm => 1
62 #
63 # This is more dangerous, but let's say we know what we are doing.
64 #
65 inaccessible is ok by default
66  
67 __[ bnf_bottom ]__
68 ###################################################
69 # Prevent Marpa saying that a lexeme is unreachable
70 # External BNF's are not supposed to use these
71 ###################################################
72 u1_internal ::= U1
73 u2_internal ::= U2
74 u4_internal ::= U4
75 managed_internal ::= MANAGED
76  
77 ########################################
78 # Common lexemes #
79 ########################################
80 _U1 ~ [\s\S]
81 _U2 ~ _U1 _U1
82 _U4 ~ _U2 _U2
83 _MANAGED ~ [^\s\S]
84  
85 U1 ~ _U1
86 U2 ~ _U2
87 U4 ~ _U4
88 MANAGED ~ _MANAGED
« ClassFile/Util/MarpaTrace.pm ↑ Summary ClassFile/Struct/Class.pm »