File Coverage

html/lib/Marpa/R2/HTML/Config/Core.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 19 19 100.0


line stmt bran cond sub pod time code
1             # Copyright 2022 Jeffrey Kegler
2             # This file is part of Marpa::R2. Marpa::R2 is free software: you can
3             # redistribute it and/or modify it under the terms of the GNU Lesser
4             # General Public License as published by the Free Software Foundation,
5             # either version 3 of the License, or (at your option) any later version.
6             #
7             # Marpa::R2 is distributed in the hope that it will be useful,
8             # but WITHOUT ANY WARRANTY; without even the implied warranty of
9             # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10             # Lesser General Public License for more details.
11             #
12             # You should have received a copy of the GNU Lesser
13             # General Public License along with Marpa::R2. If not, see
14             # http://www.gnu.org/licenses/.
15              
16             package Marpa::R2::HTML::Internal::Core;
17              
18 1     1   17 use 5.010001;
  1         3  
19 1     1   5 use strict;
  1         2  
  1         18  
20 1     1   5 use warnings;
  1         1  
  1         22  
21 1     1   5 use Data::Dumper;
  1         2  
  1         45  
22              
23 1     1   23 use English qw( -no_match_vars );
  1         2  
  1         4  
24              
25             our $CORE_BNF = <<'END_OF_CORE_BNF';
26             # The tokens are not used directly
27             # because, in order to have handlers
28             # deal with them individually, I need
29             # a rule with which to associate the
30             # handler.
31             comment ::= C
32             pi ::= PI
33             decl ::= D
34             pcdata ::= PCDATA
35             cdata ::= CDATA
36             whitespace ::= WHITESPACE
37             cruft ::= CRUFT
38              
39             FLO_SGML ::= GRP_SGML*
40             GRP_SGML ::= comment
41             GRP_SGML ::= pi
42             GRP_SGML ::= decl
43             GRP_SGML ::= whitespace
44             GRP_SGML ::= cruft
45              
46             # For element x,
47             # ELE_x is complete element
48             # S_x is start tag
49             # E_x is end tag
50             # The contents of many elements consists of zero or more items
51              
52             # Top-level structure
53             document ::= prolog ELE_html trailer EOF
54             prolog ::= FLO_SGML
55             trailer ::= FLO_SGML
56             ELE_html ::= S_html Contents_html E_html
57             Contents_html ::= FLO_SGML ELE_head FLO_SGML ELE_body FLO_SGML
58              
59             # FLO_empty and FLO_cdata
60             # do NOT allow SGML items as part of
61             # their flow
62             FLO_empty ::=
63              
64             # In FLO_cdata, disallow all SGML components,
65             # but include cruft.
66             FLO_cdata ::= GRP_cdata*
67             GRP_cdata ::= CRUFT
68             GRP_cdata ::= cdata
69              
70             FLO_mixed ::= GRP_mixed*
71             GRP_mixed ::= GRP_block
72             GRP_mixed ::= GRP_inline
73              
74             FLO_block ::= GRP_block*
75             GRP_block ::= GRP_SGML
76             GRP_block ::= GRP_anywhere
77              
78             FLO_head ::= GRP_head*
79             GRP_head ::= GRP_SGML
80             GRP_head ::= GRP_anywhere
81              
82             FLO_inline ::= GRP_inline*
83             GRP_inline ::= GRP_SGML
84             GRP_inline ::= pcdata
85             GRP_inline ::= cdata
86             GRP_inline ::= GRP_anywhere
87              
88             FLO_pcdata ::= GRP_pcdata*
89             GRP_pcdata ::= GRP_SGML
90             GRP_pcdata ::= pcdata
91             GRP_pcdata ::= cdata
92              
93             END_OF_CORE_BNF
94              
95             1;