line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::Embperl; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
554
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
58
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
473
|
use Safe; |
|
1
|
|
|
|
|
36940
|
|
|
1
|
|
|
|
|
298
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
###################################################################### |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %block_types = ( |
11
|
|
|
|
|
|
|
'-' => 'perl', # [- perl statements -] |
12
|
|
|
|
|
|
|
'+' => 'expr', # [+ perl expression +] |
13
|
|
|
|
|
|
|
'!' => 'once', # [! perl statements !] |
14
|
|
|
|
|
|
|
'$' => 'ep_meta', # [$ command args $] |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub lex_token { |
18
|
|
|
|
|
|
|
# Blocks in [-/+/! ... -/+/!] tags. |
19
|
40
|
50
|
|
40
|
1
|
391
|
/\G \[ (\-|\+|\!) \s* (.*?) \s* \1 \] /gcxs ? ( $block_types{$1} => $2 ) : |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
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
|
|
|
|
|
|
|
sub assembler_rules { |
33
|
9
|
|
|
9
|
1
|
14
|
my $self = shift; |
34
|
9
|
|
|
|
|
44
|
$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; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |