blib/lib/Text/MicroMason/Embperl.pm

filter: Statementstmt 100% 14 / 14 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 96.3% 26 / 27 CC 4 SCAR 9.3
CC
4
Cov
95%
lex_token
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.5
« blib/lib/Text/MicroMason/CompileCache.pm ↑ Summary blib/lib/Text/MicroMason/PassVariables.pm »
1 package Text::MicroMason::Embperl;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use Safe;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 ######################################################################
9  
10 1 my %block_types = (
11 '-' => 'perl', # [- perl statements -]
12 '+' => 'expr', # [+ perl expression +]
13 '!' => 'once', # [! perl statements !]
14 '$' => 'ep_meta', # [$ command args $]
15 );
16  
17 40 ▶sub lex_token {
Subroutine lex_token: called CC=4 SCAR=14.0
Pod documented
18 # Blocks in [-/+/! ... -/+/!] tags.
19 40 ▶ /\G \[ (\-|\+|\!) \s* (.*?) \s* \1 \] /gcxs ? ( $block_types{$1} => $2 ) :
Branch: 3 branches
BranchTrueFalseTotal
/\G \[ (\-|\+|\!) \s* (.*?) \s* \1 \] /cgsx ? : 15 25 40
/\G \[ \$ \s* (\S+)\s*(.*?) \s* \$ \] /cgsx ? : 3 22 25
/\G ( (?: [^\[] | \[(?![\-\+\!\$]) )+ ) /cgsx ? : 22 0 22
20
21 # Blocks in [$ command ... $] tags.
22 /\G \[ \$ \s* (\S+)\s*(.*?) \s* \$ \] /gcxs ? ( "ep_$1" => $2 ) :
23
24 # Things that don't match the above
25 /\G ( (?: [^\[] | \[(?![\-\+\!\$]) )+ ) /gcxs ? ( 'text' => $1 ) :
26  
27 ()
28 }
29  
30 ######################################################################
31  
32 9 ▶sub assembler_rules {
Subroutine assembler_rules: called CC=1 SCAR=0.0
Pod documented
33 9 my $self = shift;
34 9 $self->NEXT('assembler_rules', @_),
35 ep_if_token => "perl if ( TOKEN ) {",
36 ep_elsif_token => "perl } elsif ( TOKEN ) {",
37 ep_else_token => "perl } else {",
38 ep_endif_token => "perl }",
39 ep_while_token => "perl while ( TOKEN ) {",
40 ep_endwhile_token => "perl }",
41 ep_foreach_token => "perl foreach TOKEN {",
42 ep_endforeach_token => "perl }",
43 ep_do_token => "perl do {",
44 ep_until_token => "perl } until ( TOKEN );",
45 ep_var_token => "perl use strict; use vars qw( TOKEN );",
46 }
47  
48 ######################################################################
49  
50 1 1;
51  
52 __END__
« blib/lib/Text/MicroMason/CompileCache.pm ↑ Summary blib/lib/Text/MicroMason/PassVariables.pm »