line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Parse::Highlife::Rule::Token; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
4
|
use base qw(Parse::Highlife::Rule); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
64
|
|
5
|
1
|
|
|
1
|
|
5
|
use Parse::Highlife::Utils qw(params); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
6
|
1
|
|
|
1
|
|
4
|
use Data::Dump qw(dump); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
254
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new |
9
|
|
|
|
|
|
|
{ |
10
|
0
|
|
|
0
|
0
|
|
my( $class, @args ) = @_; |
11
|
0
|
|
|
|
|
|
my $self = bless Parse::Highlife::Rule->new( @args ), $class; |
12
|
0
|
|
|
|
|
|
return $self -> _init( @args ); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _init |
16
|
|
|
|
|
|
|
{ |
17
|
0
|
|
|
0
|
|
|
my( $self, $token ) |
18
|
|
|
|
|
|
|
= params( \@_, |
19
|
|
|
|
|
|
|
-token => '', |
20
|
|
|
|
|
|
|
); |
21
|
0
|
|
|
|
|
|
$self->{'token'} = $token; |
22
|
0
|
|
|
|
|
|
return $self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub parse_from_token |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
0
|
|
my( $self, $parser, $tokens, $t ) = @_; |
28
|
0
|
0
|
|
|
|
|
return (0,0,0) if $t >= scalar(@{$tokens}); |
|
0
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $_t = $t; |
31
|
0
|
|
|
|
|
|
($_t) = $self->_parse_ignored_tokens( $tokens, $_t ); |
32
|
0
|
|
|
|
|
|
my $token = $tokens->[$_t]; |
33
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if( $token->{'token-name'} eq $self->{'token'} ) { |
35
|
|
|
|
|
|
|
return ( |
36
|
0
|
|
|
|
|
|
1, |
37
|
|
|
|
|
|
|
$_t + 1, |
38
|
|
|
|
|
|
|
$parser->make_ast_element('leaf', $self->{'name'}, $token->{'matched-substring'}) |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
} |
41
|
0
|
|
|
|
|
|
return (0,0,0); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |