line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::TextTemplate; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
708
|
use Text::MicroMason::PassVariables; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
|
|
|
|
|
|
@ISA = 'Text::MicroMason::PassVariables'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use Text::Balanced 'extract_multiple', 'extract_codeblock'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
210
|
|
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
|
7
|
my $self = shift; |
17
|
5
|
100
|
|
|
|
15
|
map { ( ! ref) ? ( text => $_ ) : ( expr => substr($$_, 1, -1) ) } |
|
12
|
|
|
|
|
1087
|
|
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
|
15
|
(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
|
9
|
my $self = shift; |
37
|
|
|
|
|
|
|
$self->NEXT('prepare', @_, |
38
|
5
|
100
|
|
|
|
29
|
$self->{package} ? () : ( package => __PACKAGE__ . '::GEN' . $seqno++ ) |
39
|
|
|
|
|
|
|
) |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
###################################################################### |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |