line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::TextTemplate; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
724
|
use Text::MicroMason::PassVariables; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
4
|
|
|
|
|
|
|
@ISA = 'Text::MicroMason::PassVariables'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
15
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
3
|
use Text::Balanced 'extract_multiple', 'extract_codeblock'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
212
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
###################################################################### |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $lexer_rule = [ { TTBlock => sub { extract_codeblock($_[0],'{}','') } } ]; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# @tokens = $mason->lex( $template ); |
15
|
|
|
|
|
|
|
sub lex { |
16
|
5
|
|
|
5
|
1
|
5
|
my $self = shift; |
17
|
5
|
100
|
|
|
|
8
|
map { ( ! ref) ? ( text => $_ ) : ( expr => substr($$_, 1, -1) ) } |
|
12
|
|
|
|
|
646
|
|
18
|
|
|
|
|
|
|
extract_multiple( shift(), $lexer_rule ); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
###################################################################### |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Text elements used for subroutine assembly |
24
|
|
|
|
|
|
|
sub assembler_rules { |
25
|
5
|
|
|
5
|
1
|
8
|
(shift)->NEXT('assembler_rules', @_), |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
init_output => 'my $OUT = ""; my $_out = sub {$OUT .= join "", @_};', |
28
|
|
|
|
|
|
|
add_output => ' $OUT .= join "", ', |
29
|
|
|
|
|
|
|
return_output => '$OUT;', |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
###################################################################### |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $seqno = 0; |
35
|
|
|
|
|
|
|
sub prepare { |
36
|
5
|
|
|
5
|
1
|
4
|
my $self = shift; |
37
|
|
|
|
|
|
|
$self->NEXT('prepare', @_, |
38
|
5
|
100
|
|
|
|
24
|
$self->{package} ? () : ( package => __PACKAGE__ . '::GEN' . $seqno++ ) |
39
|
|
|
|
|
|
|
) |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
###################################################################### |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |