line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::Parser::Errors 0.927; |
2
|
31
|
|
|
31
|
|
307009
|
use strict; |
|
31
|
|
|
|
|
73
|
|
|
31
|
|
|
|
|
890
|
|
3
|
31
|
|
|
31
|
|
153
|
use warnings; |
|
31
|
|
|
|
|
61
|
|
|
31
|
|
|
|
|
758
|
|
4
|
|
|
|
|
|
|
|
5
|
31
|
|
|
31
|
|
12670
|
use Throwable::SugarFactory; |
|
31
|
|
|
|
|
1474841
|
|
|
31
|
|
|
|
|
226
|
|
6
|
31
|
|
|
31
|
|
24599
|
use Scalar::Util 'looks_like_number'; |
|
31
|
|
|
|
|
70
|
|
|
31
|
|
|
|
|
12064
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _Str { |
12
|
17
|
100
|
100
|
17
|
|
26814
|
die "attribute must be a string" |
13
|
|
|
|
|
|
|
if not defined $_[0] |
14
|
|
|
|
|
|
|
or ref( $_[0] ) ne ''; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _Num { |
18
|
5
|
100
|
100
|
5
|
|
333
|
die "attribute must be a number" |
19
|
|
|
|
|
|
|
if not defined $_[0] |
20
|
|
|
|
|
|
|
or not looks_like_number( $_[0] ); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
exception 'GenericError' => 'a generic error'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
exception |
27
|
|
|
|
|
|
|
InvalidFilename => 'file does not exist', |
28
|
|
|
|
|
|
|
has => [ |
29
|
|
|
|
|
|
|
name => ( |
30
|
|
|
|
|
|
|
is => 'ro', |
31
|
|
|
|
|
|
|
isa => \&_Str, |
32
|
|
|
|
|
|
|
), |
33
|
|
|
|
|
|
|
], |
34
|
|
|
|
|
|
|
extends => GenericError(); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
exception |
38
|
|
|
|
|
|
|
FileNotReadable => 'file is not readable', |
39
|
|
|
|
|
|
|
has => [ |
40
|
|
|
|
|
|
|
name => ( |
41
|
|
|
|
|
|
|
is => 'ro', |
42
|
|
|
|
|
|
|
isa => \&_Str, |
43
|
|
|
|
|
|
|
), |
44
|
|
|
|
|
|
|
], |
45
|
|
|
|
|
|
|
extends => GenericError(); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
exception |
49
|
|
|
|
|
|
|
FileNotPlainText => 'file is not a plain text file', |
50
|
|
|
|
|
|
|
has => [ |
51
|
|
|
|
|
|
|
name => ( |
52
|
|
|
|
|
|
|
is => 'ro', |
53
|
|
|
|
|
|
|
isa => \&_Str, |
54
|
|
|
|
|
|
|
), |
55
|
|
|
|
|
|
|
], |
56
|
|
|
|
|
|
|
has => [ |
57
|
|
|
|
|
|
|
mime_type => ( |
58
|
|
|
|
|
|
|
is => 'ro', |
59
|
|
|
|
|
|
|
default => undef, |
60
|
|
|
|
|
|
|
), |
61
|
|
|
|
|
|
|
], |
62
|
|
|
|
|
|
|
extends => GenericError(); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
exception |
66
|
|
|
|
|
|
|
UnexpectedEof => 'join_next cont. character in last line, unexpected EoF', |
67
|
|
|
|
|
|
|
has => [ |
68
|
|
|
|
|
|
|
discontd => ( |
69
|
|
|
|
|
|
|
is => 'ro', |
70
|
|
|
|
|
|
|
isa => \&_Str, |
71
|
|
|
|
|
|
|
), |
72
|
|
|
|
|
|
|
], |
73
|
|
|
|
|
|
|
has => [ |
74
|
|
|
|
|
|
|
line_num => ( |
75
|
|
|
|
|
|
|
is => 'ro', |
76
|
|
|
|
|
|
|
isa => \&_Num, |
77
|
|
|
|
|
|
|
), |
78
|
|
|
|
|
|
|
], |
79
|
|
|
|
|
|
|
extends => GenericError(); |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
exception |
83
|
|
|
|
|
|
|
UnexpectedCont => 'join_last cont. character on first line', |
84
|
|
|
|
|
|
|
has => [ |
85
|
|
|
|
|
|
|
line => ( |
86
|
|
|
|
|
|
|
is => 'ro', |
87
|
|
|
|
|
|
|
isa => \&_Str, |
88
|
|
|
|
|
|
|
), |
89
|
|
|
|
|
|
|
], |
90
|
|
|
|
|
|
|
extends => GenericError(); |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
exception ExAWK => 'a class of errors', extends => GenericError(); |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
exception |
97
|
|
|
|
|
|
|
BadRuleSyntax => 'Compilation error in reading syntax', |
98
|
|
|
|
|
|
|
has => [ |
99
|
|
|
|
|
|
|
code => ( |
100
|
|
|
|
|
|
|
is => 'ro', |
101
|
|
|
|
|
|
|
isa => \&_Str, |
102
|
|
|
|
|
|
|
), |
103
|
|
|
|
|
|
|
], |
104
|
|
|
|
|
|
|
has => [ |
105
|
|
|
|
|
|
|
msg => ( |
106
|
|
|
|
|
|
|
is => 'ro', |
107
|
|
|
|
|
|
|
isa => \&_Str, |
108
|
|
|
|
|
|
|
), |
109
|
|
|
|
|
|
|
], |
110
|
|
|
|
|
|
|
has => [ |
111
|
|
|
|
|
|
|
subroutine => ( |
112
|
|
|
|
|
|
|
is => 'ro', |
113
|
|
|
|
|
|
|
isa => \&_Str, |
114
|
|
|
|
|
|
|
), |
115
|
|
|
|
|
|
|
], |
116
|
|
|
|
|
|
|
extends => ExAWK(); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
exception |
120
|
|
|
|
|
|
|
IllegalRuleNoIfNoAct => 'Rule created without required components', |
121
|
|
|
|
|
|
|
extends => ExAWK(); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
exception |
125
|
|
|
|
|
|
|
IllegalRuleCont => |
126
|
|
|
|
|
|
|
'Rule cannot continue to next if action result is recorded', |
127
|
|
|
|
|
|
|
extends => ExAWK(); |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
exception |
131
|
|
|
|
|
|
|
RuleRunImproperly => 'run was called without a parser object', |
132
|
|
|
|
|
|
|
extends => ExAWK(); |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
__END__ |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=pod |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=encoding UTF-8 |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 NAME |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Text::Parser::Errors - Exceptions for Text::Parser |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 VERSION |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
version 0.927 |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 DESCRIPTION |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
This document contains a manifest of all the exception classes thrown by L<Text::Parser>. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 EXCEPTION CLASSES |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
All exceptions are derived from C<Text::Parser::Errors::GenericError>. They are all based on L<Throwable::SugarFactory> and so all the exception methods of those, such as C<L<error|Throwable::SugarFactory/error>>, C<L<namespace|Throwable::SugarFactory/namespace>>, etc., will be accessible. Read L<Exceptions> if you don't know about exceptions in Perl 5. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=head2 Input file related errors |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head3 C<Text::Parser::Errors::InvalidFilename> |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Thrown when file name specified to C<L<read|Text::Parser/read>> or C<L<filename|Text::Parser/filename>> is invalid. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=head4 Attributes |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=over 4 |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
B<name> - a string with the anticipated file name. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=back |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=head3 C<Text::Parser::Errors::FileNotReadable> |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
Thrown when file name specified to C<L<read|Text::Parser/read>> or C<L<filename|Text::Parser/filename>> has no read permissions or is unreadable for any other reason. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head4 Attributes |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=over 4 |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item * |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
B<name> - a string with the name of the file that could not be read |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=back |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head3 C<Text::Parser::Errors::FileNotPlainText> |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Thrown when file name specified to C<L<read|Text::Parser/read>> or C<L<filename|Text::Parser/filename>> is not a plain text file. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head4 Attributes |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=over 4 |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=item * |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
B<name> - a string with the name of the non-text input file |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=item * |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
B<mime_type> - C<undef> for now. This is reserved for future. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=back |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=head2 Errors in C<multiline_type> parsers |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=head3 C<Text::Parser::Errors::UnexpectedEof> |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
Thrown when a line continuation character indicates that the last line in the file is wrapped on to the next line. |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head4 Attributes |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=over 4 |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=item * |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
B<discontd> - a string containing the line with the continuation character. |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=item * |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
B<line_num> - line number at which the unexpected EOF is encountered. |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=back |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
=head3 C<Text::Parser::Errors::UnexpectedCont> |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
Thrown when a line continuation character on the first line indicates that it is a continuation of a previous line. |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=head4 Attributes |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=over 4 |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=item * |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
B<line> - a string containing the content of the line with the unexpected continuation character. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=back |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=head2 ExAWK rule syntax related |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
=head3 C<Text::Parser::Errors::ExAWK> |
244
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
All errors corresponding to the L<Text::Parser::Rule> class. |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=head3 C<Text::Parser::Errors::BadRuleSyntax> |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
Generated from L<Text::Parser::Rule> class constructor or from the accessors of C<condition>, C<action>, or the method C<add_precondition>, when the rule strings specified fail to compile properly. |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=head4 Attributes |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=over 4 |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=item * |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
B<code> - the original rule string |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=item * |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
B<msg> - content of C<$@> after C<eval> |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=item * |
264
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
B<subroutine> - stringified form of the subroutine generated from the given C<code>. |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=back |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
=head3 C<Text::Parser::Errors::IllegalRuleNoIfNoAct> |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
Generated from constructor of the L<Text::Parser::Rule> when the rule is created with neither a C<condition> nor an C<action> |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=head3 C<Text::Parser::Errors::IllegalRuleCont> |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
Generated when the rule option C<continue_to_next> of the L<Text::Parser::Rule> object is set true when C<dont_record> is false. |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=head3 C<Text::Parser::Errors::RuleRunImproperly> |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
Generated from C<run> method of L<Text::Parser::Rule> is called without an object of L<Text::Parser> as argument. |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=head1 SEE ALSO |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=over 4 |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=item * |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
L<Text::Parser> |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=item * |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
L<Text::Parser::Rule> |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=item * |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
L<Throwable::SugarFactory> |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=item * |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
L<Exceptions> |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
=back |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
=head1 BUGS |
304
|
|
|
|
|
|
|
|
305
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
306
|
|
|
|
|
|
|
L<http://github.com/balajirama/Text-Parser/issues> |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
309
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
310
|
|
|
|
|
|
|
feature. |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=head1 AUTHOR |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
Balaji Ramasubramanian <balajiram@cpan.org> |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
This software is copyright (c) 2018-2019 by Balaji Ramasubramanian. |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
321
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
322
|
|
|
|
|
|
|
|
323
|
|
|
|
|
|
|
=cut |
324
|
|
|
|
|
|
|
|