line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hailo::Tokenizer::Chars; |
2
|
|
|
|
|
|
|
BEGIN { |
3
|
1
|
|
|
1
|
|
43915
|
$Hailo::Tokenizer::Chars::AUTHORITY = 'cpan:AVAR'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
$Hailo::Tokenizer::Chars::VERSION = '0.72'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
36
|
use 5.010; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
52
|
|
10
|
1
|
|
|
1
|
|
1128
|
use Any::Moose; |
|
1
|
|
|
|
|
116399
|
|
|
1
|
|
|
|
|
13
|
|
11
|
1
|
|
|
1
|
|
644
|
use Any::Moose 'X::StrictConstructor'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
12
|
|
|
|
|
|
|
use namespace::clean -except => 'meta'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with qw(Hailo::Role::Arguments |
15
|
|
|
|
|
|
|
Hailo::Role::Tokenizer); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# output -> tokens |
18
|
|
|
|
|
|
|
sub make_tokens { |
19
|
|
|
|
|
|
|
my ($self, $line) = @_; |
20
|
|
|
|
|
|
|
my @chars = split //, $line; |
21
|
|
|
|
|
|
|
my @tokens = map { [$self->{_spacing_normal}, $_] } @chars; |
22
|
|
|
|
|
|
|
return \@tokens; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# tokens -> output |
26
|
|
|
|
|
|
|
sub make_output { |
27
|
|
|
|
|
|
|
my ($self, $tokens) = @_; |
28
|
|
|
|
|
|
|
return trim(join '', map { $_->[1] } @$tokens); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub trim { |
32
|
|
|
|
|
|
|
my $txt = shift; |
33
|
|
|
|
|
|
|
$txt =~ s/^\s+//; |
34
|
|
|
|
|
|
|
$txt =~ s/\s+$//; |
35
|
|
|
|
|
|
|
return $txt; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=encoding utf8 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 NAME |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Hailo::Tokenizer::Chars - A character tokenizer for L |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 DESCRIPTION |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
This tokenizer dumbly splits input with C. Use it to |
49
|
|
|
|
|
|
|
generate chains on a per-character basis. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 AUTHOR |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Evar ArnfjErE Bjarmason |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Copyright 2010 Evar ArnfjErE Bjarmason. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify |
60
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |