| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#################################################################### |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# This file was generated using Parse::Yapp version 1.05. |
|
4
|
|
|
|
|
|
|
# |
|
5
|
|
|
|
|
|
|
# Don't edit this file, use source file instead. |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
# ANY CHANGE MADE HERE WILL BE LOST ! |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
#################################################################### |
|
10
|
|
|
|
|
|
|
package Text::Spintax::grammar; |
|
11
|
2
|
|
|
2
|
|
7
|
use vars qw ( @ISA ); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
88
|
|
|
12
|
2
|
|
|
2
|
|
7
|
use strict; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
120
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
@ISA= qw ( Text::Spintax::Parse::Yapp::Driver ); |
|
15
|
|
|
|
|
|
|
#Included Parse/Yapp/Driver.pm file---------------------------------------- |
|
16
|
|
|
|
|
|
|
{ |
|
17
|
|
|
|
|
|
|
# |
|
18
|
|
|
|
|
|
|
# Module Parse::Yapp::Driver |
|
19
|
|
|
|
|
|
|
# |
|
20
|
|
|
|
|
|
|
# This module is part of the Parse::Yapp package available on your |
|
21
|
|
|
|
|
|
|
# nearest CPAN |
|
22
|
|
|
|
|
|
|
# |
|
23
|
|
|
|
|
|
|
# Any use of this module in a standalone parser make the included |
|
24
|
|
|
|
|
|
|
# text under the same copyright as the Parse::Yapp module itself. |
|
25
|
|
|
|
|
|
|
# |
|
26
|
|
|
|
|
|
|
# This notice should remain unchanged. |
|
27
|
|
|
|
|
|
|
# |
|
28
|
|
|
|
|
|
|
# (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved. |
|
29
|
|
|
|
|
|
|
# (see the pod text in Parse::Yapp module for use and distribution rights) |
|
30
|
|
|
|
|
|
|
# |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
package Text::Spintax::Parse::Yapp::Driver; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
require 5.004; |
|
35
|
|
|
|
|
|
|
|
|
36
|
2
|
|
|
2
|
|
7
|
use strict; |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
50
|
|
|
37
|
|
|
|
|
|
|
|
|
38
|
2
|
|
|
2
|
|
6
|
use vars qw ( $VERSION $COMPATIBLE $FILENAME ); |
|
|
2
|
|
|
|
|
2
|
|
|
|
2
|
|
|
|
|
109
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
$VERSION = '1.05'; |
|
41
|
|
|
|
|
|
|
$COMPATIBLE = '0.07'; |
|
42
|
|
|
|
|
|
|
$FILENAME=__FILE__; |
|
43
|
|
|
|
|
|
|
|
|
44
|
2
|
|
|
2
|
|
7
|
use Carp; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
1537
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
#Known parameters, all starting with YY (leading YY will be discarded) |
|
47
|
|
|
|
|
|
|
my(%params)=(YYLEX => 'CODE', 'YYERROR' => 'CODE', YYVERSION => '', |
|
48
|
|
|
|
|
|
|
YYRULES => 'ARRAY', YYSTATES => 'ARRAY', YYDEBUG => ''); |
|
49
|
|
|
|
|
|
|
#Mandatory parameters |
|
50
|
|
|
|
|
|
|
my(@params)=('LEX','RULES','STATES'); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub new { |
|
53
|
1
|
|
|
1
|
|
4
|
my($class)=shift; |
|
54
|
1
|
|
|
|
|
1
|
my($errst,$nberr,$token,$value,$check,$dotpos); |
|
55
|
1
|
|
|
|
|
10
|
my($self)={ ERROR => \&_Error, |
|
56
|
|
|
|
|
|
|
ERRST => \$errst, |
|
57
|
|
|
|
|
|
|
NBERR => \$nberr, |
|
58
|
|
|
|
|
|
|
TOKEN => \$token, |
|
59
|
|
|
|
|
|
|
VALUE => \$value, |
|
60
|
|
|
|
|
|
|
DOTPOS => \$dotpos, |
|
61
|
|
|
|
|
|
|
STACK => [], |
|
62
|
|
|
|
|
|
|
DEBUG => 0, |
|
63
|
|
|
|
|
|
|
CHECK => \$check }; |
|
64
|
|
|
|
|
|
|
|
|
65
|
1
|
|
|
|
|
5
|
_CheckParams( [], \%params, \@_, $self ); |
|
66
|
|
|
|
|
|
|
|
|
67
|
1
|
50
|
33
|
|
|
11
|
exists($$self{VERSION}) |
|
68
|
|
|
|
|
|
|
and $$self{VERSION} < $COMPATIBLE |
|
69
|
|
|
|
|
|
|
and croak "Yapp driver version $VERSION ". |
|
70
|
|
|
|
|
|
|
"incompatible with version $$self{VERSION}:\n". |
|
71
|
|
|
|
|
|
|
"Please recompile parser module."; |
|
72
|
|
|
|
|
|
|
|
|
73
|
1
|
50
|
|
|
|
3
|
ref($class) |
|
74
|
|
|
|
|
|
|
and $class=ref($class); |
|
75
|
|
|
|
|
|
|
|
|
76
|
1
|
|
|
|
|
4
|
bless($self,$class); |
|
77
|
|
|
|
|
|
|
} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub YYParse { |
|
80
|
1
|
|
|
1
|
|
3
|
my($self)=shift; |
|
81
|
1
|
|
|
|
|
1
|
my($retval); |
|
82
|
|
|
|
|
|
|
|
|
83
|
1
|
|
|
|
|
4
|
_CheckParams( \@params, \%params, \@_, $self ); |
|
84
|
|
|
|
|
|
|
|
|
85
|
1
|
50
|
|
|
|
3
|
if($$self{DEBUG}) { |
|
86
|
0
|
|
|
|
|
0
|
_DBLoad(); |
|
87
|
0
|
|
|
|
|
0
|
$retval = eval '$self->_DBParse()';#Do not create stab entry on compile |
|
88
|
0
|
0
|
|
|
|
0
|
$@ and die $@; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
else { |
|
91
|
1
|
|
|
|
|
7
|
$retval = $self->_Parse(); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
1
|
|
|
|
|
2
|
$retval |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub YYData { |
|
97
|
42
|
|
|
42
|
|
115
|
my($self)=shift; |
|
98
|
|
|
|
|
|
|
|
|
99
|
42
|
100
|
|
|
|
73
|
exists($$self{USER}) |
|
100
|
|
|
|
|
|
|
or $$self{USER}={}; |
|
101
|
|
|
|
|
|
|
|
|
102
|
42
|
|
|
|
|
115
|
$$self{USER}; |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
sub YYErrok { |
|
107
|
0
|
|
|
0
|
|
0
|
my($self)=shift; |
|
108
|
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
0
|
${$$self{ERRST}}=0; |
|
|
0
|
|
|
|
|
0
|
|
|
110
|
0
|
|
|
|
|
0
|
undef; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub YYNberr { |
|
114
|
0
|
|
|
0
|
|
0
|
my($self)=shift; |
|
115
|
|
|
|
|
|
|
|
|
116
|
0
|
|
|
|
|
0
|
${$$self{NBERR}}; |
|
|
0
|
|
|
|
|
0
|
|
|
117
|
|
|
|
|
|
|
} |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
sub YYRecovering { |
|
120
|
0
|
|
|
0
|
|
0
|
my($self)=shift; |
|
121
|
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
0
|
${$$self{ERRST}} != 0; |
|
|
0
|
|
|
|
|
0
|
|
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub YYAbort { |
|
126
|
0
|
|
|
0
|
|
0
|
my($self)=shift; |
|
127
|
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
0
|
${$$self{CHECK}}='ABORT'; |
|
|
0
|
|
|
|
|
0
|
|
|
129
|
0
|
|
|
|
|
0
|
undef; |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub YYAccept { |
|
133
|
1
|
|
|
1
|
|
2
|
my($self)=shift; |
|
134
|
|
|
|
|
|
|
|
|
135
|
1
|
|
|
|
|
1
|
${$$self{CHECK}}='ACCEPT'; |
|
|
1
|
|
|
|
|
2
|
|
|
136
|
1
|
|
|
|
|
2
|
undef; |
|
137
|
|
|
|
|
|
|
} |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub YYError { |
|
140
|
0
|
|
|
0
|
|
0
|
my($self)=shift; |
|
141
|
|
|
|
|
|
|
|
|
142
|
0
|
|
|
|
|
0
|
${$$self{CHECK}}='ERROR'; |
|
|
0
|
|
|
|
|
0
|
|
|
143
|
0
|
|
|
|
|
0
|
undef; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
sub YYSemval { |
|
147
|
0
|
|
|
0
|
|
0
|
my($self)=shift; |
|
148
|
0
|
|
|
|
|
0
|
my($index)= $_[0] - ${$$self{DOTPOS}} - 1; |
|
|
0
|
|
|
|
|
0
|
|
|
149
|
|
|
|
|
|
|
|
|
150
|
0
|
|
|
|
|
0
|
$index < 0 |
|
151
|
0
|
0
|
0
|
|
|
0
|
and -$index <= @{$$self{STACK}} |
|
152
|
|
|
|
|
|
|
and return $$self{STACK}[$index][1]; |
|
153
|
|
|
|
|
|
|
|
|
154
|
0
|
|
|
|
|
0
|
undef; #Invalid index |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub YYCurtok { |
|
158
|
0
|
|
|
0
|
|
0
|
my($self)=shift; |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
@_ |
|
161
|
0
|
0
|
|
|
|
0
|
and ${$$self{TOKEN}}=$_[0]; |
|
|
0
|
|
|
|
|
0
|
|
|
162
|
0
|
|
|
|
|
0
|
${$$self{TOKEN}}; |
|
|
0
|
|
|
|
|
0
|
|
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub YYCurval { |
|
166
|
0
|
|
|
0
|
|
0
|
my($self)=shift; |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
@_ |
|
169
|
0
|
0
|
|
|
|
0
|
and ${$$self{VALUE}}=$_[0]; |
|
|
0
|
|
|
|
|
0
|
|
|
170
|
0
|
|
|
|
|
0
|
${$$self{VALUE}}; |
|
|
0
|
|
|
|
|
0
|
|
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
sub YYExpect { |
|
174
|
0
|
|
|
0
|
|
0
|
my($self)=shift; |
|
175
|
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
0
|
keys %{$self->{STATES}[$self->{STACK}[-1][0]]{ACTIONS}} |
|
|
0
|
|
|
|
|
0
|
|
|
177
|
|
|
|
|
|
|
} |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
sub YYLexer { |
|
180
|
0
|
|
|
0
|
|
0
|
my($self)=shift; |
|
181
|
|
|
|
|
|
|
|
|
182
|
0
|
|
|
|
|
0
|
$$self{LEX}; |
|
183
|
|
|
|
|
|
|
} |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
################# |
|
187
|
|
|
|
|
|
|
# Private stuff # |
|
188
|
|
|
|
|
|
|
################# |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub _CheckParams { |
|
192
|
2
|
|
|
2
|
|
3
|
my($mandatory,$checklist,$inarray,$outhash)=@_; |
|
193
|
2
|
|
|
|
|
3
|
my($prm,$value); |
|
194
|
2
|
|
|
|
|
3
|
my($prmlst)={}; |
|
195
|
|
|
|
|
|
|
|
|
196
|
2
|
|
|
|
|
8
|
while(($prm,$value)=splice(@$inarray,0,2)) { |
|
197
|
5
|
|
|
|
|
6
|
$prm=uc($prm); |
|
198
|
5
|
50
|
|
|
|
11
|
exists($$checklist{$prm}) |
|
199
|
|
|
|
|
|
|
or croak("Unknow parameter '$prm'"); |
|
200
|
5
|
50
|
|
|
|
12
|
ref($value) eq $$checklist{$prm} |
|
201
|
|
|
|
|
|
|
or croak("Invalid value for parameter '$prm'"); |
|
202
|
5
|
|
|
|
|
15
|
$prm=unpack('@2A*',$prm); |
|
203
|
5
|
|
|
|
|
15
|
$$outhash{$prm}=$value; |
|
204
|
|
|
|
|
|
|
} |
|
205
|
2
|
|
|
|
|
5
|
for (@$mandatory) { |
|
206
|
3
|
50
|
|
|
|
7
|
exists($$outhash{$_}) |
|
207
|
|
|
|
|
|
|
or croak("Missing mandatory parameter '".lc($_)."'"); |
|
208
|
|
|
|
|
|
|
} |
|
209
|
|
|
|
|
|
|
} |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
sub _Error { |
|
212
|
0
|
|
|
0
|
|
0
|
print "Parse error.\n"; |
|
213
|
|
|
|
|
|
|
} |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
sub _DBLoad { |
|
216
|
|
|
|
|
|
|
{ |
|
217
|
2
|
|
|
2
|
|
10
|
no strict 'refs'; |
|
|
2
|
|
|
0
|
|
2
|
|
|
|
2
|
|
|
|
|
2048
|
|
|
|
0
|
|
|
|
|
0
|
|
|
218
|
|
|
|
|
|
|
|
|
219
|
0
|
0
|
|
|
|
0
|
exists(${__PACKAGE__.'::'}{_DBParse})#Already loaded ? |
|
|
0
|
|
|
|
|
0
|
|
|
220
|
|
|
|
|
|
|
and return; |
|
221
|
|
|
|
|
|
|
} |
|
222
|
0
|
|
|
|
|
0
|
my($fname)=__FILE__; |
|
223
|
0
|
|
|
|
|
0
|
my(@drv); |
|
224
|
0
|
0
|
|
|
|
0
|
open(DRV,"<$fname") or die "Report this as a BUG: Cannot open $fname"; |
|
225
|
0
|
|
|
|
|
0
|
while() { |
|
226
|
|
|
|
|
|
|
/^\s*sub\s+_Parse\s*{\s*$/ .. /^\s*}\s*#\s*_Parse\s*$/ |
|
227
|
0
|
0
|
|
|
|
0
|
and do { |
|
228
|
0
|
|
|
|
|
0
|
s/^#DBG>//; |
|
229
|
0
|
|
|
|
|
0
|
push(@drv,$_); |
|
230
|
|
|
|
|
|
|
} |
|
231
|
|
|
|
|
|
|
} |
|
232
|
0
|
|
|
|
|
0
|
close(DRV); |
|
233
|
|
|
|
|
|
|
|
|
234
|
0
|
|
|
|
|
0
|
$drv[0]=~s/_P/_DBP/; |
|
235
|
0
|
|
|
|
|
0
|
eval join('',@drv); |
|
236
|
|
|
|
|
|
|
} |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
#Note that for loading debugging version of the driver, |
|
239
|
|
|
|
|
|
|
#this file will be parsed from 'sub _Parse' up to '}#_Parse' inclusive. |
|
240
|
|
|
|
|
|
|
#So, DO NOT remove comment at end of sub !!! |
|
241
|
|
|
|
|
|
|
sub _Parse { |
|
242
|
1
|
|
|
1
|
|
2
|
my($self)=shift; |
|
243
|
|
|
|
|
|
|
|
|
244
|
1
|
|
|
|
|
4
|
my($rules,$states,$lex,$error) |
|
245
|
|
|
|
|
|
|
= @$self{ 'RULES', 'STATES', 'LEX', 'ERROR' }; |
|
246
|
1
|
|
|
|
|
3
|
my($errstatus,$nberror,$token,$value,$stack,$check,$dotpos) |
|
247
|
|
|
|
|
|
|
= @$self{ 'ERRST', 'NBERR', 'TOKEN', 'VALUE', 'STACK', 'CHECK', 'DOTPOS' }; |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
#DBG> my($debug)=$$self{DEBUG}; |
|
250
|
|
|
|
|
|
|
#DBG> my($dbgerror)=0; |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
#DBG> my($ShowCurToken) = sub { |
|
253
|
|
|
|
|
|
|
#DBG> my($tok)='>'; |
|
254
|
|
|
|
|
|
|
#DBG> for (split('',$$token)) { |
|
255
|
|
|
|
|
|
|
#DBG> $tok.= (ord($_) < 32 or ord($_) > 126) |
|
256
|
|
|
|
|
|
|
#DBG> ? sprintf('<%02X>',ord($_)) |
|
257
|
|
|
|
|
|
|
#DBG> : $_; |
|
258
|
|
|
|
|
|
|
#DBG> } |
|
259
|
|
|
|
|
|
|
#DBG> $tok.='<'; |
|
260
|
|
|
|
|
|
|
#DBG> }; |
|
261
|
|
|
|
|
|
|
|
|
262
|
1
|
|
|
|
|
6
|
$$errstatus=0; |
|
263
|
1
|
|
|
|
|
1
|
$$nberror=0; |
|
264
|
1
|
|
|
|
|
3
|
($$token,$$value)=(undef,undef); |
|
265
|
1
|
|
|
|
|
3
|
@$stack=( [ 0, undef ] ); |
|
266
|
1
|
|
|
|
|
2
|
$$check=''; |
|
267
|
|
|
|
|
|
|
|
|
268
|
1
|
|
|
|
|
2
|
while(1) { |
|
269
|
33
|
|
|
|
|
23
|
my($actions,$act,$stateno); |
|
270
|
|
|
|
|
|
|
|
|
271
|
33
|
|
|
|
|
63
|
$stateno=$$stack[-1][0]; |
|
272
|
33
|
|
|
|
|
28
|
$actions=$$states[$stateno]; |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
#DBG> print STDERR ('-' x 40),"\n"; |
|
275
|
|
|
|
|
|
|
#DBG> $debug & 0x2 |
|
276
|
|
|
|
|
|
|
#DBG> and print STDERR "In state $stateno:\n"; |
|
277
|
|
|
|
|
|
|
#DBG> $debug & 0x08 |
|
278
|
|
|
|
|
|
|
#DBG> and print STDERR "Stack:[". |
|
279
|
|
|
|
|
|
|
#DBG> join(',',map { $$_[0] } @$stack). |
|
280
|
|
|
|
|
|
|
#DBG> "]\n"; |
|
281
|
|
|
|
|
|
|
|
|
282
|
|
|
|
|
|
|
|
|
283
|
33
|
100
|
|
|
|
48
|
if (exists($$actions{ACTIONS})) { |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
defined($$token) |
|
286
|
8
|
50
|
|
|
|
14
|
or do { |
|
287
|
8
|
|
|
|
|
19
|
($$token,$$value)=&$lex($self); |
|
288
|
|
|
|
|
|
|
#DBG> $debug & 0x01 |
|
289
|
|
|
|
|
|
|
#DBG> and print STDERR "Need token. Got ".&$ShowCurToken."\n"; |
|
290
|
|
|
|
|
|
|
}; |
|
291
|
|
|
|
|
|
|
|
|
292
|
8
|
0
|
|
|
|
59
|
$act= exists($$actions{ACTIONS}{$$token}) |
|
|
|
50
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
? $$actions{ACTIONS}{$$token} |
|
294
|
|
|
|
|
|
|
: exists($$actions{DEFAULT}) |
|
295
|
|
|
|
|
|
|
? $$actions{DEFAULT} |
|
296
|
|
|
|
|
|
|
: undef; |
|
297
|
|
|
|
|
|
|
} |
|
298
|
|
|
|
|
|
|
else { |
|
299
|
25
|
|
|
|
|
28
|
$act=$$actions{DEFAULT}; |
|
300
|
|
|
|
|
|
|
#DBG> $debug & 0x01 |
|
301
|
|
|
|
|
|
|
#DBG> and print STDERR "Don't need token.\n"; |
|
302
|
|
|
|
|
|
|
} |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
defined($act) |
|
305
|
33
|
50
|
|
|
|
49
|
and do { |
|
306
|
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
$act > 0 |
|
308
|
33
|
100
|
|
|
|
45
|
and do { #shift |
|
309
|
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
#DBG> $debug & 0x04 |
|
311
|
|
|
|
|
|
|
#DBG> and print STDERR "Shift and go to state $act.\n"; |
|
312
|
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
$$errstatus |
|
314
|
8
|
50
|
|
|
|
12
|
and do { |
|
315
|
0
|
|
|
|
|
0
|
--$$errstatus; |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
#DBG> $debug & 0x10 |
|
318
|
|
|
|
|
|
|
#DBG> and $dbgerror |
|
319
|
|
|
|
|
|
|
#DBG> and $$errstatus == 0 |
|
320
|
|
|
|
|
|
|
#DBG> and do { |
|
321
|
|
|
|
|
|
|
#DBG> print STDERR "**End of Error recovery.\n"; |
|
322
|
|
|
|
|
|
|
#DBG> $dbgerror=0; |
|
323
|
|
|
|
|
|
|
#DBG> }; |
|
324
|
|
|
|
|
|
|
}; |
|
325
|
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
|
|
327
|
8
|
|
|
|
|
16
|
push(@$stack,[ $act, $$value ]); |
|
328
|
|
|
|
|
|
|
|
|
329
|
8
|
100
|
|
|
|
18
|
$$token ne '' #Don't eat the eof |
|
330
|
|
|
|
|
|
|
and $$token=$$value=undef; |
|
331
|
8
|
|
|
|
|
11
|
next; |
|
332
|
|
|
|
|
|
|
}; |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
#reduce |
|
335
|
25
|
|
|
|
|
20
|
my($lhs,$len,$code,@sempar,$semval); |
|
336
|
25
|
|
|
|
|
23
|
($lhs,$len,$code)=@{$$rules[-$act]}; |
|
|
25
|
|
|
|
|
35
|
|
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
#DBG> $debug & 0x04 |
|
339
|
|
|
|
|
|
|
#DBG> and $act |
|
340
|
|
|
|
|
|
|
#DBG> and print STDERR "Reduce using rule ".-$act." ($lhs,$len): "; |
|
341
|
|
|
|
|
|
|
|
|
342
|
25
|
100
|
|
|
|
49
|
$act |
|
343
|
|
|
|
|
|
|
or $self->YYAccept(); |
|
344
|
|
|
|
|
|
|
|
|
345
|
25
|
|
|
|
|
19
|
$$dotpos=$len; |
|
346
|
|
|
|
|
|
|
|
|
347
|
|
|
|
|
|
|
unpack('A1',$lhs) eq '@' #In line rule |
|
348
|
25
|
50
|
|
|
|
62
|
and do { |
|
349
|
0
|
0
|
|
|
|
0
|
$lhs =~ /^\@[0-9]+\-([0-9]+)$/ |
|
350
|
|
|
|
|
|
|
or die "In line rule name '$lhs' ill formed: ". |
|
351
|
|
|
|
|
|
|
"report it as a BUG.\n"; |
|
352
|
0
|
|
|
|
|
0
|
$$dotpos = $1; |
|
353
|
|
|
|
|
|
|
}; |
|
354
|
|
|
|
|
|
|
|
|
355
|
32
|
|
|
|
|
51
|
@sempar = $$dotpos |
|
356
|
25
|
100
|
|
|
|
53
|
? map { $$_[1] } @$stack[ -$$dotpos .. -1 ] |
|
357
|
|
|
|
|
|
|
: (); |
|
358
|
|
|
|
|
|
|
|
|
359
|
25
|
100
|
|
|
|
58
|
$semval = $code ? &$code( $self, @sempar ) |
|
|
|
100
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
: @sempar ? $sempar[0] : undef; |
|
361
|
|
|
|
|
|
|
|
|
362
|
25
|
|
|
|
|
33
|
splice(@$stack,-$len,$len); |
|
363
|
|
|
|
|
|
|
|
|
364
|
|
|
|
|
|
|
$$check eq 'ACCEPT' |
|
365
|
25
|
100
|
|
|
|
43
|
and do { |
|
366
|
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
#DBG> $debug & 0x04 |
|
368
|
|
|
|
|
|
|
#DBG> and print STDERR "Accept.\n"; |
|
369
|
|
|
|
|
|
|
|
|
370
|
1
|
|
|
|
|
3
|
return($semval); |
|
371
|
|
|
|
|
|
|
}; |
|
372
|
|
|
|
|
|
|
|
|
373
|
|
|
|
|
|
|
$$check eq 'ABORT' |
|
374
|
24
|
50
|
|
|
|
40
|
and do { |
|
375
|
|
|
|
|
|
|
|
|
376
|
|
|
|
|
|
|
#DBG> $debug & 0x04 |
|
377
|
|
|
|
|
|
|
#DBG> and print STDERR "Abort.\n"; |
|
378
|
|
|
|
|
|
|
|
|
379
|
0
|
|
|
|
|
0
|
return(undef); |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
}; |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
#DBG> $debug & 0x04 |
|
384
|
|
|
|
|
|
|
#DBG> and print STDERR "Back to state $$stack[-1][0], then "; |
|
385
|
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
$$check eq 'ERROR' |
|
387
|
24
|
50
|
|
|
|
34
|
or do { |
|
388
|
|
|
|
|
|
|
#DBG> $debug & 0x04 |
|
389
|
|
|
|
|
|
|
#DBG> and print STDERR |
|
390
|
|
|
|
|
|
|
#DBG> "go to state $$states[$$stack[-1][0]]{GOTOS}{$lhs}.\n"; |
|
391
|
|
|
|
|
|
|
|
|
392
|
|
|
|
|
|
|
#DBG> $debug & 0x10 |
|
393
|
|
|
|
|
|
|
#DBG> and $dbgerror |
|
394
|
|
|
|
|
|
|
#DBG> and $$errstatus == 0 |
|
395
|
|
|
|
|
|
|
#DBG> and do { |
|
396
|
|
|
|
|
|
|
#DBG> print STDERR "**End of Error recovery.\n"; |
|
397
|
|
|
|
|
|
|
#DBG> $dbgerror=0; |
|
398
|
|
|
|
|
|
|
#DBG> }; |
|
399
|
|
|
|
|
|
|
|
|
400
|
24
|
|
|
|
|
44
|
push(@$stack, |
|
401
|
|
|
|
|
|
|
[ $$states[$$stack[-1][0]]{GOTOS}{$lhs}, $semval ]); |
|
402
|
24
|
|
|
|
|
24
|
$$check=''; |
|
403
|
24
|
|
|
|
|
39
|
next; |
|
404
|
|
|
|
|
|
|
}; |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
#DBG> $debug & 0x04 |
|
407
|
|
|
|
|
|
|
#DBG> and print STDERR "Forced Error recovery.\n"; |
|
408
|
|
|
|
|
|
|
|
|
409
|
0
|
|
|
|
|
|
$$check=''; |
|
410
|
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
}; |
|
412
|
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
#Error |
|
414
|
|
|
|
|
|
|
$$errstatus |
|
415
|
0
|
0
|
|
|
|
|
or do { |
|
416
|
|
|
|
|
|
|
|
|
417
|
0
|
|
|
|
|
|
$$errstatus = 1; |
|
418
|
0
|
|
|
|
|
|
&$error($self); |
|
419
|
0
|
0
|
|
|
|
|
$$errstatus # if 0, then YYErrok has been called |
|
420
|
|
|
|
|
|
|
or next; # so continue parsing |
|
421
|
|
|
|
|
|
|
|
|
422
|
|
|
|
|
|
|
#DBG> $debug & 0x10 |
|
423
|
|
|
|
|
|
|
#DBG> and do { |
|
424
|
|
|
|
|
|
|
#DBG> print STDERR "**Entering Error recovery.\n"; |
|
425
|
|
|
|
|
|
|
#DBG> ++$dbgerror; |
|
426
|
|
|
|
|
|
|
#DBG> }; |
|
427
|
|
|
|
|
|
|
|
|
428
|
0
|
|
|
|
|
|
++$$nberror; |
|
429
|
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
}; |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
$$errstatus == 3 #The next token is not valid: discard it |
|
433
|
0
|
0
|
|
|
|
|
and do { |
|
434
|
|
|
|
|
|
|
$$token eq '' # End of input: no hope |
|
435
|
0
|
0
|
|
|
|
|
and do { |
|
436
|
|
|
|
|
|
|
#DBG> $debug & 0x10 |
|
437
|
|
|
|
|
|
|
#DBG> and print STDERR "**At eof: aborting.\n"; |
|
438
|
0
|
|
|
|
|
|
return(undef); |
|
439
|
|
|
|
|
|
|
}; |
|
440
|
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
#DBG> $debug & 0x10 |
|
442
|
|
|
|
|
|
|
#DBG> and print STDERR "**Dicard invalid token ".&$ShowCurToken.".\n"; |
|
443
|
|
|
|
|
|
|
|
|
444
|
0
|
|
|
|
|
|
$$token=$$value=undef; |
|
445
|
|
|
|
|
|
|
}; |
|
446
|
|
|
|
|
|
|
|
|
447
|
0
|
|
|
|
|
|
$$errstatus=3; |
|
448
|
|
|
|
|
|
|
|
|
449
|
0
|
|
0
|
|
|
|
while( @$stack |
|
|
|
|
0
|
|
|
|
|
|
450
|
|
|
|
|
|
|
and ( not exists($$states[$$stack[-1][0]]{ACTIONS}) |
|
451
|
|
|
|
|
|
|
or not exists($$states[$$stack[-1][0]]{ACTIONS}{error}) |
|
452
|
|
|
|
|
|
|
or $$states[$$stack[-1][0]]{ACTIONS}{error} <= 0)) { |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
#DBG> $debug & 0x10 |
|
455
|
|
|
|
|
|
|
#DBG> and print STDERR "**Pop state $$stack[-1][0].\n"; |
|
456
|
|
|
|
|
|
|
|
|
457
|
0
|
|
|
|
|
|
pop(@$stack); |
|
458
|
|
|
|
|
|
|
} |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
@$stack |
|
461
|
0
|
0
|
|
|
|
|
or do { |
|
462
|
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
#DBG> $debug & 0x10 |
|
464
|
|
|
|
|
|
|
#DBG> and print STDERR "**No state left on stack: aborting.\n"; |
|
465
|
|
|
|
|
|
|
|
|
466
|
0
|
|
|
|
|
|
return(undef); |
|
467
|
|
|
|
|
|
|
}; |
|
468
|
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
#shift the error token |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
#DBG> $debug & 0x10 |
|
472
|
|
|
|
|
|
|
#DBG> and print STDERR "**Shift \$error token and go to state ". |
|
473
|
|
|
|
|
|
|
#DBG> $$states[$$stack[-1][0]]{ACTIONS}{error}. |
|
474
|
|
|
|
|
|
|
#DBG> ".\n"; |
|
475
|
|
|
|
|
|
|
|
|
476
|
0
|
|
|
|
|
|
push(@$stack, [ $$states[$$stack[-1][0]]{ACTIONS}{error}, undef ]); |
|
477
|
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
} |
|
479
|
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
#never reached |
|
481
|
0
|
|
|
|
|
|
croak("Error in driver logic. Please, report it as a BUG"); |
|
482
|
|
|
|
|
|
|
|
|
483
|
|
|
|
|
|
|
}#_Parse |
|
484
|
|
|
|
|
|
|
#DO NOT remove comment |
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
1; |
|
487
|
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
} |
|
489
|
|
|
|
|
|
|
#End of include-------------------------------------------------- |
|
490
|
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
#line 1 "lib/Text/Spintax/grammar.yp" |
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
# header code goes here |
|
495
|
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
sub new { |
|
498
|
|
|
|
|
|
|
my($class)=shift; |
|
499
|
|
|
|
|
|
|
ref($class) |
|
500
|
|
|
|
|
|
|
and $class=ref($class); |
|
501
|
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
my($self)=$class->SUPER::new( yyversion => '1.05', |
|
503
|
|
|
|
|
|
|
yystates => |
|
504
|
|
|
|
|
|
|
[ |
|
505
|
|
|
|
|
|
|
{#State 0 |
|
506
|
|
|
|
|
|
|
DEFAULT => -11, |
|
507
|
|
|
|
|
|
|
GOTOS => { |
|
508
|
|
|
|
|
|
|
'elements' => 1 |
|
509
|
|
|
|
|
|
|
} |
|
510
|
|
|
|
|
|
|
}, |
|
511
|
|
|
|
|
|
|
{#State 1 |
|
512
|
|
|
|
|
|
|
ACTIONS => { |
|
513
|
|
|
|
|
|
|
'' => 3, |
|
514
|
|
|
|
|
|
|
'TEXT' => 2, |
|
515
|
|
|
|
|
|
|
'OBRACE' => 4 |
|
516
|
|
|
|
|
|
|
}, |
|
517
|
|
|
|
|
|
|
GOTOS => { |
|
518
|
|
|
|
|
|
|
'text' => 5, |
|
519
|
|
|
|
|
|
|
'parser_spin' => 6, |
|
520
|
|
|
|
|
|
|
'element' => 8, |
|
521
|
|
|
|
|
|
|
'obrace' => 7 |
|
522
|
|
|
|
|
|
|
} |
|
523
|
|
|
|
|
|
|
}, |
|
524
|
|
|
|
|
|
|
{#State 2 |
|
525
|
|
|
|
|
|
|
DEFAULT => -1 |
|
526
|
|
|
|
|
|
|
}, |
|
527
|
|
|
|
|
|
|
{#State 3 |
|
528
|
|
|
|
|
|
|
DEFAULT => 0 |
|
529
|
|
|
|
|
|
|
}, |
|
530
|
|
|
|
|
|
|
{#State 4 |
|
531
|
|
|
|
|
|
|
DEFAULT => -6 |
|
532
|
|
|
|
|
|
|
}, |
|
533
|
|
|
|
|
|
|
{#State 5 |
|
534
|
|
|
|
|
|
|
DEFAULT => -2 |
|
535
|
|
|
|
|
|
|
}, |
|
536
|
|
|
|
|
|
|
{#State 6 |
|
537
|
|
|
|
|
|
|
DEFAULT => -3 |
|
538
|
|
|
|
|
|
|
}, |
|
539
|
|
|
|
|
|
|
{#State 7 |
|
540
|
|
|
|
|
|
|
DEFAULT => -8, |
|
541
|
|
|
|
|
|
|
GOTOS => { |
|
542
|
|
|
|
|
|
|
'elementpipes' => 9 |
|
543
|
|
|
|
|
|
|
} |
|
544
|
|
|
|
|
|
|
}, |
|
545
|
|
|
|
|
|
|
{#State 8 |
|
546
|
|
|
|
|
|
|
DEFAULT => -12 |
|
547
|
|
|
|
|
|
|
}, |
|
548
|
|
|
|
|
|
|
{#State 9 |
|
549
|
|
|
|
|
|
|
DEFAULT => -11, |
|
550
|
|
|
|
|
|
|
GOTOS => { |
|
551
|
|
|
|
|
|
|
'elements' => 10, |
|
552
|
|
|
|
|
|
|
'elementpipe' => 11 |
|
553
|
|
|
|
|
|
|
} |
|
554
|
|
|
|
|
|
|
}, |
|
555
|
|
|
|
|
|
|
{#State 10 |
|
556
|
|
|
|
|
|
|
ACTIONS => { |
|
557
|
|
|
|
|
|
|
'TEXT' => 2, |
|
558
|
|
|
|
|
|
|
'OBRACE' => 4, |
|
559
|
|
|
|
|
|
|
'EBRACE' => 13, |
|
560
|
|
|
|
|
|
|
'PIPE' => 15 |
|
561
|
|
|
|
|
|
|
}, |
|
562
|
|
|
|
|
|
|
GOTOS => { |
|
563
|
|
|
|
|
|
|
'ebrace' => 12, |
|
564
|
|
|
|
|
|
|
'text' => 5, |
|
565
|
|
|
|
|
|
|
'pipe' => 14, |
|
566
|
|
|
|
|
|
|
'parser_spin' => 6, |
|
567
|
|
|
|
|
|
|
'element' => 8, |
|
568
|
|
|
|
|
|
|
'obrace' => 7 |
|
569
|
|
|
|
|
|
|
} |
|
570
|
|
|
|
|
|
|
}, |
|
571
|
|
|
|
|
|
|
{#State 11 |
|
572
|
|
|
|
|
|
|
DEFAULT => -9 |
|
573
|
|
|
|
|
|
|
}, |
|
574
|
|
|
|
|
|
|
{#State 12 |
|
575
|
|
|
|
|
|
|
DEFAULT => -10 |
|
576
|
|
|
|
|
|
|
}, |
|
577
|
|
|
|
|
|
|
{#State 13 |
|
578
|
|
|
|
|
|
|
DEFAULT => -5 |
|
579
|
|
|
|
|
|
|
}, |
|
580
|
|
|
|
|
|
|
{#State 14 |
|
581
|
|
|
|
|
|
|
DEFAULT => -4 |
|
582
|
|
|
|
|
|
|
}, |
|
583
|
|
|
|
|
|
|
{#State 15 |
|
584
|
|
|
|
|
|
|
DEFAULT => -7 |
|
585
|
|
|
|
|
|
|
} |
|
586
|
|
|
|
|
|
|
], |
|
587
|
|
|
|
|
|
|
yyrules => |
|
588
|
|
|
|
|
|
|
[ |
|
589
|
|
|
|
|
|
|
[#Rule 0 |
|
590
|
|
|
|
|
|
|
'$start', 2, undef |
|
591
|
|
|
|
|
|
|
], |
|
592
|
|
|
|
|
|
|
[#Rule 1 |
|
593
|
|
|
|
|
|
|
'text', 1, |
|
594
|
|
|
|
|
|
|
sub |
|
595
|
|
|
|
|
|
|
#line 12 "lib/Text/Spintax/grammar.yp" |
|
596
|
|
|
|
|
|
|
{ $_[0]->YYData->{tree}->add_child("text",$_[0]->YYData->{DATA}[1],$_[0]->YYData->{DATA}[2]); } |
|
597
|
|
|
|
|
|
|
], |
|
598
|
|
|
|
|
|
|
[#Rule 2 |
|
599
|
|
|
|
|
|
|
'element', 1, undef |
|
600
|
|
|
|
|
|
|
], |
|
601
|
|
|
|
|
|
|
[#Rule 3 |
|
602
|
|
|
|
|
|
|
'element', 1, |
|
603
|
|
|
|
|
|
|
sub |
|
604
|
|
|
|
|
|
|
#line 14 "lib/Text/Spintax/grammar.yp" |
|
605
|
|
|
|
|
|
|
{ } |
|
606
|
|
|
|
|
|
|
], |
|
607
|
|
|
|
|
|
|
[#Rule 4 |
|
608
|
|
|
|
|
|
|
'elementpipe', 2, |
|
609
|
|
|
|
|
|
|
sub |
|
610
|
|
|
|
|
|
|
#line 16 "lib/Text/Spintax/grammar.yp" |
|
611
|
|
|
|
|
|
|
{ } |
|
612
|
|
|
|
|
|
|
], |
|
613
|
|
|
|
|
|
|
[#Rule 5 |
|
614
|
|
|
|
|
|
|
'ebrace', 1, |
|
615
|
|
|
|
|
|
|
sub |
|
616
|
|
|
|
|
|
|
#line 18 "lib/Text/Spintax/grammar.yp" |
|
617
|
|
|
|
|
|
|
{ $_[0]->YYData->{tree}->ebrace; } |
|
618
|
|
|
|
|
|
|
], |
|
619
|
|
|
|
|
|
|
[#Rule 6 |
|
620
|
|
|
|
|
|
|
'obrace', 1, |
|
621
|
|
|
|
|
|
|
sub |
|
622
|
|
|
|
|
|
|
#line 20 "lib/Text/Spintax/grammar.yp" |
|
623
|
|
|
|
|
|
|
{ $_[0]->YYData->{tree}->obrace; } |
|
624
|
|
|
|
|
|
|
], |
|
625
|
|
|
|
|
|
|
[#Rule 7 |
|
626
|
|
|
|
|
|
|
'pipe', 1, |
|
627
|
|
|
|
|
|
|
sub |
|
628
|
|
|
|
|
|
|
#line 22 "lib/Text/Spintax/grammar.yp" |
|
629
|
|
|
|
|
|
|
{ $_[0]->YYData->{tree}->add_child("pipe") } |
|
630
|
|
|
|
|
|
|
], |
|
631
|
|
|
|
|
|
|
[#Rule 8 |
|
632
|
|
|
|
|
|
|
'elementpipes', 0, undef |
|
633
|
|
|
|
|
|
|
], |
|
634
|
|
|
|
|
|
|
[#Rule 9 |
|
635
|
|
|
|
|
|
|
'elementpipes', 2, |
|
636
|
|
|
|
|
|
|
sub |
|
637
|
|
|
|
|
|
|
#line 26 "lib/Text/Spintax/grammar.yp" |
|
638
|
|
|
|
|
|
|
{ } |
|
639
|
|
|
|
|
|
|
], |
|
640
|
|
|
|
|
|
|
[#Rule 10 |
|
641
|
|
|
|
|
|
|
'parser_spin', 4, |
|
642
|
|
|
|
|
|
|
sub |
|
643
|
|
|
|
|
|
|
#line 29 "lib/Text/Spintax/grammar.yp" |
|
644
|
|
|
|
|
|
|
{ $_[0]->YYData->{tree}->last_child->{type} = "spin"; } |
|
645
|
|
|
|
|
|
|
], |
|
646
|
|
|
|
|
|
|
[#Rule 11 |
|
647
|
|
|
|
|
|
|
'elements', 0, undef |
|
648
|
|
|
|
|
|
|
], |
|
649
|
|
|
|
|
|
|
[#Rule 12 |
|
650
|
|
|
|
|
|
|
'elements', 2, undef |
|
651
|
|
|
|
|
|
|
] |
|
652
|
|
|
|
|
|
|
], |
|
653
|
|
|
|
|
|
|
@_); |
|
654
|
|
|
|
|
|
|
bless($self,$class); |
|
655
|
|
|
|
|
|
|
} |
|
656
|
|
|
|
|
|
|
|
|
657
|
|
|
|
|
|
|
#line 36 "lib/Text/Spintax/grammar.yp" |
|
658
|
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
1; |