Drinkup/Grammar.pm

filter: Statementstmt 100% 8 / 8 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
make_tree
1.0
CRAP 1.0
« Drinkup.pm ↑ Summary
1 package Pegex::Drinkup::Grammar;
2 2 ▶use base Pegex::Grammar;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 2 ▶use constant file => 'share/drinkup.pgx';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶sub make_tree { # Generated/Inlined by Pegex::Grammar (0.55)
Subroutine make_tree: called CC=1 SCAR=0.0
Pod documented
7 {
8 1 '+grammar' => 'drinkup',
9 '+toprule' => 'recipe',
10 '+version' => '0.0.1',
11 'cocktail' => {
12 '.rgx' => qr/\G(?:\s*\r?\n)?(\S.*?)\s*\r?\n/
13 },
14 'description' => {
15 '.rgx' => qr/\G([\s\S]*?)(?=\r?\n[\ \t]*\*)\s*/
16 },
17 'footers' => {
18 '+min' => 1,
19 '.ref' => 'metadata'
20 },
21 'ingredient' => {
22 '.all' => [
23 {
24 '.rgx' => qr/\G\ *\*\ */
25 },
26 {
27 '.ref' => 'number'
28 },
29 {
30 '.rgx' => qr/\G\ */
31 },
32 {
33 '.ref' => 'unit'
34 },
35 {
36 '.rgx' => qr/\G\ */
37 },
38 {
39 '.ref' => 'name'
40 },
41 {
42 '.rgx' => qr/\G\ *\r?\n/
43 },
44 {
45 '+max' => 1,
46 '.ref' => 'note'
47 }
48 ]
49 },
50 'ingredients' => {
51 '+min' => 1,
52 '.ref' => 'ingredient'
53 },
54 'instructions' => {
55 '.rgx' => qr/\G([\s\S]*)(?=\r?\n[0-9A-Za-z_\s*]+:)\s*/
56 },
57 'metadata' => {
58 '.rgx' => qr/\G([0-9A-Za-z_\s*]+):\ *(.+?)\s*\r?\n/
59 },
60 'name' => {
61 '.rgx' => qr/\G(.+?)\s*(?=\r?\n)/
62 },
63 'note' => {
64 '.rgx' => qr/\G\#\ *(.+?)\ *\r?\n/
65 },
66 'number' => {
67 '.rgx' => qr/\G((?:0|[1-9][0-9]*)?(?:\.[0-9]+)?(?:\s*\+?\s*[0-9]+\s*\/\s*[0-9]+)?)/
68 },
69 'recipe' => {
70 '.all' => [
71 {
72 '.ref' => 'cocktail'
73 },
74 {
75 '.ref' => 'description'
76 },
77 {
78 '.ref' => 'ingredients'
79 },
80 {
81 '.ref' => 'instructions'
82 },
83 {
84 '.ref' => 'footers'
85 }
86 ]
87 },
88 'unit' => {
89 '.rgx' => qr/\G(\w+)(?:\s*of)?/
90 }
91 }
92 }
93  
94 2 1;
« Drinkup.pm ↑ Summary