line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::MicroMason::ServerPages; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
583
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
13
|
|
|
1
|
|
|
|
|
63
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
476
|
use Safe; |
|
1
|
|
|
|
|
36064
|
|
|
1
|
|
|
|
|
216
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
###################################################################### |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
my %block_types = ( |
11
|
|
|
|
|
|
|
'' => 'perl', # <% perl statements %> |
12
|
|
|
|
|
|
|
'=' => 'expr', # <%= perl expression %> |
13
|
|
|
|
|
|
|
'--' => 'doc', # <%-- this text will not appear in the output --%> |
14
|
|
|
|
|
|
|
'&' => 'file', # <%& filename argument %> |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $re_eol = "(?:\\r\\n|\\r|\\n|\\z)"; |
18
|
|
|
|
|
|
|
my $re_tag = "perl|args|once|init|cleanup|doc|text|expr|file"; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub lex_token { |
21
|
|
|
|
|
|
|
# Blocks in <%word> ... <%word> tags. |
22
|
|
|
|
|
|
|
/\G \<\%($re_tag)\> (.*?) \<\/\%\1\> $re_eol? /xcogs ? ( $1 => $2 ) : |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Blocks in <% ... %> tags. |
25
|
51
|
50
|
100
|
51
|
1
|
491
|
/\G \<\% (\=|\&)? ( .*? ) \%\> /gcxs ? ( $block_types{$1 || ''} => $2 ) : |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Blocks in <%-- ... --%> tags. |
28
|
|
|
|
|
|
|
/\G \<\% \-\- ( .*? ) \-\- \%\> /gcxs ? ( 'doc' => $1 ) : |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Things that don't match the above |
31
|
|
|
|
|
|
|
/\G ( (?: [^\<]+ | \<(?!\%) )? ) /gcxs ? ( 'text' => $1 ) : |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Lexer error |
34
|
|
|
|
|
|
|
() |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
###################################################################### |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |