line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Markdent::Role::AnyParser; |
2
|
|
|
|
|
|
|
|
3
|
35
|
|
|
35
|
|
22351
|
use strict; |
|
35
|
|
|
|
|
93
|
|
|
35
|
|
|
|
|
1126
|
|
4
|
35
|
|
|
35
|
|
184
|
use warnings; |
|
35
|
|
|
|
|
82
|
|
|
35
|
|
|
|
|
1095
|
|
5
|
35
|
|
|
35
|
|
221
|
use namespace::autoclean; |
|
35
|
|
|
|
|
78
|
|
|
35
|
|
|
|
|
4070
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.39'; |
8
|
|
|
|
|
|
|
|
9
|
35
|
|
|
35
|
|
2988
|
use Markdent::Types; |
|
35
|
|
|
|
|
78
|
|
|
35
|
|
|
|
|
284
|
|
10
|
|
|
|
|
|
|
|
11
|
35
|
|
|
35
|
|
840991
|
use Moose::Role; |
|
35
|
|
|
|
|
97
|
|
|
35
|
|
|
|
|
478
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with 'Markdent::Role::DebugPrinter'; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has handler => ( |
16
|
|
|
|
|
|
|
is => 'ro', |
17
|
|
|
|
|
|
|
does => t('HandlerObject'), |
18
|
|
|
|
|
|
|
required => 1, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
22
|
|
|
|
|
|
|
sub _send_event { |
23
|
3326
|
|
|
3326
|
|
5511
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
3326
|
|
|
|
|
82198
|
$self->handler->handle_event( $self->_make_event(@_) ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
## use critic |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _make_event { |
30
|
5245
|
|
|
5245
|
|
8952
|
my $self = shift; |
31
|
5245
|
|
|
|
|
7942
|
my $class = shift; |
32
|
|
|
|
|
|
|
|
33
|
5245
|
50
|
|
|
|
15430
|
my $real_class = $class =~ /::/ ? $class : 'Markdent::Event::' . $class; |
34
|
|
|
|
|
|
|
|
35
|
5245
|
|
|
|
|
144699
|
return $real_class->new(@_); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
## no critic (Subroutines::ProhibitUnusedPrivateSubroutines) |
39
|
|
|
|
|
|
|
sub _detab_text { |
40
|
1624
|
|
|
1624
|
|
2901
|
my $self = shift; |
41
|
1624
|
|
|
|
|
2427
|
my $text = shift; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Ripped off from Text::Mardkown |
44
|
1624
|
|
|
|
|
2232
|
${$text} =~ s{ ^ |
|
1624
|
|
|
|
|
3844
|
|
45
|
|
|
|
|
|
|
(.*?) |
46
|
|
|
|
|
|
|
\t |
47
|
3
|
|
|
|
|
24
|
} |
48
|
|
|
|
|
|
|
{ $1 . (q{ } x (4 - length($1) % 4))}xmge; |
49
|
1624
|
|
|
|
|
3036
|
|
50
|
|
|
|
|
|
|
return; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
3312
|
|
|
3312
|
|
5239
|
sub _debug_look_for { |
54
|
|
|
|
|
|
|
my $self = shift; |
55
|
3312
|
50
|
|
|
|
81973
|
|
56
|
|
|
|
|
|
|
return unless $self->debug; |
57
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my @look_debug = map { ref $_ ? "$_->[0] ($_->[1])" : $_ } @_; |
59
|
0
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
my $msg = "Looking for the following possible matches:\n"; |
61
|
|
|
|
|
|
|
$msg .= " - $_\n" for @look_debug; |
62
|
0
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
$self->_print_debug($msg); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
## use critic |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# ABSTRACT: A role for block and span parsers |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=pod |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=encoding UTF-8 |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 NAME |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Markdent::Role::AnyParser - A role for block and span parsers |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 VERSION |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
version 0.39 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 DESCRIPTION |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This role implements behavior shared by all types of parser. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This role provides the following attributes: |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 handler |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This is a read-only attribute. It is an object which does the |
96
|
|
|
|
|
|
|
L<Markdent::Role::Handler> role. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This is required for all parsers. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 METHODS |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 $parser->_detab_text(\$text) |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This takes a scalar reference to a piece of text that will be outputted and |
105
|
|
|
|
|
|
|
replaces tabs with spaces. This is down I<after> a piece of text is parser for |
106
|
|
|
|
|
|
|
markup. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 ROLES |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This class does the L<Markdent::Role::DebugPrinter> role. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 BUGS |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
See L<Markdent> for bug reporting details. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/Markdent/issues>. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head1 SOURCE |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
The source code repository for Markdent can be found at L<https://github.com/houseabsolute/Markdent>. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head1 AUTHOR |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This software is copyright (c) 2021 by Dave Rolsky. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
133
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
The full text of the license can be found in the |
136
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |