| blib/lib/Pegex/Crontab/Grammar.pm | |||
|---|---|---|---|
| Criterion | Covered | Total | % |
| statement | 7 | 7 | 100.0 |
| branch | n/a | ||
| condition | n/a | ||
| subroutine | 3 | 3 | 100.0 |
| pod | 1 | 1 | 100.0 |
| total | 11 | 11 | 100.0 |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | package Pegex::Crontab::Grammar; | ||||||
| 2 | 2 | 2 | 11 | use Pegex::Base; | |||
| 2 | 4 | ||||||
| 2 | 15 | ||||||
| 3 | extends 'Pegex::Grammar'; | ||||||
| 4 | |||||||
| 5 | 2 | 2 | 14200 | use constant file => '../crontab-pgx/crontab.pgx'; | |||
| 2 | 6 | ||||||
| 2 | 1704 | ||||||
| 6 | |||||||
| 7 | sub make_tree { | ||||||
| 8 | { | ||||||
| 9 | 1 | 1 | 1 | 431 | '+toprule' => 'crontab', | ||
| 10 | 'EOL' => { | ||||||
| 11 | '.rgx' => qr/\G\r?\n/ | ||||||
| 12 | }, | ||||||
| 13 | '__' => { | ||||||
| 14 | '.rgx' => qr/\G\s+/ | ||||||
| 15 | }, | ||||||
| 16 | 'blank_line' => { | ||||||
| 17 | '.rgx' => qr/\G[\ \t]*\r?\n/ | ||||||
| 18 | }, | ||||||
| 19 | 'command' => { | ||||||
| 20 | '.rgx' => qr/\G(.*)/ | ||||||
| 21 | }, | ||||||
| 22 | 'comment_line' => { | ||||||
| 23 | '.rgx' => qr/\G[\ \t]*\#.*\r?\n/ | ||||||
| 24 | }, | ||||||
| 25 | 'cron_line' => { | ||||||
| 26 | '.all' => [ | ||||||
| 27 | { | ||||||
| 28 | '.ref' => 'minute' | ||||||
| 29 | }, | ||||||
| 30 | { | ||||||
| 31 | '.ref' => '__' | ||||||
| 32 | }, | ||||||
| 33 | { | ||||||
| 34 | '.ref' => 'hour' | ||||||
| 35 | }, | ||||||
| 36 | { | ||||||
| 37 | '.ref' => '__' | ||||||
| 38 | }, | ||||||
| 39 | { | ||||||
| 40 | '.ref' => 'dom' | ||||||
| 41 | }, | ||||||
| 42 | { | ||||||
| 43 | '.ref' => '__' | ||||||
| 44 | }, | ||||||
| 45 | { | ||||||
| 46 | '.ref' => 'month' | ||||||
| 47 | }, | ||||||
| 48 | { | ||||||
| 49 | '.ref' => '__' | ||||||
| 50 | }, | ||||||
| 51 | { | ||||||
| 52 | '.ref' => 'dow' | ||||||
| 53 | }, | ||||||
| 54 | { | ||||||
| 55 | '.ref' => '__' | ||||||
| 56 | }, | ||||||
| 57 | { | ||||||
| 58 | '.ref' => 'command' | ||||||
| 59 | }, | ||||||
| 60 | { | ||||||
| 61 | '.ref' => 'EOL' | ||||||
| 62 | } | ||||||
| 63 | ] | ||||||
| 64 | }, | ||||||
| 65 | 'crontab' => { | ||||||
| 66 | '+min' => 0, | ||||||
| 67 | '.any' => [ | ||||||
| 68 | { | ||||||
| 69 | '.ref' => 'comment_line' | ||||||
| 70 | }, | ||||||
| 71 | { | ||||||
| 72 | '.ref' => 'blank_line' | ||||||
| 73 | }, | ||||||
| 74 | { | ||||||
| 75 | '.ref' => 'env_line' | ||||||
| 76 | }, | ||||||
| 77 | { | ||||||
| 78 | '.ref' => 'cron_line' | ||||||
| 79 | } | ||||||
| 80 | ] | ||||||
| 81 | }, | ||||||
| 82 | 'dom' => { | ||||||
| 83 | '.ref' => 'time' | ||||||
| 84 | }, | ||||||
| 85 | 'dow' => { | ||||||
| 86 | '.ref' => 'time' | ||||||
| 87 | }, | ||||||
| 88 | 'env_line' => { | ||||||
| 89 | '.all' => [ | ||||||
| 90 | { | ||||||
| 91 | '.ref' => 'variable' | ||||||
| 92 | }, | ||||||
| 93 | { | ||||||
| 94 | '.rgx' => qr/\G=/ | ||||||
| 95 | }, | ||||||
| 96 | { | ||||||
| 97 | '.ref' => 'value' | ||||||
| 98 | }, | ||||||
| 99 | { | ||||||
| 100 | '.ref' => 'EOL' | ||||||
| 101 | } | ||||||
| 102 | ] | ||||||
| 103 | }, | ||||||
| 104 | 'hour' => { | ||||||
| 105 | '.ref' => 'time' | ||||||
| 106 | }, | ||||||
| 107 | 'minute' => { | ||||||
| 108 | '.ref' => 'time' | ||||||
| 109 | }, | ||||||
| 110 | 'month' => { | ||||||
| 111 | '.ref' => 'time' | ||||||
| 112 | }, | ||||||
| 113 | 'time' => { | ||||||
| 114 | '.rgx' => qr/\G(\*|(?:(?:[0-9]{1,2})\-(?:[0-9]{1,2})(?:\/(?:[0-9]{1,2}))?|(?:[0-9]{1,2}))(?:,(?:(?:[0-9]{1,2})\-(?:[0-9]{1,2})(?:\/(?:[0-9]{1,2}))?|(?:[0-9]{1,2})))+,?|(?:[0-9]{1,2})\-(?:[0-9]{1,2})(?:\/(?:[0-9]{1,2}))?|(?:mon|tue|wed|thu|fri|sat|sun)|(?:[0-9]{1,2}))/ | ||||||
| 115 | }, | ||||||
| 116 | 'value' => { | ||||||
| 117 | '.rgx' => qr/\G(.*)/ | ||||||
| 118 | }, | ||||||
| 119 | 'variable' => { | ||||||
| 120 | '.rgx' => qr/\G(\w+)/ | ||||||
| 121 | } | ||||||
| 122 | } | ||||||
| 123 | } | ||||||
| 124 | |||||||
| 125 | 1; |