line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::Embperl; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
412
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
3
|
use Carp; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
51
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
432
|
use Safe; |
|
1
|
|
|
|
|
23308
|
|
|
1
|
|
|
|
|
179
|
|
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
|
265
|
/\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
|
8
|
my $self = shift; |
34
|
9
|
|
|
|
|
25
|
$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__ |