| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Parse::Gnaw::Blocks::LetterConstants; |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
19
|
|
|
19
|
|
111
|
use warnings; |
|
|
19
|
|
|
|
|
38
|
|
|
|
19
|
|
|
|
|
513
|
|
|
8
|
19
|
|
|
19
|
|
87
|
use strict; |
|
|
19
|
|
|
|
|
33
|
|
|
|
19
|
|
|
|
|
479
|
|
|
9
|
19
|
|
|
19
|
|
92
|
use Carp; |
|
|
19
|
|
|
|
|
32
|
|
|
|
19
|
|
|
|
|
1049
|
|
|
10
|
19
|
|
|
19
|
|
103
|
use Data::Dumper; |
|
|
19
|
|
|
|
|
39
|
|
|
|
19
|
|
|
|
|
890
|
|
|
11
|
19
|
|
|
19
|
|
1966
|
use Storable 'dclone'; |
|
|
19
|
|
|
|
|
7042
|
|
|
|
19
|
|
|
|
|
1381
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Parse::Gnaw::Blocks::LetterConstants - Hold subroutine/constants for Letter objects |
|
16
|
|
|
|
|
|
|
These are NOT contained in a separate package so that another file can use them and they automatically |
|
17
|
|
|
|
|
|
|
get imported into that package. |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Not in its own package namespace so that whoever uses it, sees all the functions. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head2 LETTER__LINKED_LIST |
|
23
|
|
|
|
|
|
|
This is a constant index into the object array for the LETTER__LINKED_LIST, the linked list object that holds this letter. |
|
24
|
|
|
|
|
|
|
=cut |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 LETTER__DATA_PAYLOAD |
|
27
|
|
|
|
|
|
|
This is a constant index into the object array for the LETTER__DATA_PAYLOAD, the data payload for this letter. |
|
28
|
|
|
|
|
|
|
assuming it is a single character. Will have to override and redefine a bunch of methods if |
|
29
|
|
|
|
|
|
|
you want it to be something else. |
|
30
|
|
|
|
|
|
|
First and Last letters use 'first' and 'last' as the payload. |
|
31
|
|
|
|
|
|
|
=cut |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 LETTER__CONNECTIONS |
|
34
|
|
|
|
|
|
|
This is a constant index into the object array for the LETTER__CONNECTIONS, the axis array which indicates |
|
35
|
|
|
|
|
|
|
the next and previous letters on each axis. Axis 0 might represent the "vertical" axis. |
|
36
|
|
|
|
|
|
|
Axis0->[0] would be up |
|
37
|
|
|
|
|
|
|
Axis0->[1] would be down. |
|
38
|
|
|
|
|
|
|
=cut |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 LETTER__NEXT_START |
|
41
|
|
|
|
|
|
|
This is a constant index into the object array for the LETTER__NEXT_START, the letter that would be the |
|
42
|
|
|
|
|
|
|
next "match" starting position after the current letter. |
|
43
|
|
|
|
|
|
|
=cut |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 LETTER__PREVIOUS_START |
|
46
|
|
|
|
|
|
|
This is a constant index into the object array for the LETTER__PREVIOUS_START, the letter that would be the |
|
47
|
|
|
|
|
|
|
previous "match" starting position before the current letter. |
|
48
|
|
|
|
|
|
|
=cut |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 LETTER__CAPTURE_COUNT |
|
51
|
|
|
|
|
|
|
This is a count of how many letters have been matched(captured) so far. |
|
52
|
|
|
|
|
|
|
=cut |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 LETTER__WHERE_LETTER_CAME_FROM |
|
56
|
|
|
|
|
|
|
This is a constant index into the object array for the LETTER__WHERE_LETTER_CAME_FROM, a string describing where |
|
57
|
|
|
|
|
|
|
this particular letter came from. |
|
58
|
|
|
|
|
|
|
=cut |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 LETTER__LETTER_HAS_BEEN_CONSUMED |
|
61
|
|
|
|
|
|
|
This is a constant index into the object array for the LETTER__LETTER_HAS_BEEN_CONSUMED flag, |
|
62
|
|
|
|
|
|
|
this is a boolean indicating whether this particular letter instance has been "consumed" by the grammar or not. |
|
63
|
|
|
|
|
|
|
=cut |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 LETTER__CONNECTION_NEXT |
|
67
|
|
|
|
|
|
|
Each index into the axis array contains a 2-dimensional array for next/prev values. |
|
68
|
|
|
|
|
|
|
Axis0->[0] would be up |
|
69
|
|
|
|
|
|
|
Axis0->[1] would be down. |
|
70
|
|
|
|
|
|
|
=cut |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 LETTER__CONNECTION_PREV |
|
73
|
|
|
|
|
|
|
Each index into the axis array contains a 2-dimensional array for next/prev values. |
|
74
|
|
|
|
|
|
|
Axis0->[0] would be up |
|
75
|
|
|
|
|
|
|
Axis0->[1] would be down. |
|
76
|
|
|
|
|
|
|
=cut |
|
77
|
|
|
|
|
|
|
|
|
78
|
19
|
|
|
19
|
|
105
|
use Exporter 'import'; |
|
|
19
|
|
|
|
|
32
|
|
|
|
19
|
|
|
|
|
3942
|
|
|
79
|
|
|
|
|
|
|
our @EXPORT = qw(LETTER__LINKED_LIST LETTER__DATA_PAYLOAD LETTER__CONNECTIONS LETTER__NEXT_START |
|
80
|
|
|
|
|
|
|
LETTER__PREVIOUS_START LETTER__WHERE_LETTER_CAME_FROM LETTER__CONNECTION_PREV LETTER__CONNECTION_NEXT LETTER__LETTER_HAS_BEEN_CONSUMED ); |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
####################################################### |
|
83
|
|
|
|
|
|
|
# this is how you do constants in perl, subroutines with just a number, |
|
84
|
|
|
|
|
|
|
# so they get optimized out into plain old fashioned numbers. |
|
85
|
|
|
|
|
|
|
####################################################### |
|
86
|
|
|
|
|
|
|
sub LETTER__LINKED_LIST (){0} # the linked-list that contains this letter. |
|
87
|
|
|
|
|
|
|
sub LETTER__DATA_PAYLOAD (){1} # the letter/payload |
|
88
|
|
|
|
|
|
|
sub LETTER__CONNECTIONS (){2} # an array of all possible axis/LETTER__CONNECTIONS |
|
89
|
|
|
|
|
|
|
sub LETTER__NEXT_START (){3} # next start position |
|
90
|
|
|
|
|
|
|
sub LETTER__PREVIOUS_START (){4} # previous start positoin |
|
91
|
|
|
|
|
|
|
sub LETTER__CAPTURE_COUNT (){5} # a count of how many times this letter is captured as part of the matching pattern. |
|
92
|
|
|
|
|
|
|
sub LETTER__WHERE_LETTER_CAME_FROM (){6} # string describing where the letter came from |
|
93
|
|
|
|
|
|
|
sub LETTER__LETTER_HAS_BEEN_CONSUMED (){7} # when we advance to next letter, set this to zero. When we finally match this letter and want to advance pointer again, set this to 1. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub LETTER__CONNECTION_PREV (){1} # prev connection in axis array, i.e. vertical axis->prev==up |
|
97
|
|
|
|
|
|
|
sub LETTER__CONNECTION_NEXT (){0} # next connection in axis array, i.e. vertical axis->next==down |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
1; |
|
103
|
|
|
|
|
|
|
|