line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
PPIx::Regexp::Token::Unknown - Represent an unknown token |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 SYNOPSIS |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use PPIx::Regexp::Dumper; |
8
|
|
|
|
|
|
|
PPIx::Regexp::Dumper->new( 'xyzzy' ) |
9
|
|
|
|
|
|
|
->print(); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 INHERITANCE |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
C is a |
14
|
|
|
|
|
|
|
L. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
C has no descendants. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This token represents something that could not be identified by the |
21
|
|
|
|
|
|
|
tokenizer. Sometimes the lexer can fix these up, but the presence of one |
22
|
|
|
|
|
|
|
of these in a finished parse represents something in the regular |
23
|
|
|
|
|
|
|
expression that was not understood. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 METHODS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
This class provides the following public methods. Methods not documented |
28
|
|
|
|
|
|
|
here are private, and unsupported in the sense that the author reserves |
29
|
|
|
|
|
|
|
the right to change or remove them without notice. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
package PPIx::Regexp::Token::Unknown; |
34
|
|
|
|
|
|
|
|
35
|
9
|
|
|
9
|
|
63
|
use strict; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
266
|
|
36
|
9
|
|
|
9
|
|
46
|
use warnings; |
|
9
|
|
|
|
|
36
|
|
|
9
|
|
|
|
|
287
|
|
37
|
|
|
|
|
|
|
|
38
|
9
|
|
|
9
|
|
48
|
use base qw{ PPIx::Regexp::Token }; |
|
9
|
|
|
|
|
30
|
|
|
9
|
|
|
|
|
697
|
|
39
|
|
|
|
|
|
|
|
40
|
9
|
|
|
9
|
|
59
|
use Carp (); |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
173
|
|
41
|
9
|
|
|
9
|
|
51
|
use PPIx::Regexp::Constant qw{ @CARP_NOT }; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
706
|
|
42
|
9
|
|
|
9
|
|
60
|
use PPIx::Regexp::Util; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
2684
|
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
our $VERSION = '0.087_01'; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub __new { |
47
|
38
|
|
|
38
|
|
184
|
my ( $class, $content, %arg ) = @_; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
defined $arg{error} |
50
|
38
|
50
|
|
|
|
143
|
or Carp::confess( 'Programming error - error argument required' ); |
51
|
|
|
|
|
|
|
|
52
|
38
|
50
|
|
|
|
225
|
my $self = $class->SUPER::__new( $content, %arg ) |
53
|
|
|
|
|
|
|
or return; |
54
|
|
|
|
|
|
|
|
55
|
38
|
|
|
|
|
143
|
$self->{error} = $arg{error}; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
$self->{explanation} = defined $arg{explanation} ? |
58
|
|
|
|
|
|
|
$arg{explanation} : |
59
|
38
|
50
|
|
|
|
148
|
$arg{error}; |
60
|
|
|
|
|
|
|
|
61
|
38
|
|
|
|
|
138
|
return $self; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# Return true if the token can be quantified, and false otherwise |
65
|
6
|
|
|
6
|
1
|
26
|
sub can_be_quantified { return }; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub explain { |
68
|
1
|
|
|
1
|
1
|
7
|
my ( $self ) = @_; |
69
|
1
|
|
|
|
|
4
|
return $self->{explanation}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 is_matcher |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
This method returns C because, since we could not identify the |
75
|
|
|
|
|
|
|
token, we have no idea whether it matches anything. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
0
|
1
|
0
|
sub is_matcher { return undef; } ## no critic (ProhibitExplicitReturnUndef) |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 ordinal |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
This method returns the results of the ord built-in on the content |
84
|
|
|
|
|
|
|
(meaning, of course, the first character of the content). No attempt is |
85
|
|
|
|
|
|
|
made to interpret the content, since after all this B the unknown |
86
|
|
|
|
|
|
|
token. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub ordinal { |
91
|
0
|
|
|
0
|
1
|
0
|
my ( $self ) = @_; |
92
|
0
|
|
|
|
|
0
|
return ord $self->content(); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub width { |
96
|
0
|
|
|
0
|
1
|
0
|
return ( undef, undef ); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
*__PPIX_ELEM__post_reblessing = \&PPIx::Regexp::Util::__post_rebless_error; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# Since the lexer does not count these on the way in (because it needs |
102
|
|
|
|
|
|
|
# the liberty to rebless them into a known class if it figures out what |
103
|
|
|
|
|
|
|
# is going on) we count them as failures at the finalization step. |
104
|
|
|
|
|
|
|
sub __PPIX_LEXER__finalize { |
105
|
18
|
|
|
18
|
|
49
|
return 1; |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
__END__ |