File Coverage

blib/lib/Parse/Eyapp/Parse.pm
Criterion Covered Total %
statement 438 677 64.7
branch 157 256 61.3
condition 31 50 62.0
subroutine 62 112 55.3
pod 0 17 0.0
total 688 1112 61.8


line stmt bran cond sub pod time code
1             ########################################################################################
2             #
3             # This file was generated using Parse::Eyapp version 1.2.
4             #
5             # Copyright © 2006, 2007, 2008, 2009, 2010, 2011, 2012 Casiano Rodriguez-Leon.
6             # Copyright © 2017 William N. Braswell, Jr.
7             # All Rights Reserved.
8             #
9             # Parse::Yapp is Copyright © 1998, 1999, 2000, 2001, Francois Desarmenien.
10             # Parse::Yapp is Copyright © 2017 William N. Braswell, Jr.
11             # All Rights Reserved.
12             #
13             # Don't edit this file, use source file 'lib/Parse/Eyapp/Parse.yp' instead.
14             #
15             # ANY CHANGE MADE HERE WILL BE LOST !
16             #
17             ########################################################################################
18             package Parse::Eyapp::Parse;
19 61     61   358 use strict;
  61         118  
  61         3774  
20              
21             push @Parse::Eyapp::Parse::ISA, 'Parse::Eyapp::Driver';
22              
23              
24              
25              
26             BEGIN {
27             # This strange way to load the modules is to guarantee compatibility when
28             # using several standalone and non-standalone Eyapp parsers
29              
30 61 50   61   27843 require Parse::Eyapp::Driver unless Parse::Eyapp::Driver->can('YYParse');
31 61 50       29392 require Parse::Eyapp::Node unless Parse::Eyapp::Node->can('hnew');
32             }
33            
34              
35 0 0   0 0 0 sub unexpendedInput { defined($_) ? substr($_, (defined(pos $_) ? pos $_ : 0)) : '' }
    0          
36              
37              
38             # Copyright © 2006, 2007, 2008, 2009, 2010, 2011, 2012 Casiano Rodriguez-Leon.
39             # Copyright © 2017 William N. Braswell, Jr.
40             # All Rights Reserved.
41             #
42             # Based on Parse::Yapp.
43             #
44             # Parse::Yapp is Copyright © 1998, 1999, 2000, 2001, Francois Desarmenien.
45             # Parse::Yapp is Copyright © 2017 William N. Braswell, Jr.
46             # All Rights Reserved.
47              
48             require 5.004;
49              
50 61     61   452 use Carp;
  61         120  
  61         590847  
51              
52             my (
53             $input,
54             $lexlevel, # Used by the lexical analyzer. Controls in which section we are:
55             # head (0), body(1) or tail (2)
56             @lineno, # Used by the lexical analyzer. $lineno[0] is the lione number for
57             # the beginning of the token, $lineno[1] the end
58             $nberr, # Number of errors up to now
59             $prec,
60             $labelno);
61              
62             my $syms;
63             my $head; # list of texts inside header sections
64             my $tail;
65             my $token;
66             my $term; # hash ref. key: token, value: an array describing the assoc and priority { '-' => [ 'LEFT' 1 ], '*' => [ 'LEFT' 2 ], }
67             my $termdef; # token definitions. key is token, value is regexp
68              
69             my $whites; # string with the code for white spaces (when automatic generated lexer)
70             my $lexer; # boolean: true if %lexer was used
71             my $incremental; # build an incremental lexer: one that reads in chunks from $self->YYInputFile
72              
73             my $nterm;
74             my $rules;
75             my $precterm; # hash ref. key token used in %prec. value: priority
76             my $start;
77             my $nullable;
78             my $semantic; # hash ref. Keys are the tokens. Value: 0 = syntactic 1 = semantic
79             my $dummy = []; # array ref. the dummy tokens
80              
81             my ($expect);
82             my $namingscheme;
83             my $defaultaction;
84             my $filename;
85             my $tree = 0; # true if %tree or %metatree
86             my $metatree = 0;
87             my $flatlists = 0; # true if flat list semantic for * + and ? operators
88             my $bypass = 0;
89             my $prefix = ''; # yyprefix
90             my $buildingtree = 0;
91             my $alias = 0;
92             my $accessors = {}; # Hash for named accessors when %tree or %metatree is active { exp::left => 0 }
93             my $strict = 0; # When true, all tokens must be declared or a warning will be issued
94             my $nocompact; # Do not compact action tables. No DEFAULT field for "STATES"
95              
96             my %nondeclared; # Potential non declared token identifiers appearing in the program
97             my %conflict; # Hash of conflict name => { codeh => 'code handler', line => #line, #prodnumber1 => [pos1, pos2], #prodnumber2 => [pos1,pos2,pos3], ... }
98              
99             sub not_an_id {
100 71     71 0 147 my $id = shift;
101              
102 71   33     648 !defined($id) or $id !~ m/^[a-zA-Z_][[a-zA-Z_0-9]*$/;
103             }
104              
105             # When using %metatree, i.e. generating a Translation Scheme
106             # returns true if $code was preceded by a %begin directive
107             sub is_begin_code {
108 150     150 0 257 my $code = shift;
109              
110 150   66     1126 return (UNIVERSAL::isa($code, 'ARRAY') and exists($code->[2]) and $code->[2] eq 'BEGINCODE');
111             }
112              
113             # Produces the text containing the declarations
114             # and initializations of the associated variables
115             sub prefixcode {
116 554     554 0 1147 my %index = @_;
117              
118             # When TS var $lhs refers to the father node
119 554 100       1309 my $text = ($metatree)? 'my $lhs = $_[0]; ' : '';
120              
121             # No identifiers were associated with the attributes if %index is empty
122 554 100       2127 return $text unless %index;
123              
124 122         289 $text .= join "", (map { "my \$$_ = \$_[$index{$_}]; " } (keys(%index)));
  195         797  
125              
126             # The former line produces the code for initialization of the attribute
127             # variables so that a production like:
128             # exp: VAR.left '='.op exp.right { ... semantic action }
129             # will produce s.t. like:
130             # sub {
131             # my $left = $_[1]; my $right = $_[3]; my $op = $_[2];
132             # ... semantic action
133             # }
134              
135 122         493 return $text;
136             }
137              
138             # Computes the hash %index used in sub 'prefixcode'
139             # $index{a} is the index of the symbol associated with 'a' in the right hand side
140             # of the production. For example in
141             # R: B.b A.a
142             # $index{a} will be 2.
143             sub symbol_index {
144 561   100 561 0 1461 my $rhs = shift || [];
145 561   100     2089 my $position = shift || @$rhs;
146 561         901 my %index;
147              
148 561         926 local $_ = 0;
149 561         848 for my $value (@{$rhs}) {
  561         1222  
150 1284 100 100     6048 $_++ unless (($value->[0] eq 'CODE') and $metatree) or ($value->[0] eq 'CONFLICTHANDLER');
      66        
151 1284         2103 my $id = $value->[1][2];
152 1284 100       2696 if (defined($id)) {
153             _SyntaxError(
154             2,
155             "Error: attribute variable '\$$id' appears more than once",
156             $value->[1][1])
157 200 50       492 if exists($index{$id});
158 200         411 $index{$id} = $_;
159             }
160 1284 100       2997 last if $_ >= $position;
161             }
162              
163 561         2079 return %index;
164             }
165              
166             # Computes the hash %index holding the position in the generated
167             # AST (as it is build by YYBuildAST) of the node associated with
168             # the identifier. For ex. in "E: E.left '+' E.right"
169             # $index{right} will be 1 (remember that '+' is a syntactic token)
170             sub child_index_in_AST {
171 36   100 36 0 87 my $rhs = shift || [];
172 36         56 my %index;
173              
174 36         51 local $_ = 0;
175 36         51 for my $value (@{$rhs}) {
  36         73  
176 84         114 my ($symb, $line, $id) = @{$value->[1]};
  84         169  
177              
178             # Accessors will be build only for explictly named attributes
179             # Hal Finkel's patch
180 84 100       201 next unless $$semantic{$symb};
181 58 100       141 $index{$id} = $_ if defined($id);
182 58         103 $_++ ;
183             }
184              
185 36         102 return %index;
186             }
187              
188             # This sub gives support to the "%tree alias" directive.
189             # Expands the 'accessors' hash relation
190             # for the current production. Uses 'child_index_in_AST'
191             # to build the mapping between names and indices
192             sub make_accessors {
193 545     545 0 889 my $name = shift;
194 545 100 100     2784 return unless ($tree and $alias and defined($name) and $name->[0] =~m{^[a-zA-Z_]\w*$});
      100        
      66        
195              
196 36         60 my $rhs = shift;
197              
198 36         75 my %index = child_index_in_AST($rhs);
199 36         86 for (keys(%index)) {
200 52         166 $accessors->{"$name->[0]::$_"} = $index{$_};
201             }
202             }
203              
204             # Gives support to %metatree
205             sub insert_delaying_code {
206 150     150 0 240 my $code = shift;
207              
208             # If %begin the code will be executed at "tree time construction"
209 150 100       384 return if is_begin_code($$code);
210 135 100       356 if ($$code) {
211 130         557 $$code = [
212             # The user code is substituted by a builder of a node referencing the
213             # actual sub
214             "push \@_, sub { $$code->[0] }; goto &Parse::Eyapp::Driver::YYBuildTS; ",
215             $$code->[1]
216             ];
217             }
218             else {
219 5         12 $$code = [ ' goto &Parse::Eyapp::Driver::YYBuildTS ', $lineno[0]]
220             }
221             }
222              
223             # Called only from _AddRules
224             sub process_production {
225 629     629 0 1087 my ($rhs) = @_;
226              
227 629         962 my $position = $#$rules;
228 629         1048 my @newrhs = ();
229              
230 629         937 my $m = 0;
231 629         1417 for my $s (0..$#$rhs) {
232 1375         1897 my($what,$value)=@{$$rhs[$s]};
  1375         2663  
233              
234 1375 100       3725 if ($what eq 'CODE') { # TODO: modify name scheme: RULE_POSITION
    50          
235 8         29 my($tmplhs)='@'.$position."-$s";
236              
237 8 50       23 if ($value) {
238              
239             # The auxiliary production generated for
240             # intermediate actions has access to the
241             # attributes of the symbols to its left
242             # Not needed if generating a TS
243 8 100       27 my @optarg = $metatree? () : ($s+1);
244              
245             # Variable declarations
246 8         26 my %index = symbol_index($rhs, @optarg);
247 8         27 $value->[0] = prefixcode(%index).$value->[0];
248             }
249              
250 8 100       32 insert_delaying_code(\$value) if $metatree;
251              
252             # rhs prec name code
253 8         29 push(@$rules,[ $tmplhs, [], undef, undef, $value ]);
254 8         16 push(@newrhs, $tmplhs);
255 8         21 next;
256             }
257             elsif ($what eq 'CONFLICTHANDLER') {
258 0         0 my $ch = $value->[0];
259 0         0 push @{$conflict{$ch}{production}{-$position}}, $m;
  0         0  
260 0         0 next;
261             }
262             # elsif ($what eq 'CONFLICTVIEWPOINT') {
263             # }
264            
265 1367         2474 push(@newrhs, $$value[0]);
266 1367         2335 $m++;
267             }
268 629         1335 return \@newrhs;
269             }
270              
271             # Receives a specification of the RHS of a production like in:
272             # rhs([ $A, $val], name => $_[2], code => $code_rec, prec => $prec)
273             # Returns the data structure used to represent the RHS:
274             # [ @rhs, $arg{prec}, $arg{name}, $arg{code}]
275             sub rhs {
276 76     76 0 128 my @rhs = @{shift()};
  76         158  
277              
278 76         240 my %arg = @_;
279 76 50       225 $arg{prec} = exists($arg{prec})? token($arg{prec}): undef;
280 76 50       200 $arg{name} = undef unless exists($arg{name});
281 76 50       233 $arg{code} = exists($arg{code})? token($arg{code}): undef;
282            
283 76         149 @rhs = map { ['SYMB', $_] } @rhs;
  118         341  
284              
285 76         367 return [ @rhs, $arg{prec}, $arg{name}, $arg{code}];
286             }
287              
288             sub token {
289 122     122 0 218 my $value = shift;
290              
291 122         315 return [ $value, $lineno[0]];
292             }
293              
294             sub symbol {
295 0     0 0 0 my $id = shift;
296              
297 0         0 return ['SYMB', $id];
298             }
299              
300             # To be used with the %lexer directive
301             sub make_lexer {
302 0     0 0 0 my ($code, $line) = @_;
303              
304 0         0 my $errline = $line + ($code =~ tr/\n//);
305              
306 0         0 my $lexertemplate = << 'ENDOFLEXER';
307             __PACKAGE__->YYLexer(
308             sub { # lexical analyzer
309             my $self = $_[0];
310             for (${$self->input()}) { # contextualize
311             #line <> "<>"
312             <>
313             <>
314             return ('', undef) if ($_ eq '') || (defined(pos($_)) && (pos($_) >= length($_)));
315             die("Error inside the lexical analyzer. Line: <>. File: <>. No regexp matched.\n");
316             }
317             } # end lexical analyzer
318             );
319             ENDOFLEXER
320              
321 0         0 $lexertemplate =~ s/<>/$code/g;
322 0         0 $lexertemplate =~ s/<>/$line/g;
323 0         0 $lexertemplate =~ s/<>/$errline/g;
324 0         0 $lexertemplate =~ s/<>/$filename/g;
325 0         0 $lexertemplate =~ s/<>/################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################/g;
326              
327 0         0 return $lexertemplate;
328             }
329              
330             sub explorer_handler {
331 0     0 0 0 my ($name, $code) = @_;
332 0         0 my ($cn, $line) = @$name;
333              
334              
335 0         0 my ($c, $li) = @$code;
336              
337             # TODO: this must be in Output
338 0         0 my $conflict_header = <<"CONFLICT_EXPLORER";
339             my \$self = \$_[0];
340             for (\${\$self->input()}) {
341             #line $li "$filename"
342             CONFLICT_EXPLORER
343 0         0 $c =~ s/^/$conflict_header/; # }
344              
345             # {
346             # follows the closing curly bracket of the for .. to contextualize!!!!!! v
347 0         0 $c =~ s/$/\n################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################\n }\n/;
348             #$code->[0] = $c;
349 0         0 $conflict{$cn}{explorer} = $c;
350 0         0 $conflict{$cn}{explorerline} = $line;
351              
352             # TODO: error control. Factorize!!!!!
353 0         0 $$syms{$cn} = $line;
354 0         0 $$nterm{$cn} = undef;
355              
356 0         0 undef;
357             }
358              
359              
360              
361             # Default lexical analyzer
362             our $LEX = sub {
363             my $self = shift;
364             my $pos;
365              
366             for (${$self->input}) {
367            
368              
369             m{\G(\s+)}gc and $self->tokenline($1 =~ tr{\n}{});
370              
371             m{\G(INCREMENTAL|VIEWPOINT|EXPLORER|EXPECTRR|REGEXP|WHITES|DUMMY|DPREC|LEXER|\n|\:\:|\%\%|\(|\?|\||\=|\<|\%|\!|\>|\:|\)|\$|\;|\.)}gc and return ($1, $1);
372              
373             /\G(ASSOC)/gc and return ($1, $1);
374             /\G(BEGINCODE)/gc and return ($1, $1);
375             /\G(CODE)/gc and return ($1, $1);
376             /\G(CONFLICT)/gc and return ($1, $1);
377             /\G(DEFAULTACTION)/gc and return ($1, $1);
378             /\G(EXPECT)/gc and return ($1, $1);
379             /\G(HEADCODE)/gc and return ($1, $1);
380             /\G(IDENT)/gc and return ($1, $1);
381             /\G(LABEL)/gc and return ($1, $1);
382             /\G(LITERAL)/gc and return ($1, $1);
383             /\G(METATREE)/gc and return ($1, $1);
384             /\G(NAME)/gc and return ($1, $1);
385             /\G(NAMINGSCHEME)/gc and return ($1, $1);
386             /\G(NOCOMPACT)/gc and return ($1, $1);
387             /\G(NUMBER)/gc and return ($1, $1);
388             /\G(OPTION)/gc and return ($1, $1);
389             /\G(PLUS)/gc and return ($1, $1);
390             /\G(PREC)/gc and return ($1, $1);
391             /\G(PREFIX)/gc and return ($1, $1);
392             /\G(SEMANTIC)/gc and return ($1, $1);
393             /\G(STAR)/gc and return ($1, $1);
394             /\G(START)/gc and return ($1, $1);
395             /\G(STRICT)/gc and return ($1, $1);
396             /\G(SYNTACTIC)/gc and return ($1, $1);
397             /\G(TAILCODE)/gc and return ($1, $1);
398             /\G(TOKEN)/gc and return ($1, $1);
399             /\G(TREE)/gc and return ($1, $1);
400             /\G(TYPE)/gc and return ($1, $1);
401             /\G(UNION)/gc and return ($1, $1);
402              
403              
404             return ('', undef) if ($_ eq '') || (defined(pos($_)) && (pos($_) >= length($_)));
405             /\G\s*(\S+)/;
406             my $near = substr($1,0,10);
407              
408             return($near, $near);
409              
410             # die( "Error inside the lexical analyzer near '". $near
411             # ."'. Line: ".$self->line()
412             # .". File: '".$self->YYFilename()."'. No match found.\n");
413             }
414             }
415             ;
416              
417              
418             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
419              
420             my $warnmessage =<< "EOFWARN";
421             Warning!: Did you changed the \@Parse::Eyapp::Parse::ISA variable inside the header section of the eyapp program?
422             EOFWARN
423              
424             sub new {
425 54     54 0 151 my($class)=shift;
426 54 50       235 ref($class) and $class=ref($class);
427              
428 54 50       549 warn $warnmessage unless __PACKAGE__->isa('Parse::Eyapp::Driver');
429             my($self)=$class->SUPER::new(
430             yyversion => '1.2',
431             yyGRAMMAR =>
432             [#[productionNameAndLabel => lhs, [ rhs], bypass]]
433             [ '_SUPERSTART' => '$start', [ 'eyapp', '$end' ], 0 ],
434             [ 'eyapp_1' => 'eyapp', [ 'head', 'body', 'tail' ], 0 ],
435             [ 'symbol_2' => 'symbol', [ 'LITERAL' ], 0 ],
436             [ 'symbol_3' => 'symbol', [ 'ident' ], 0 ],
437             [ 'ident_4' => 'ident', [ 'IDENT' ], 0 ],
438             [ 'prodname_5' => 'prodname', [ 'IDENT' ], 0 ],
439             [ 'prodname_6' => 'prodname', [ 'LABEL' ], 0 ],
440             [ 'prodname_7' => 'prodname', [ 'IDENT', 'LABEL' ], 0 ],
441             [ 'head_8' => 'head', [ 'headsec', '%%' ], 0 ],
442             [ 'perlident_9' => 'perlident', [ 'IDENT' ], 0 ],
443             [ 'perlident_10' => 'perlident', [ 'perlident', '::', 'IDENT' ], 0 ],
444             [ 'headsec_11' => 'headsec', [ ], 0 ],
445             [ 'headsec_12' => 'headsec', [ 'decls' ], 0 ],
446             [ 'decls_13' => 'decls', [ 'decls', 'decl' ], 0 ],
447             [ 'decls_14' => 'decls', [ 'decl' ], 0 ],
448             [ 'decl_15' => 'decl', [ '\n' ], 0 ],
449             [ 'decl_16' => 'decl', [ 'SEMANTIC', 'typedecl', 'toklist', '\n' ], 0 ],
450             [ 'decl_17' => 'decl', [ 'SYNTACTIC', 'typedecl', 'toklist', '\n' ], 0 ],
451             [ 'decl_18' => 'decl', [ 'DUMMY', 'typedecl', 'toklist', '\n' ], 0 ],
452             [ 'decl_19' => 'decl', [ 'TOKEN', 'typedecl', 'toklist', '\n' ], 0 ],
453             [ 'decl_20' => 'decl', [ 'ASSOC', 'typedecl', 'symlist', '\n' ], 0 ],
454             [ 'decl_21' => 'decl', [ 'START', 'ident', '\n' ], 0 ],
455             [ 'decl_22' => 'decl', [ 'PREFIX', '\n' ], 0 ],
456             [ 'decl_23' => 'decl', [ 'WHITES', 'CODE', '\n' ], 0 ],
457             [ 'decl_24' => 'decl', [ 'WHITES', 'REGEXP', '\n' ], 0 ],
458             [ 'decl_25' => 'decl', [ 'WHITES', '=', 'CODE', '\n' ], 0 ],
459             [ 'decl_26' => 'decl', [ 'WHITES', '=', 'REGEXP', '\n' ], 0 ],
460             [ 'decl_27' => 'decl', [ 'NAMINGSCHEME', 'CODE', '\n' ], 0 ],
461             [ 'decl_28' => 'decl', [ 'HEADCODE', '\n' ], 0 ],
462             [ 'decl_29' => 'decl', [ 'UNION', 'CODE', '\n' ], 0 ],
463             [ 'decl_30' => 'decl', [ 'DEFAULTACTION', 'CODE', '\n' ], 0 ],
464             [ 'decl_31' => 'decl', [ 'INCREMENTAL', '\n' ], 0 ],
465             [ 'decl_32' => 'decl', [ 'INCREMENTAL', 'LITERAL', '\n' ], 0 ],
466             [ 'decl_33' => 'decl', [ 'LEXER', 'CODE', '\n' ], 0 ],
467             [ 'decl_34' => 'decl', [ 'TREE', '\n' ], 0 ],
468             [ 'decl_35' => 'decl', [ 'METATREE', '\n' ], 0 ],
469             [ 'decl_36' => 'decl', [ 'STRICT', '\n' ], 0 ],
470             [ 'decl_37' => 'decl', [ 'NOCOMPACT', '\n' ], 0 ],
471             [ 'decl_38' => 'decl', [ 'TYPE', 'typedecl', 'identlist', '\n' ], 0 ],
472             [ 'decl_39' => 'decl', [ 'CONFLICT', 'ident', 'CODE', '\n' ], 0 ],
473             [ 'decl_40' => 'decl', [ 'CONFLICT', 'ident', 'perlident', '?', 'prodname', ':', 'prodname', '\n' ], 0 ],
474             [ 'decl_41' => 'decl', [ 'CONFLICT', 'ident', 'neg', 'REGEXP', '?', 'prodname', ':', 'prodname', '\n' ], 0 ],
475             [ 'decl_42' => 'decl', [ 'EXPLORER', 'ident', 'CODE', '\n' ], 0 ],
476             [ 'decl_43' => 'decl', [ 'EXPLORER', 'ident', 'LITERAL', '\n' ], 0 ],
477             [ 'decl_44' => 'decl', [ 'EXPLORER', 'ident', 'perlident', '\n' ], 0 ],
478             [ 'decl_45' => 'decl', [ 'EXPLORER', 'ident', 'perlident', 'LITERAL', '\n' ], 0 ],
479             [ 'decl_46' => 'decl', [ 'EXPECT', 'NUMBER', '\n' ], 0 ],
480             [ 'decl_47' => 'decl', [ 'EXPECT', 'NUMBER', 'NUMBER', '\n' ], 0 ],
481             [ 'decl_48' => 'decl', [ 'EXPECTRR', 'NUMBER', '\n' ], 0 ],
482             [ 'decl_49' => 'decl', [ 'error', '\n' ], 0 ],
483             [ 'neg_50' => 'neg', [ ], 0 ],
484             [ 'neg_51' => 'neg', [ '!' ], 0 ],
485             [ 'typedecl_52' => 'typedecl', [ ], 0 ],
486             [ 'typedecl_53' => 'typedecl', [ '<', 'IDENT', '>' ], 0 ],
487             [ 'symlist_54' => 'symlist', [ 'symlist', 'symbol' ], 0 ],
488             [ 'symlist_55' => 'symlist', [ 'symbol' ], 0 ],
489             [ 'toklist_56' => 'toklist', [ 'toklist', 'tokendef' ], 0 ],
490             [ 'toklist_57' => 'toklist', [ 'tokendef' ], 0 ],
491             [ 'tokendef_58' => 'tokendef', [ 'ident', '=', 'REGEXP' ], 0 ],
492             [ 'tokendef_59' => 'tokendef', [ 'ident', '=', '%', 'REGEXP' ], 0 ],
493             [ 'tokendef_60' => 'tokendef', [ 'ident', '=', '%', 'REGEXP', '=', 'IDENT' ], 0 ],
494             [ 'tokendef_61' => 'tokendef', [ 'ident', '=', '%', 'REGEXP', '!', 'IDENT' ], 0 ],
495             [ 'tokendef_62' => 'tokendef', [ 'ident', '=', 'CODE' ], 0 ],
496             [ 'tokendef_63' => 'tokendef', [ 'symbol' ], 0 ],
497             [ 'identlist_64' => 'identlist', [ 'identlist', 'ident' ], 0 ],
498             [ 'identlist_65' => 'identlist', [ 'ident' ], 0 ],
499             [ 'body_66' => 'body', [ 'rulesec', '%%' ], 0 ],
500             [ 'body_67' => 'body', [ '%%' ], 0 ],
501             [ 'rulesec_68' => 'rulesec', [ 'rulesec', 'rules' ], 0 ],
502             [ 'rulesec_69' => 'rulesec', [ 'startrules' ], 0 ],
503             [ 'startrules_70' => 'startrules', [ 'IDENT', ':', '@70-2', 'rhss', ';' ], 0 ],
504             [ '_CODE' => '@70-2', [ ], 0 ],
505             [ 'startrules_72' => 'startrules', [ 'error', ';' ], 0 ],
506             [ 'rules_73' => 'rules', [ 'IDENT', ':', 'rhss', ';' ], 0 ],
507             [ 'rules_74' => 'rules', [ 'error', ';' ], 0 ],
508             [ 'rhss_75' => 'rhss', [ 'rhss', '|', 'rule' ], 0 ],
509             [ 'rhss_76' => 'rhss', [ 'rule' ], 0 ],
510             [ 'rule_77' => 'rule', [ 'optname', 'rhs', 'prec', 'epscode' ], 0 ],
511             [ 'rule_78' => 'rule', [ 'optname', 'rhs' ], 0 ],
512             [ 'rhs_79' => 'rhs', [ ], 0 ],
513             [ 'rhs_80' => 'rhs', [ 'rhselts' ], 0 ],
514             [ 'rhselts_81' => 'rhselts', [ 'rhselts', 'rhseltwithid' ], 0 ],
515             [ 'rhselts_82' => 'rhselts', [ 'rhseltwithid' ], 0 ],
516             [ 'rhseltwithid_83' => 'rhseltwithid', [ 'rhselt', '.', 'IDENT' ], 0 ],
517             [ 'rhseltwithid_84' => 'rhseltwithid', [ '$', 'rhselt' ], 0 ],
518             [ 'rhseltwithid_85' => 'rhseltwithid', [ '$', 'error' ], 0 ],
519             [ 'rhseltwithid_86' => 'rhseltwithid', [ 'rhselt' ], 0 ],
520             [ 'rhselt_87' => 'rhselt', [ 'symbol' ], 0 ],
521             [ 'rhselt_88' => 'rhselt', [ 'code' ], 0 ],
522             [ 'rhselt_89' => 'rhselt', [ 'DPREC', 'ident' ], 0 ],
523             [ 'rhselt_90' => 'rhselt', [ 'VIEWPOINT' ], 0 ],
524             [ 'rhselt_91' => 'rhselt', [ '(', 'optname', 'rhs', ')' ], 0 ],
525             [ 'rhselt_92' => 'rhselt', [ 'rhselt', 'STAR' ], 0 ],
526             [ 'rhselt_93' => 'rhselt', [ 'rhselt', '<', 'STAR', 'symbol', '>' ], 0 ],
527             [ 'rhselt_94' => 'rhselt', [ 'rhselt', 'OPTION' ], 0 ],
528             [ 'rhselt_95' => 'rhselt', [ 'rhselt', '<', 'PLUS', 'symbol', '>' ], 0 ],
529             [ 'rhselt_96' => 'rhselt', [ 'rhselt', 'PLUS' ], 0 ],
530             [ 'optname_97' => 'optname', [ ], 0 ],
531             [ 'optname_98' => 'optname', [ 'NAME', 'IDENT' ], 0 ],
532             [ 'optname_99' => 'optname', [ 'NAME', 'IDENT', 'LABEL' ], 0 ],
533             [ 'optname_100' => 'optname', [ 'NAME', 'LABEL' ], 0 ],
534             [ 'prec_101' => 'prec', [ 'PREC', 'symbol' ], 0 ],
535             [ 'epscode_102' => 'epscode', [ ], 0 ],
536             [ 'epscode_103' => 'epscode', [ 'code' ], 0 ],
537             [ 'code_104' => 'code', [ 'CODE' ], 0 ],
538             [ 'code_105' => 'code', [ 'BEGINCODE' ], 0 ],
539             [ 'tail_106' => 'tail', [ ], 0 ],
540             [ 'tail_107' => 'tail', [ 'TAILCODE' ], 0 ],
541             ],
542             yyLABELS =>
543             {
544             '_SUPERSTART' => 0,
545             'eyapp_1' => 1,
546             'symbol_2' => 2,
547             'symbol_3' => 3,
548             'ident_4' => 4,
549             'prodname_5' => 5,
550             'prodname_6' => 6,
551             'prodname_7' => 7,
552             'head_8' => 8,
553             'perlident_9' => 9,
554             'perlident_10' => 10,
555             'headsec_11' => 11,
556             'headsec_12' => 12,
557             'decls_13' => 13,
558             'decls_14' => 14,
559             'decl_15' => 15,
560             'decl_16' => 16,
561             'decl_17' => 17,
562             'decl_18' => 18,
563             'decl_19' => 19,
564             'decl_20' => 20,
565             'decl_21' => 21,
566             'decl_22' => 22,
567             'decl_23' => 23,
568             'decl_24' => 24,
569             'decl_25' => 25,
570             'decl_26' => 26,
571             'decl_27' => 27,
572             'decl_28' => 28,
573             'decl_29' => 29,
574             'decl_30' => 30,
575             'decl_31' => 31,
576             'decl_32' => 32,
577             'decl_33' => 33,
578             'decl_34' => 34,
579             'decl_35' => 35,
580             'decl_36' => 36,
581             'decl_37' => 37,
582             'decl_38' => 38,
583             'decl_39' => 39,
584             'decl_40' => 40,
585             'decl_41' => 41,
586             'decl_42' => 42,
587             'decl_43' => 43,
588             'decl_44' => 44,
589             'decl_45' => 45,
590             'decl_46' => 46,
591             'decl_47' => 47,
592             'decl_48' => 48,
593             'decl_49' => 49,
594             'neg_50' => 50,
595             'neg_51' => 51,
596             'typedecl_52' => 52,
597             'typedecl_53' => 53,
598             'symlist_54' => 54,
599             'symlist_55' => 55,
600             'toklist_56' => 56,
601             'toklist_57' => 57,
602             'tokendef_58' => 58,
603             'tokendef_59' => 59,
604             'tokendef_60' => 60,
605             'tokendef_61' => 61,
606             'tokendef_62' => 62,
607             'tokendef_63' => 63,
608             'identlist_64' => 64,
609             'identlist_65' => 65,
610             'body_66' => 66,
611             'body_67' => 67,
612             'rulesec_68' => 68,
613             'rulesec_69' => 69,
614             'startrules_70' => 70,
615             '_CODE' => 71,
616             'startrules_72' => 72,
617             'rules_73' => 73,
618             'rules_74' => 74,
619             'rhss_75' => 75,
620             'rhss_76' => 76,
621             'rule_77' => 77,
622             'rule_78' => 78,
623             'rhs_79' => 79,
624             'rhs_80' => 80,
625             'rhselts_81' => 81,
626             'rhselts_82' => 82,
627             'rhseltwithid_83' => 83,
628             'rhseltwithid_84' => 84,
629             'rhseltwithid_85' => 85,
630             'rhseltwithid_86' => 86,
631             'rhselt_87' => 87,
632             'rhselt_88' => 88,
633             'rhselt_89' => 89,
634             'rhselt_90' => 90,
635             'rhselt_91' => 91,
636             'rhselt_92' => 92,
637             'rhselt_93' => 93,
638             'rhselt_94' => 94,
639             'rhselt_95' => 95,
640             'rhselt_96' => 96,
641             'optname_97' => 97,
642             'optname_98' => 98,
643             'optname_99' => 99,
644             'optname_100' => 100,
645             'prec_101' => 101,
646             'epscode_102' => 102,
647             'epscode_103' => 103,
648             'code_104' => 104,
649             'code_105' => 105,
650             'tail_106' => 106,
651             'tail_107' => 107,
652             },
653             yyTERMS =>
654             { '' => { ISSEMANTIC => 0 },
655             '!' => { ISSEMANTIC => 0 },
656             '$' => { ISSEMANTIC => 0 },
657             '%%' => { ISSEMANTIC => 0 },
658             '%' => { ISSEMANTIC => 0 },
659             '(' => { ISSEMANTIC => 0 },
660             ')' => { ISSEMANTIC => 0 },
661             '.' => { ISSEMANTIC => 0 },
662             ':' => { ISSEMANTIC => 0 },
663             '::' => { ISSEMANTIC => 0 },
664             ';' => { ISSEMANTIC => 0 },
665             '<' => { ISSEMANTIC => 0 },
666             '=' => { ISSEMANTIC => 0 },
667             '>' => { ISSEMANTIC => 0 },
668             '?' => { ISSEMANTIC => 0 },
669             '\n' => { ISSEMANTIC => 0 },
670             '|' => { ISSEMANTIC => 0 },
671             ASSOC => { ISSEMANTIC => 1 },
672             BEGINCODE => { ISSEMANTIC => 1 },
673             CODE => { ISSEMANTIC => 1 },
674             CONFLICT => { ISSEMANTIC => 1 },
675             DEFAULTACTION => { ISSEMANTIC => 1 },
676             DPREC => { ISSEMANTIC => 1 },
677             DUMMY => { ISSEMANTIC => 1 },
678             EXPECT => { ISSEMANTIC => 1 },
679             EXPECTRR => { ISSEMANTIC => 1 },
680             EXPLORER => { ISSEMANTIC => 1 },
681             HEADCODE => { ISSEMANTIC => 1 },
682             IDENT => { ISSEMANTIC => 1 },
683             INCREMENTAL => { ISSEMANTIC => 1 },
684             LABEL => { ISSEMANTIC => 1 },
685             LEXER => { ISSEMANTIC => 1 },
686             LITERAL => { ISSEMANTIC => 1 },
687             METATREE => { ISSEMANTIC => 1 },
688             NAME => { ISSEMANTIC => 1 },
689             NAMINGSCHEME => { ISSEMANTIC => 1 },
690             NOCOMPACT => { ISSEMANTIC => 1 },
691             NUMBER => { ISSEMANTIC => 1 },
692             OPTION => { ISSEMANTIC => 1 },
693             PLUS => { ISSEMANTIC => 1 },
694             PREC => { ISSEMANTIC => 1 },
695             PREFIX => { ISSEMANTIC => 1 },
696             REGEXP => { ISSEMANTIC => 1 },
697             SEMANTIC => { ISSEMANTIC => 1 },
698             STAR => { ISSEMANTIC => 1 },
699             START => { ISSEMANTIC => 1 },
700             STRICT => { ISSEMANTIC => 1 },
701             SYNTACTIC => { ISSEMANTIC => 1 },
702             TAILCODE => { ISSEMANTIC => 1 },
703             TOKEN => { ISSEMANTIC => 1 },
704             TREE => { ISSEMANTIC => 1 },
705             TYPE => { ISSEMANTIC => 1 },
706             UNION => { ISSEMANTIC => 1 },
707             VIEWPOINT => { ISSEMANTIC => 1 },
708             WHITES => { ISSEMANTIC => 1 },
709             error => { ISSEMANTIC => 1 },
710             error => { ISSEMANTIC => 0 },
711             },
712             yyFILENAME => 'lib/Parse/Eyapp/Parse.yp',
713             yystates =>
714             [
715             {#State 0
716             ACTIONS => {
717             'SYNTACTIC' => 6,
718             'INCREMENTAL' => 5,
719             'error' => 3,
720             "%%" => -11,
721             'ASSOC' => 1,
722             'HEADCODE' => 2,
723             'TREE' => 15,
724             'DEFAULTACTION' => 13,
725             'EXPECTRR' => 14,
726             'WHITES' => 16,
727             'STRICT' => 17,
728             'SEMANTIC' => 12,
729             'TOKEN' => 10,
730             'METATREE' => 11,
731             'NAMINGSCHEME' => 8,
732             'LEXER' => 7,
733             'NOCOMPACT' => 26,
734             'PREFIX' => 24,
735             'DUMMY' => 22,
736             'CONFLICT' => 18,
737             'START' => 19,
738             'EXPLORER' => 20,
739             'EXPECT' => 30,
740             'TYPE' => 29,
741             'UNION' => 28,
742             "\n" => 27
743             },
744             GOTOS => {
745             'decls' => 4,
746             'head' => 23,
747             'decl' => 25,
748             'headsec' => 21,
749             'eyapp' => 9
750             }
751             },
752             {#State 1
753             ACTIONS => {
754             "<" => 31
755             },
756             DEFAULT => -52,
757             GOTOS => {
758             'typedecl' => 32
759             }
760             },
761             {#State 2
762             ACTIONS => {
763             "\n" => 33
764             }
765             },
766             {#State 3
767             ACTIONS => {
768             "\n" => 34
769             }
770             },
771             {#State 4
772             ACTIONS => {
773             'METATREE' => 11,
774             'TOKEN' => 10,
775             'SEMANTIC' => 12,
776             'EXPECTRR' => 14,
777             'DEFAULTACTION' => 13,
778             'TREE' => 15,
779             'STRICT' => 17,
780             'WHITES' => 16,
781             'LEXER' => 7,
782             'NAMINGSCHEME' => 8,
783             'error' => 3,
784             'INCREMENTAL' => 5,
785             'SYNTACTIC' => 6,
786             'HEADCODE' => 2,
787             "%%" => -12,
788             'ASSOC' => 1,
789             'TYPE' => 29,
790             'EXPECT' => 30,
791             "\n" => 27,
792             'UNION' => 28,
793             'PREFIX' => 24,
794             'NOCOMPACT' => 26,
795             'CONFLICT' => 18,
796             'START' => 19,
797             'EXPLORER' => 20,
798             'DUMMY' => 22
799             },
800             GOTOS => {
801             'decl' => 35
802             }
803             },
804             {#State 5
805             ACTIONS => {
806             'LITERAL' => 37,
807             "\n" => 36
808             }
809             },
810             {#State 6
811             ACTIONS => {
812             "<" => 31
813             },
814             DEFAULT => -52,
815             GOTOS => {
816             'typedecl' => 38
817             }
818             },
819             {#State 7
820             ACTIONS => {
821             'CODE' => 39
822             }
823             },
824             {#State 8
825             ACTIONS => {
826             'CODE' => 40
827             }
828             },
829             {#State 9
830             ACTIONS => {
831             '' => 41
832             }
833             },
834             {#State 10
835             ACTIONS => {
836             "<" => 31
837             },
838             DEFAULT => -52,
839             GOTOS => {
840             'typedecl' => 42
841             }
842             },
843             {#State 11
844             ACTIONS => {
845             "\n" => 43
846             }
847             },
848             {#State 12
849             ACTIONS => {
850             "<" => 31
851             },
852             DEFAULT => -52,
853             GOTOS => {
854             'typedecl' => 44
855             }
856             },
857             {#State 13
858             ACTIONS => {
859             'CODE' => 45
860             }
861             },
862             {#State 14
863             ACTIONS => {
864             'NUMBER' => 46
865             }
866             },
867             {#State 15
868             ACTIONS => {
869             "\n" => 47
870             }
871             },
872             {#State 16
873             ACTIONS => {
874             'CODE' => 50,
875             "=" => 48,
876             'REGEXP' => 49
877             }
878             },
879             {#State 17
880             ACTIONS => {
881             "\n" => 51
882             }
883             },
884             {#State 18
885             ACTIONS => {
886             'IDENT' => 52
887             },
888             GOTOS => {
889             'ident' => 53
890             }
891             },
892             {#State 19
893             ACTIONS => {
894             'IDENT' => 52
895             },
896             GOTOS => {
897             'ident' => 54
898             }
899             },
900             {#State 20
901             ACTIONS => {
902             'IDENT' => 52
903             },
904             GOTOS => {
905             'ident' => 55
906             }
907             },
908             {#State 21
909             ACTIONS => {
910             "%%" => 56
911             }
912             },
913             {#State 22
914             ACTIONS => {
915             "<" => 31
916             },
917             DEFAULT => -52,
918             GOTOS => {
919             'typedecl' => 57
920             }
921             },
922             {#State 23
923             ACTIONS => {
924             'IDENT' => 59,
925             "%%" => 61,
926             'error' => 62
927             },
928             GOTOS => {
929             'rulesec' => 60,
930             'body' => 58,
931             'startrules' => 63
932             }
933             },
934             {#State 24
935             ACTIONS => {
936             "\n" => 64
937             }
938             },
939             {#State 25
940             DEFAULT => -14
941             },
942             {#State 26
943             ACTIONS => {
944             "\n" => 65
945             }
946             },
947             {#State 27
948             DEFAULT => -15
949             },
950             {#State 28
951             ACTIONS => {
952             'CODE' => 66
953             }
954             },
955             {#State 29
956             ACTIONS => {
957             "<" => 31
958             },
959             DEFAULT => -52,
960             GOTOS => {
961             'typedecl' => 67
962             }
963             },
964             {#State 30
965             ACTIONS => {
966             'NUMBER' => 68
967             }
968             },
969             {#State 31
970             ACTIONS => {
971             'IDENT' => 69
972             }
973             },
974             {#State 32
975             ACTIONS => {
976             'LITERAL' => 70,
977             'IDENT' => 52
978             },
979             GOTOS => {
980             'symlist' => 73,
981             'ident' => 71,
982             'symbol' => 72
983             }
984             },
985             {#State 33
986             DEFAULT => -28
987             },
988             {#State 34
989             DEFAULT => -49
990             },
991             {#State 35
992             DEFAULT => -13
993             },
994             {#State 36
995             DEFAULT => -31
996             },
997             {#State 37
998             ACTIONS => {
999             "\n" => 74
1000             }
1001             },
1002             {#State 38
1003             ACTIONS => {
1004             'IDENT' => 52,
1005             'LITERAL' => 70
1006             },
1007             GOTOS => {
1008             'tokendef' => 77,
1009             'ident' => 75,
1010             'toklist' => 78,
1011             'symbol' => 76
1012             }
1013             },
1014             {#State 39
1015             ACTIONS => {
1016             "\n" => 79
1017             }
1018             },
1019             {#State 40
1020             ACTIONS => {
1021             "\n" => 80
1022             }
1023             },
1024             {#State 41
1025             DEFAULT => 0
1026             },
1027             {#State 42
1028             ACTIONS => {
1029             'LITERAL' => 70,
1030             'IDENT' => 52
1031             },
1032             GOTOS => {
1033             'symbol' => 76,
1034             'tokendef' => 77,
1035             'ident' => 75,
1036             'toklist' => 81
1037             }
1038             },
1039             {#State 43
1040             DEFAULT => -35
1041             },
1042             {#State 44
1043             ACTIONS => {
1044             'LITERAL' => 70,
1045             'IDENT' => 52
1046             },
1047             GOTOS => {
1048             'symbol' => 76,
1049             'toklist' => 82,
1050             'ident' => 75,
1051             'tokendef' => 77
1052             }
1053             },
1054             {#State 45
1055             ACTIONS => {
1056             "\n" => 83
1057             }
1058             },
1059             {#State 46
1060             ACTIONS => {
1061             "\n" => 84
1062             }
1063             },
1064             {#State 47
1065             DEFAULT => -34
1066             },
1067             {#State 48
1068             ACTIONS => {
1069             'REGEXP' => 86,
1070             'CODE' => 85
1071             }
1072             },
1073             {#State 49
1074             ACTIONS => {
1075             "\n" => 87
1076             }
1077             },
1078             {#State 50
1079             ACTIONS => {
1080             "\n" => 88
1081             }
1082             },
1083             {#State 51
1084             DEFAULT => -36
1085             },
1086             {#State 52
1087             DEFAULT => -4
1088             },
1089             {#State 53
1090             ACTIONS => {
1091             "!" => 91,
1092             'CODE' => 92,
1093             'IDENT' => 89
1094             },
1095             DEFAULT => -50,
1096             GOTOS => {
1097             'neg' => 93,
1098             'perlident' => 90
1099             }
1100             },
1101             {#State 54
1102             ACTIONS => {
1103             "\n" => 94
1104             }
1105             },
1106             {#State 55
1107             ACTIONS => {
1108             'LITERAL' => 97,
1109             'IDENT' => 89,
1110             'CODE' => 95
1111             },
1112             GOTOS => {
1113             'perlident' => 96
1114             }
1115             },
1116             {#State 56
1117             DEFAULT => -8
1118             },
1119             {#State 57
1120             ACTIONS => {
1121             'IDENT' => 52,
1122             'LITERAL' => 70
1123             },
1124             GOTOS => {
1125             'symbol' => 76,
1126             'toklist' => 98,
1127             'tokendef' => 77,
1128             'ident' => 75
1129             }
1130             },
1131             {#State 58
1132             ACTIONS => {
1133             'TAILCODE' => 100
1134             },
1135             DEFAULT => -106,
1136             GOTOS => {
1137             'tail' => 99
1138             }
1139             },
1140             {#State 59
1141             ACTIONS => {
1142             ":" => 101
1143             }
1144             },
1145             {#State 60
1146             ACTIONS => {
1147             "%%" => 103,
1148             'IDENT' => 104,
1149             'error' => 102
1150             },
1151             GOTOS => {
1152             'rules' => 105
1153             }
1154             },
1155             {#State 61
1156             DEFAULT => -67
1157             },
1158             {#State 62
1159             ACTIONS => {
1160             ";" => 106
1161             }
1162             },
1163             {#State 63
1164             DEFAULT => -69
1165             },
1166             {#State 64
1167             DEFAULT => -22
1168             },
1169             {#State 65
1170             DEFAULT => -37
1171             },
1172             {#State 66
1173             ACTIONS => {
1174             "\n" => 107
1175             }
1176             },
1177             {#State 67
1178             ACTIONS => {
1179             'IDENT' => 52
1180             },
1181             GOTOS => {
1182             'ident' => 108,
1183             'identlist' => 109
1184             }
1185             },
1186             {#State 68
1187             ACTIONS => {
1188             'NUMBER' => 110,
1189             "\n" => 111
1190             }
1191             },
1192             {#State 69
1193             ACTIONS => {
1194             ">" => 112
1195             }
1196             },
1197             {#State 70
1198             DEFAULT => -2
1199             },
1200             {#State 71
1201             DEFAULT => -3
1202             },
1203             {#State 72
1204             DEFAULT => -55
1205             },
1206             {#State 73
1207             ACTIONS => {
1208             'LITERAL' => 70,
1209             'IDENT' => 52,
1210             "\n" => 113
1211             },
1212             GOTOS => {
1213             'ident' => 71,
1214             'symbol' => 114
1215             }
1216             },
1217             {#State 74
1218             DEFAULT => -32
1219             },
1220             {#State 75
1221             ACTIONS => {
1222             "=" => 115
1223             },
1224             DEFAULT => -3
1225             },
1226             {#State 76
1227             DEFAULT => -63
1228             },
1229             {#State 77
1230             DEFAULT => -57
1231             },
1232             {#State 78
1233             ACTIONS => {
1234             'LITERAL' => 70,
1235             "\n" => 117,
1236             'IDENT' => 52
1237             },
1238             GOTOS => {
1239             'symbol' => 76,
1240             'ident' => 75,
1241             'tokendef' => 116
1242             }
1243             },
1244             {#State 79
1245             DEFAULT => -33
1246             },
1247             {#State 80
1248             DEFAULT => -27
1249             },
1250             {#State 81
1251             ACTIONS => {
1252             'LITERAL' => 70,
1253             'IDENT' => 52,
1254             "\n" => 118
1255             },
1256             GOTOS => {
1257             'symbol' => 76,
1258             'tokendef' => 116,
1259             'ident' => 75
1260             }
1261             },
1262             {#State 82
1263             ACTIONS => {
1264             'LITERAL' => 70,
1265             'IDENT' => 52,
1266             "\n" => 119
1267             },
1268             GOTOS => {
1269             'symbol' => 76,
1270             'ident' => 75,
1271             'tokendef' => 116
1272             }
1273             },
1274             {#State 83
1275             DEFAULT => -30
1276             },
1277             {#State 84
1278             DEFAULT => -48
1279             },
1280             {#State 85
1281             ACTIONS => {
1282             "\n" => 120
1283             }
1284             },
1285             {#State 86
1286             ACTIONS => {
1287             "\n" => 121
1288             }
1289             },
1290             {#State 87
1291             DEFAULT => -24
1292             },
1293             {#State 88
1294             DEFAULT => -23
1295             },
1296             {#State 89
1297             DEFAULT => -9
1298             },
1299             {#State 90
1300             ACTIONS => {
1301             "::" => 123,
1302             "?" => 122
1303             }
1304             },
1305             {#State 91
1306             DEFAULT => -51
1307             },
1308             {#State 92
1309             ACTIONS => {
1310             "\n" => 124
1311             }
1312             },
1313             {#State 93
1314             ACTIONS => {
1315             'REGEXP' => 125
1316             }
1317             },
1318             {#State 94
1319             DEFAULT => -21
1320             },
1321             {#State 95
1322             ACTIONS => {
1323             "\n" => 126
1324             }
1325             },
1326             {#State 96
1327             ACTIONS => {
1328             "\n" => 128,
1329             "::" => 123,
1330             'LITERAL' => 127
1331             }
1332             },
1333             {#State 97
1334             ACTIONS => {
1335             "\n" => 129
1336             }
1337             },
1338             {#State 98
1339             ACTIONS => {
1340             'LITERAL' => 70,
1341             'IDENT' => 52,
1342             "\n" => 130
1343             },
1344             GOTOS => {
1345             'symbol' => 76,
1346             'ident' => 75,
1347             'tokendef' => 116
1348             }
1349             },
1350             {#State 99
1351             DEFAULT => -1
1352             },
1353             {#State 100
1354             DEFAULT => -107
1355             },
1356             {#State 101
1357             DEFAULT => -71,
1358             GOTOS => {
1359             '@70-2' => 131
1360             }
1361             },
1362             {#State 102
1363             ACTIONS => {
1364             ";" => 132
1365             }
1366             },
1367             {#State 103
1368             DEFAULT => -66
1369             },
1370             {#State 104
1371             ACTIONS => {
1372             ":" => 133
1373             }
1374             },
1375             {#State 105
1376             DEFAULT => -68
1377             },
1378             {#State 106
1379             DEFAULT => -72
1380             },
1381             {#State 107
1382             DEFAULT => -29
1383             },
1384             {#State 108
1385             DEFAULT => -65
1386             },
1387             {#State 109
1388             ACTIONS => {
1389             "\n" => 134,
1390             'IDENT' => 52
1391             },
1392             GOTOS => {
1393             'ident' => 135
1394             }
1395             },
1396             {#State 110
1397             ACTIONS => {
1398             "\n" => 136
1399             }
1400             },
1401             {#State 111
1402             DEFAULT => -46
1403             },
1404             {#State 112
1405             DEFAULT => -53
1406             },
1407             {#State 113
1408             DEFAULT => -20
1409             },
1410             {#State 114
1411             DEFAULT => -54
1412             },
1413             {#State 115
1414             ACTIONS => {
1415             'CODE' => 138,
1416             'REGEXP' => 137,
1417             "%" => 139
1418             }
1419             },
1420             {#State 116
1421             DEFAULT => -56
1422             },
1423             {#State 117
1424             DEFAULT => -17
1425             },
1426             {#State 118
1427             DEFAULT => -19
1428             },
1429             {#State 119
1430             DEFAULT => -16
1431             },
1432             {#State 120
1433             DEFAULT => -25
1434             },
1435             {#State 121
1436             DEFAULT => -26
1437             },
1438             {#State 122
1439             ACTIONS => {
1440             'IDENT' => 140,
1441             'LABEL' => 141
1442             },
1443             GOTOS => {
1444             'prodname' => 142
1445             }
1446             },
1447             {#State 123
1448             ACTIONS => {
1449             'IDENT' => 143
1450             }
1451             },
1452             {#State 124
1453             DEFAULT => -39
1454             },
1455             {#State 125
1456             ACTIONS => {
1457             "?" => 144
1458             }
1459             },
1460             {#State 126
1461             DEFAULT => -42
1462             },
1463             {#State 127
1464             ACTIONS => {
1465             "\n" => 145
1466             }
1467             },
1468             {#State 128
1469             DEFAULT => -44
1470             },
1471             {#State 129
1472             DEFAULT => -43
1473             },
1474             {#State 130
1475             DEFAULT => -18
1476             },
1477             {#State 131
1478             ACTIONS => {
1479             'NAME' => 147
1480             },
1481             DEFAULT => -97,
1482             GOTOS => {
1483             'rule' => 148,
1484             'rhss' => 149,
1485             'optname' => 146
1486             }
1487             },
1488             {#State 132
1489             DEFAULT => -74
1490             },
1491             {#State 133
1492             ACTIONS => {
1493             'NAME' => 147
1494             },
1495             DEFAULT => -97,
1496             GOTOS => {
1497             'rule' => 148,
1498             'rhss' => 150,
1499             'optname' => 146
1500             }
1501             },
1502             {#State 134
1503             DEFAULT => -38
1504             },
1505             {#State 135
1506             DEFAULT => -64
1507             },
1508             {#State 136
1509             DEFAULT => -47
1510             },
1511             {#State 137
1512             DEFAULT => -58
1513             },
1514             {#State 138
1515             DEFAULT => -62
1516             },
1517             {#State 139
1518             ACTIONS => {
1519             'REGEXP' => 151
1520             }
1521             },
1522             {#State 140
1523             ACTIONS => {
1524             'LABEL' => 152
1525             },
1526             DEFAULT => -5
1527             },
1528             {#State 141
1529             DEFAULT => -6
1530             },
1531             {#State 142
1532             ACTIONS => {
1533             ":" => 153
1534             }
1535             },
1536             {#State 143
1537             DEFAULT => -10
1538             },
1539             {#State 144
1540             ACTIONS => {
1541             'IDENT' => 140,
1542             'LABEL' => 141
1543             },
1544             GOTOS => {
1545             'prodname' => 154
1546             }
1547             },
1548             {#State 145
1549             DEFAULT => -45
1550             },
1551             {#State 146
1552             ACTIONS => {
1553             'BEGINCODE' => 157,
1554             "(" => 162,
1555             'LITERAL' => 70,
1556             "\$" => 155,
1557             'VIEWPOINT' => 161,
1558             'CODE' => 164,
1559             'IDENT' => 52,
1560             'DPREC' => 158
1561             },
1562             DEFAULT => -79,
1563             GOTOS => {
1564             'rhseltwithid' => 163,
1565             'ident' => 71,
1566             'rhselts' => 166,
1567             'rhselt' => 165,
1568             'rhs' => 160,
1569             'symbol' => 159,
1570             'code' => 156
1571             }
1572             },
1573             {#State 147
1574             ACTIONS => {
1575             'IDENT' => 167,
1576             'LABEL' => 168
1577             }
1578             },
1579             {#State 148
1580             DEFAULT => -76
1581             },
1582             {#State 149
1583             ACTIONS => {
1584             "|" => 170,
1585             ";" => 169
1586             }
1587             },
1588             {#State 150
1589             ACTIONS => {
1590             ";" => 171,
1591             "|" => 170
1592             }
1593             },
1594             {#State 151
1595             ACTIONS => {
1596             "=" => 173,
1597             "!" => 172
1598             },
1599             DEFAULT => -59
1600             },
1601             {#State 152
1602             DEFAULT => -7
1603             },
1604             {#State 153
1605             ACTIONS => {
1606             'IDENT' => 140,
1607             'LABEL' => 141
1608             },
1609             GOTOS => {
1610             'prodname' => 174
1611             }
1612             },
1613             {#State 154
1614             ACTIONS => {
1615             ":" => 175
1616             }
1617             },
1618             {#State 155
1619             ACTIONS => {
1620             'LITERAL' => 70,
1621             'BEGINCODE' => 157,
1622             "(" => 162,
1623             'VIEWPOINT' => 161,
1624             'error' => 177,
1625             'IDENT' => 52,
1626             'DPREC' => 158,
1627             'CODE' => 164
1628             },
1629             GOTOS => {
1630             'rhselt' => 176,
1631             'ident' => 71,
1632             'code' => 156,
1633             'symbol' => 159
1634             }
1635             },
1636             {#State 156
1637             DEFAULT => -88
1638             },
1639             {#State 157
1640             DEFAULT => -105
1641             },
1642             {#State 158
1643             ACTIONS => {
1644             'IDENT' => 52
1645             },
1646             GOTOS => {
1647             'ident' => 178
1648             }
1649             },
1650             {#State 159
1651             DEFAULT => -87
1652             },
1653             {#State 160
1654             ACTIONS => {
1655             'PREC' => 180
1656             },
1657             DEFAULT => -78,
1658             GOTOS => {
1659             'prec' => 179
1660             }
1661             },
1662             {#State 161
1663             DEFAULT => -90
1664             },
1665             {#State 162
1666             ACTIONS => {
1667             'NAME' => 147
1668             },
1669             DEFAULT => -97,
1670             GOTOS => {
1671             'optname' => 181
1672             }
1673             },
1674             {#State 163
1675             DEFAULT => -82
1676             },
1677             {#State 164
1678             DEFAULT => -104
1679             },
1680             {#State 165
1681             ACTIONS => {
1682             'OPTION' => 183,
1683             'STAR' => 182,
1684             "." => 185,
1685             "<" => 184,
1686             'PLUS' => 186
1687             },
1688             DEFAULT => -86
1689             },
1690             {#State 166
1691             ACTIONS => {
1692             'VIEWPOINT' => 161,
1693             'IDENT' => 52,
1694             'DPREC' => 158,
1695             'CODE' => 164,
1696             'LITERAL' => 70,
1697             'BEGINCODE' => 157,
1698             "(" => 162,
1699             "\$" => 155
1700             },
1701             DEFAULT => -80,
1702             GOTOS => {
1703             'code' => 156,
1704             'symbol' => 159,
1705             'ident' => 71,
1706             'rhseltwithid' => 187,
1707             'rhselt' => 165
1708             }
1709             },
1710             {#State 167
1711             ACTIONS => {
1712             'LABEL' => 188
1713             },
1714             DEFAULT => -98
1715             },
1716             {#State 168
1717             DEFAULT => -100
1718             },
1719             {#State 169
1720             DEFAULT => -70
1721             },
1722             {#State 170
1723             ACTIONS => {
1724             'NAME' => 147
1725             },
1726             DEFAULT => -97,
1727             GOTOS => {
1728             'optname' => 146,
1729             'rule' => 189
1730             }
1731             },
1732             {#State 171
1733             DEFAULT => -73
1734             },
1735             {#State 172
1736             ACTIONS => {
1737             'IDENT' => 190
1738             }
1739             },
1740             {#State 173
1741             ACTIONS => {
1742             'IDENT' => 191
1743             }
1744             },
1745             {#State 174
1746             ACTIONS => {
1747             "\n" => 192
1748             }
1749             },
1750             {#State 175
1751             ACTIONS => {
1752             'IDENT' => 140,
1753             'LABEL' => 141
1754             },
1755             GOTOS => {
1756             'prodname' => 193
1757             }
1758             },
1759             {#State 176
1760             ACTIONS => {
1761             "<" => 184,
1762             'PLUS' => 186,
1763             'STAR' => 182,
1764             'OPTION' => 183
1765             },
1766             DEFAULT => -84
1767             },
1768             {#State 177
1769             DEFAULT => -85
1770             },
1771             {#State 178
1772             DEFAULT => -89
1773             },
1774             {#State 179
1775             ACTIONS => {
1776             'CODE' => 164,
1777             'BEGINCODE' => 157
1778             },
1779             DEFAULT => -102,
1780             GOTOS => {
1781             'code' => 194,
1782             'epscode' => 195
1783             }
1784             },
1785             {#State 180
1786             ACTIONS => {
1787             'IDENT' => 52,
1788             'LITERAL' => 70
1789             },
1790             GOTOS => {
1791             'symbol' => 196,
1792             'ident' => 71
1793             }
1794             },
1795             {#State 181
1796             ACTIONS => {
1797             'VIEWPOINT' => 161,
1798             'CODE' => 164,
1799             'IDENT' => 52,
1800             'DPREC' => 158,
1801             'BEGINCODE' => 157,
1802             "(" => 162,
1803             'LITERAL' => 70,
1804             "\$" => 155
1805             },
1806             DEFAULT => -79,
1807             GOTOS => {
1808             'symbol' => 159,
1809             'code' => 156,
1810             'rhs' => 197,
1811             'rhselts' => 166,
1812             'rhselt' => 165,
1813             'rhseltwithid' => 163,
1814             'ident' => 71
1815             }
1816             },
1817             {#State 182
1818             DEFAULT => -92
1819             },
1820             {#State 183
1821             DEFAULT => -94
1822             },
1823             {#State 184
1824             ACTIONS => {
1825             'STAR' => 198,
1826             'PLUS' => 199
1827             }
1828             },
1829             {#State 185
1830             ACTIONS => {
1831             'IDENT' => 200
1832             }
1833             },
1834             {#State 186
1835             DEFAULT => -96
1836             },
1837             {#State 187
1838             DEFAULT => -81
1839             },
1840             {#State 188
1841             DEFAULT => -99
1842             },
1843             {#State 189
1844             DEFAULT => -75
1845             },
1846             {#State 190
1847             DEFAULT => -61
1848             },
1849             {#State 191
1850             DEFAULT => -60
1851             },
1852             {#State 192
1853             DEFAULT => -40
1854             },
1855             {#State 193
1856             ACTIONS => {
1857             "\n" => 201
1858             }
1859             },
1860             {#State 194
1861             DEFAULT => -103
1862             },
1863             {#State 195
1864             DEFAULT => -77
1865             },
1866             {#State 196
1867             DEFAULT => -101
1868             },
1869             {#State 197
1870             ACTIONS => {
1871             ")" => 202
1872             }
1873             },
1874             {#State 198
1875             ACTIONS => {
1876             'LITERAL' => 70,
1877             'IDENT' => 52
1878             },
1879             GOTOS => {
1880             'symbol' => 203,
1881             'ident' => 71
1882             }
1883             },
1884             {#State 199
1885             ACTIONS => {
1886             'LITERAL' => 70,
1887             'IDENT' => 52
1888             },
1889             GOTOS => {
1890             'symbol' => 204,
1891             'ident' => 71
1892             }
1893             },
1894             {#State 200
1895             DEFAULT => -83
1896             },
1897             {#State 201
1898             DEFAULT => -41
1899             },
1900             {#State 202
1901             DEFAULT => -91
1902             },
1903             {#State 203
1904             ACTIONS => {
1905             ">" => 205
1906             }
1907             },
1908             {#State 204
1909             ACTIONS => {
1910             ">" => 206
1911             }
1912             },
1913             {#State 205
1914             DEFAULT => -93
1915             },
1916             {#State 206
1917             DEFAULT => -95
1918             }
1919             ],
1920             yyrules =>
1921             [
1922             [#Rule _SUPERSTART
1923             '$start', 2, undef
1924             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
1925             ],
1926             [#Rule eyapp_1
1927             'eyapp', 3, undef
1928             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
1929             ],
1930             [#Rule symbol_2
1931             'symbol', 1,
1932             sub {
1933 752     752   1163 my($symbol,$lineno)=@{$_[1]};
  752         1598  
1934             exists($$syms{$symbol})
1935 752 100       2017 or do {
1936 387         975 $$syms{$symbol} = $lineno;
1937 387         738 $$term{$symbol} = undef;
1938              
1939             # Warning!
1940 387 50       1088 $$semantic{$symbol} = 0 unless exists($$semantic{$symbol});
1941             };
1942 752         1616 $_[1]
1943             }
1944             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
1945             ],
1946             [#Rule symbol_3
1947             'symbol', 1, undef
1948             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
1949             ],
1950             [#Rule ident_4
1951             'ident', 1,
1952             sub {
1953 880     880   1377 my($symbol,$lineno)=@{$_[1]};
  880         1912  
1954             exists($$syms{$symbol})
1955 880 100       2361 or do {
1956 238         580 $$syms{$symbol} = $lineno;
1957 238         462 $$term{$symbol} = undef;
1958              
1959             # Warning!
1960 238 50       741 $$semantic{$symbol} = 1 unless exists($$semantic{$symbol});
1961             # Not declared identifier?
1962 238 50 33     1298 $nondeclared{$symbol} = 1 unless (exists($$nterm{$symbol}) or $$term{$symbol});
1963             };
1964 880         1972 $_[1]
1965             }
1966             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
1967             ],
1968             [#Rule prodname_5
1969             'prodname', 1, undef
1970             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
1971             ],
1972             [#Rule prodname_6
1973             'prodname', 1, undef
1974             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
1975             ],
1976             [#Rule prodname_7
1977             'prodname', 2,
1978             sub {
1979 0     0   0 $_[1][0] .= $_[2][0];
1980 0         0 $_[1];
1981             }
1982             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
1983             ],
1984             [#Rule head_8
1985             'head', 2, undef
1986             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
1987             ],
1988             [#Rule perlident_9
1989             'perlident', 1, undef
1990             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
1991             ],
1992             [#Rule perlident_10
1993             'perlident', 3,
1994             sub {
1995 0     0   0 $_[1][0] .= "::".$_[3][0];
1996 0         0 $_[1];
1997             }
1998             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
1999             ],
2000             [#Rule headsec_11
2001             'headsec', 0, undef
2002             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2003             ],
2004             [#Rule headsec_12
2005             'headsec', 1, undef
2006             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2007             ],
2008             [#Rule decls_13
2009             'decls', 2, undef
2010             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2011             ],
2012             [#Rule decls_14
2013             'decls', 1, undef
2014             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2015             ],
2016             [#Rule decl_15
2017             'decl', 1, undef
2018             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2019             ],
2020             [#Rule decl_16
2021             'decl', 4,
2022             sub {
2023 14     14   34 for (@{$_[3]}) {
  14         40  
2024 42         95 my($symbol,$lineno, $def)=@$_;
2025              
2026             # exists($$token{$symbol})
2027             #and do {
2028             # _SyntaxError(0,
2029             # "Token $symbol redefined: ".
2030             # "Previously defined line $$syms{$symbol}",
2031             # $lineno);
2032             # next;
2033             #};
2034 42         81 $$token{$symbol}=$lineno;
2035 42         73 $$term{$symbol} = [ ];
2036 42         64 $$semantic{$symbol} = 1;
2037 42 50       137 $$termdef{$symbol} = $def if $def;
2038             }
2039             undef
2040 14         35 }
2041             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2042             ],
2043             [#Rule decl_17
2044             'decl', 4,
2045             sub {
2046 5     5   11 for (@{$_[3]}) {
  5         11  
2047 28         58 my($symbol,$lineno, $def)=@$_;
2048              
2049             # exists($$token{$symbol})
2050             #and do {
2051             # _SyntaxError(0,
2052             # "Token $symbol redefined: ".
2053             # "Previously defined line $$syms{$symbol}",
2054             # $lineno);
2055             # next;
2056             #};
2057 28         47 $$token{$symbol}=$lineno;
2058 28         43 $$term{$symbol} = [ ];
2059 28         40 $$semantic{$symbol} = 0;
2060 28 50       64 $$termdef{$symbol} = $def if $def;
2061             }
2062             undef
2063 5         10 }
2064             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2065             ],
2066             [#Rule decl_18
2067             'decl', 4,
2068             sub {
2069 0     0   0 for (@{$_[3]}) {
  0         0  
2070 0         0 my($symbol,$lineno, $def)=@$_;
2071              
2072 0         0 $$token{$symbol}=$lineno;
2073 0         0 $$term{$symbol} = [ ];
2074 0         0 $$semantic{$symbol} = 0;
2075 0         0 push @$dummy, $symbol;
2076 0 0       0 $$termdef{$symbol} = $def if $def;
2077             }
2078             undef
2079 0         0 }
2080             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2081             ],
2082             [#Rule decl_19
2083             'decl', 4,
2084             sub {
2085 4     4   8 for (@{$_[3]}) {
  4         7  
2086 6         12 my($symbol,$lineno, $def)=@$_;
2087              
2088             exists($$token{$symbol})
2089 6 50       17 and do {
2090 0         0 _SyntaxError(0,
2091             "Token $symbol redefined: ".
2092             "Previously defined line $$syms{$symbol}",
2093             $lineno);
2094 0         0 next;
2095             };
2096 6         10 $$token{$symbol}=$lineno;
2097 6         11 $$term{$symbol} = [ ];
2098 6 50       19 $$termdef{$symbol} = $def if $def;
2099             }
2100             undef
2101 4         9 }
2102             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2103             ],
2104             [#Rule decl_20
2105             'decl', 4,
2106             sub {
2107 161     161   287 for (@{$_[3]}) {
  161         409  
2108 254         510 my($symbol,$lineno)=@$_;
2109              
2110             defined($$term{$symbol}[0])
2111 254 50       706 and do {
2112 0         0 _SyntaxError(1,
2113             "Precedence for symbol $symbol redefined: ".
2114             "Previously defined line $$syms{$symbol}",
2115             $lineno);
2116 0         0 next;
2117             };
2118 254         484 $$token{$symbol}=$lineno;
2119 254         745 $$term{$symbol} = [ $_[1][0], $prec ];
2120             }
2121 161         283 ++$prec;
2122             undef
2123 161         329 }
2124             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2125             ],
2126             [#Rule decl_21
2127             'decl', 3,
2128             sub {
2129 0 0   0   0 $start=$_[2][0] unless $start;
2130             undef
2131 0         0 }
2132             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2133             ],
2134             [#Rule decl_22
2135             'decl', 2,
2136             sub {
2137             # TODO: Instead of ident has to be a prefix!!!
2138 1     1   3 $prefix=$_[1][0];
2139             undef
2140 1         2 }
2141             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2142             ],
2143             [#Rule decl_23
2144             'decl', 3,
2145             sub {
2146 0     0   0 push @{$_[2]}, 'CODE';
  0         0  
2147 0         0 $whites = $_[2];
2148             }
2149             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2150             ],
2151             [#Rule decl_24
2152             'decl', 3,
2153             sub {
2154 0     0   0 push @{$_[2]}, 'REGEXP';
  0         0  
2155 0         0 $whites = $_[2];
2156             }
2157             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2158             ],
2159             [#Rule decl_25
2160             'decl', 4,
2161             sub {
2162 0     0   0 push @{$_[3]}, 'CODE';
  0         0  
2163 0         0 $whites = $_[3];
2164             }
2165             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2166             ],
2167             [#Rule decl_26
2168             'decl', 4,
2169             sub {
2170 0     0   0 push @{$_[3]}, 'REGEXP';
  0         0  
2171 0         0 $whites = $_[3];
2172             }
2173             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2174             ],
2175             [#Rule decl_27
2176             'decl', 3,
2177             sub {
2178 0     0   0 $namingscheme = $_[2];
2179             undef
2180 0         0 }
2181             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2182             ],
2183             [#Rule decl_28
2184             'decl', 2,
2185 34     34   138 sub { push(@$head,$_[1]); undef }
  34         94  
2186             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2187             ],
2188             [#Rule decl_29
2189             'decl', 3,
2190 0     0   0 sub { undef }
2191             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2192             ],
2193             [#Rule decl_30
2194             'decl', 3,
2195 15     15   40 sub { $defaultaction = $_[2]; undef }
  15         38  
2196             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2197             ],
2198             [#Rule decl_31
2199             'decl', 2,
2200             sub {
2201 0     0   0 $incremental = '';
2202             undef
2203 0         0 }
2204             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2205             ],
2206             [#Rule decl_32
2207             'decl', 3,
2208             sub {
2209 0     0   0 $incremental = $_[2][0];
2210             undef
2211 0         0 }
2212             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2213             ],
2214             [#Rule decl_33
2215             'decl', 3,
2216             sub {
2217 0     0   0 my ($code, $line) = @{$_[2]};
  0         0  
2218 0         0 push @$head, [ make_lexer($code, $line), $line];
2219 0         0 $lexer = 1;
2220             undef
2221 0         0 }
2222             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2223             ],
2224             [#Rule decl_34
2225             'decl', 2,
2226             sub {
2227 34     34   98 $tree = $buildingtree = 1;
2228 34 100       238 $bypass = ($_[1][0] =~m{bypass})? 1 : 0;
2229 34 100       247 $alias = ($_[1][0] =~m{alias})? 1 : 0;
2230 34         106 $defaultaction = [ ' goto &Parse::Eyapp::Driver::YYBuildAST ', $lineno[0]];
2231             undef
2232 34         93 }
2233             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2234             ],
2235             [#Rule decl_35
2236             'decl', 2,
2237             sub {
2238 18     18   60 $metatree = $tree = $buildingtree = 1;
2239             undef
2240 18         45 }
2241             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2242             ],
2243             [#Rule decl_36
2244             'decl', 2,
2245             sub {
2246 0     0   0 $strict = 1;
2247             undef
2248 0         0 }
2249             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2250             ],
2251             [#Rule decl_37
2252             'decl', 2,
2253             sub {
2254 0     0   0 $nocompact = 1;
2255             undef
2256 0         0 }
2257             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2258             ],
2259             [#Rule decl_38
2260             'decl', 4,
2261             sub {
2262 0     0   0 for ( @{$_[3]} ) {
  0         0  
2263 0         0 my($symbol,$lineno)=@$_;
2264              
2265             exists($$nterm{$symbol})
2266 0 0       0 and do {
2267 0         0 _SyntaxError(0,
2268             "Non-terminal $symbol redefined: ".
2269             "Previously defined line $$syms{$symbol}",
2270             $lineno);
2271 0         0 next;
2272             };
2273 0         0 delete($$term{$symbol}); #not a terminal
2274 0         0 $$nterm{$symbol}=undef; #is a non-terminal
2275             }
2276             }
2277             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2278             ],
2279             [#Rule decl_39
2280             'decl', 4,
2281             sub {
2282 0     0   0 my ($name, $code) = @_[2,3];
2283 0         0 my ($cn, $line) = @$name;
2284              
2285              
2286 0         0 my ($c, $li) = @$code;
2287              
2288             # TODO: this must be in Output
2289 0         0 my $conflict_header = <<"CONFLICT_HEADER";
2290             my \$self = \$_[0];
2291             for (\${\$self->input()}) {
2292             #line $li "$filename"
2293             CONFLICT_HEADER
2294 0         0 $c =~ s/^/$conflict_header/; # }
2295              
2296             # {
2297             # follows the closing curly bracket of the for .. to contextualize!!!!!! v
2298 0         0 $c =~ s/$/\n################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################\n }\n/;
2299             #$code->[0] = $c;
2300 0         0 $conflict{$cn}{codeh} = $c;
2301 0         0 $conflict{$cn}{line} = $line;
2302              
2303 0         0 $$syms{$cn} = $line;
2304             #$$nterm{$cn} = undef;
2305              
2306 0         0 undef;
2307             }
2308             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2309             ],
2310             [#Rule decl_40
2311             'decl', 8,
2312             sub {
2313             #print "<@{$_[2]} @{$_[3]} @{$_[5]} @{$_[7]}>\n";
2314            
2315 0     0   0 my $conflict = $_[2];
2316 0         0 my ($startsymbol, $line) = @{$_[3]};
  0         0  
2317 0         0 my @prodname = ($_[5][0], $_[7][0]);
2318              
2319 0         0 my $cn = $conflict->[0];
2320              
2321 0         0 my $c = <<"CONFLICT_HEADER";
2322             my \$self = \$_[0];
2323             for (\${\$self->input()}) {
2324             #line $line "$filename"
2325             \$self->YYIf('$startsymbol', '$prodname[0]', '$prodname[1]');
2326             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2327             }
2328             CONFLICT_HEADER
2329              
2330 0         0 $conflict{$cn}{codeh} = $c;
2331 0         0 $conflict{$cn}{line} = $line;
2332              
2333 0         0 $$syms{$cn} = $line;
2334 0         0 $$nterm{$cn} = undef;
2335              
2336             #$$nterm{$startsymbol} = undef;
2337             #delete $$syms{$startsymbol};
2338              
2339              
2340 0 0       0 if ($startsymbol eq 'EMPTY') {
2341 0         0 $c = <<"NESTEDPARSING";
2342             { \$self->YYIs('EMPTY', 1); }
2343             NESTEDPARSING
2344             }
2345             else {
2346 0         0 $c = <<"NESTEDPARSING";
2347             { \$self->YYNestedParse('$startsymbol'); }
2348             NESTEDPARSING
2349             }
2350              
2351 0         0 explorer_handler($conflict, [$c, $line]);
2352              
2353 0         0 undef;
2354             }
2355             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2356             ],
2357             [#Rule decl_41
2358             'decl', 9,
2359             sub {
2360            
2361 0     0   0 my $conflict = $_[2];
2362 0         0 my $neg = $_[3];
2363 0         0 my ($regexp, $line) = @{$_[4]};
  0         0  
2364 0         0 my @prodname = ($_[6][0], $_[8][0]);
2365              
2366 0         0 my $cn = $conflict->[0];
2367              
2368 0         0 my $c = <<"CONFLICT_HEADER";
2369             my \$self = \$_[0];
2370             for (\${\$self->input()}) {
2371             #line $line "$filename"
2372             \$self->YYIf('.regexp', '$prodname[0]', '$prodname[1]');
2373             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2374             }
2375             CONFLICT_HEADER
2376              
2377 0         0 $conflict{$cn}{codeh} = $c;
2378 0         0 $conflict{$cn}{line} = $line;
2379              
2380 0         0 $$syms{$cn} = $line;
2381 0         0 $$nterm{$cn} = undef;
2382 0         0 $regexp = substr($regexp,1,-1);
2383              
2384 0 0       0 if (!$neg) {
2385 0         0 $regexp = "\\G(?=$regexp)";
2386             }
2387             else {
2388 0         0 $regexp = "\\G(?!$regexp)";
2389             }
2390              
2391 0         0 $c = <<"NESTEDPARSING";
2392             { \$self->YYNestedRegexp('$regexp'); }
2393             NESTEDPARSING
2394              
2395 0         0 explorer_handler($conflict, [$c, $line]);
2396              
2397 0         0 undef;
2398             }
2399             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2400             ],
2401             [#Rule decl_42
2402             'decl', 4,
2403             sub {
2404 0     0   0 my ($name, $code) = @_[2,3];
2405              
2406 0         0 explorer_handler($name, $code);
2407             }
2408             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2409             ],
2410             [#Rule decl_43
2411             'decl', 4,
2412             sub {
2413 0     0   0 my ($name, $startsymbol) = @_[2,3];
2414              
2415 0         0 my $c = <<"NESTEDPARSING";
2416             { \$self->YYNestedParse($startsymbol->[0]); }
2417             NESTEDPARSING
2418 0         0 my $li = $startsymbol->[1];
2419              
2420 0         0 explorer_handler($name, [$c, $li]);
2421             }
2422             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2423             ],
2424             [#Rule decl_44
2425             'decl', 4,
2426             sub {
2427 0     0   0 my ($name, $startsymbol) = @_[2,3];
2428              
2429 0         0 my $c = <<"NESTEDPARSING";
2430             { \$self->YYNestedParse('$startsymbol->[0]'); }
2431             NESTEDPARSING
2432 0         0 my $li = $startsymbol->[1];
2433              
2434 0         0 explorer_handler($name, [$c, $li]);
2435             }
2436             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2437             ],
2438             [#Rule decl_45
2439             'decl', 5,
2440             sub {
2441 0     0   0 my ($name, $startsymbol, $file) = @_[2,4];
2442              
2443 0         0 my $c = <<"NESTEDPARSING";
2444             { \$self->YYNestedParse('$startsymbol->[0]', $file->[0]); }
2445             NESTEDPARSING
2446 0         0 my $li = $startsymbol->[1];
2447              
2448 0         0 explorer_handler($name, [$c, $li]);
2449             }
2450             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2451             ],
2452             [#Rule decl_46
2453             'decl', 3,
2454 0     0   0 sub { $expect=$_[2][0]; undef }
  0         0  
2455             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2456             ],
2457             [#Rule decl_47
2458             'decl', 4,
2459 0     0   0 sub { $expect= [ $_[2][0], $_[3][0]]; undef }
  0         0  
2460             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2461             ],
2462             [#Rule decl_48
2463             'decl', 3,
2464             sub {
2465 0 0   0   0 $expect = 0 unless defined($expect);
2466 0 0       0 croak "Number of reduce-reduce conflicts is redefined (line $_[2][1], file: $filename)\n" if ref($expect);
2467 0         0 $expect= [ $expect, $_[2][0]];
2468             undef
2469 0         0 }
2470             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2471             ],
2472             [#Rule decl_49
2473             'decl', 2,
2474 0     0   0 sub { $_[0]->YYErrok }
2475             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2476             ],
2477             [#Rule neg_50
2478             'neg', 0,
2479       0     sub { }
2480             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2481             ],
2482             [#Rule neg_51
2483             'neg', 1,
2484 0     0   0 sub { 1; }
2485             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2486             ],
2487             [#Rule typedecl_52
2488             'typedecl', 0, undef
2489             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2490             ],
2491             [#Rule typedecl_53
2492             'typedecl', 3, undef
2493             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2494             ],
2495             [#Rule symlist_54
2496             'symlist', 2,
2497 93     93   167 sub { push(@{$_[1]},$_[2]); $_[1] }
  93         249  
  93         210  
2498             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2499             ],
2500             [#Rule symlist_55
2501             'symlist', 1,
2502 161     161   425 sub { [ $_[1] ] }
2503             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2504             ],
2505             [#Rule toklist_56
2506             'toklist', 2,
2507 53     53   96 sub { push(@{$_[1]},$_[2]); $_[1] }
  53         120  
  53         109  
2508             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2509             ],
2510             [#Rule toklist_57
2511             'toklist', 1,
2512 23     23   66 sub { [ $_[1] ] }
2513             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2514             ],
2515             [#Rule tokendef_58
2516             'tokendef', 3,
2517             sub {
2518 0     0   0 push @{$_[3]}, 'REGEXP';
  0         0  
2519 0         0 push @{$_[1]}, $_[3];
  0         0  
2520 0         0 $_[1]
2521             }
2522             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2523             ],
2524             [#Rule tokendef_59
2525             'tokendef', 4,
2526             sub {
2527 0     0   0 push @{$_[4]}, 'CONTEXTUAL_REGEXP';
  0         0  
2528 0         0 push @{$_[1]}, $_[4];
  0         0  
2529 0         0 $_[1]
2530             }
2531             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2532             ],
2533             [#Rule tokendef_60
2534             'tokendef', 6,
2535             sub {
2536 0     0   0 push @{$_[4]}, 'CONTEXTUAL_REGEXP_MATCH';
  0         0  
2537 0         0 push @{$_[4]}, $_[6];
  0         0  
2538 0         0 push @{$_[1]}, $_[4];
  0         0  
2539 0         0 $_[1]
2540             }
2541             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2542             ],
2543             [#Rule tokendef_61
2544             'tokendef', 6,
2545             sub {
2546 0     0   0 push @{$_[4]}, 'CONTEXTUAL_REGEXP_NOMATCH';
  0         0  
2547 0         0 push @{$_[4]}, $_[6];
  0         0  
2548 0         0 push @{$_[1]}, $_[4];
  0         0  
2549 0         0 $_[1]
2550             }
2551             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2552             ],
2553             [#Rule tokendef_62
2554             'tokendef', 3,
2555             sub {
2556 0     0   0 push @{$_[3]}, 'CODE';
  0         0  
2557 0         0 push @{$_[1]}, $_[3];
  0         0  
2558 0         0 $_[1]
2559             }
2560             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2561             ],
2562             [#Rule tokendef_63
2563             'tokendef', 1,
2564             sub {
2565 76     76   126 push @{$_[1]}, [ @{$_[1]}, 'LITERAL'];
  76         143  
  76         222  
2566 76         165 $_[1];
2567             }
2568             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2569             ],
2570             [#Rule identlist_64
2571             'identlist', 2,
2572 0     0   0 sub { push(@{$_[1]},$_[2]); $_[1] }
  0         0  
  0         0  
2573             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2574             ],
2575             [#Rule identlist_65
2576             'identlist', 1,
2577 0     0   0 sub { [ $_[1] ] }
2578             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2579             ],
2580             [#Rule body_66
2581             'body', 2,
2582             sub {
2583 54 50   54   252 $start
2584             or $start=$$rules[1][0];
2585              
2586 54 50       261 ref($$nterm{$start})
2587             or _SyntaxError(2,"Start symbol $start not found ".
2588             "in rules section",$_[2][1]);
2589              
2590             # Add conflict handlers
2591             # [ left hand side, right hand side, precedence, rulename, code, ]
2592 54         257 for my $A (keys %conflict) {
2593              
2594 0 0       0 if (defined($conflict{$A}{explorer})) {
2595 0 0       0 if (!$conflict{$A}{totalviewpoint}) {
2596 0         0 my $code = $conflict{$A}{codeh};
2597 0         0 $conflict{$A}{codeh} = "{ $conflict{$A}{explorer} }\n{ $code }";
2598 0         0 delete $$syms{$A};
2599 0         0 delete $$nterm{$A};
2600 0         0 delete $$term{$A};
2601 0         0 delete $conflict{$A}{explorer};
2602             }
2603             else {
2604 0         0 my $lhs = [$A, $conflict{$A}{explorerline}];
2605 0         0 my $code = $conflict{$A}{explorer};
2606 0         0 my $rhss = [ rhs([], name => $lhs, code => $code), ];
2607 0         0 _AddRules($lhs, $rhss);
2608 0         0 delete $conflict{$A}{explorer};
2609             }
2610             }
2611             else {
2612 0         0 delete $$syms{$A};
2613 0         0 delete $$nterm{$A};
2614 0         0 delete $$term{$A};
2615             }
2616             }
2617              
2618             # # If exists an @identifiers that is not a nterm and not a term is a warn
2619 54 50       226 if ($strict) {
2620 0         0 for (keys %nondeclared) {
2621             warn "Warning! Non declared token $_ at line $$syms{$_} of $filename\n"
2622 0 0 0     0 unless ($_ eq 'error' || $$term{$_} || exists($$nterm{$_}) || exists($conflict{$_}));
      0        
      0        
2623             }
2624             }
2625             # Superstart rule
2626             # [ left hand side, right hand side, precedence, rulename, code, ]
2627 54         295 $$rules[0]=[ '$start', [ $start, chr(0) ], undef, undef, undef,];
2628              
2629             }
2630             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2631             ],
2632             [#Rule body_67
2633             'body', 1,
2634 0     0   0 sub { _SyntaxError(2,"No rules in input grammar",$_[1][1]); }
2635             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2636             ],
2637             [#Rule rulesec_68
2638             'rulesec', 2, undef
2639             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2640             ],
2641             [#Rule rulesec_69
2642             'rulesec', 1, undef
2643             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2644             ],
2645             [#Rule startrules_70
2646             'startrules', 5,
2647 54     54   322 sub { _AddRules($_[1],$_[4]); undef }
  54         139  
2648             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2649             ],
2650             [#Rule _CODE
2651             '@70-2', 0,
2652 54 50   54   490 sub { $start = $_[1][0] unless $start; }
2653             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2654             ],
2655             [#Rule startrules_72
2656             'startrules', 2,
2657 0     0   0 sub { $_[0]->YYErrok }
2658             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2659             ],
2660             [#Rule rules_73
2661             'rules', 4,
2662 115     115   501 sub { _AddRules($_[1],$_[3]); undef }
  115         298  
2663             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2664             ],
2665             [#Rule rules_74
2666             'rules', 2,
2667 0     0   0 sub { $_[0]->YYErrok }
2668             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2669             ],
2670             [#Rule rhss_75
2671             'rhss', 3,
2672 376     376   653 sub { push(@{$_[1]},$_[3]); $_[1] }
  376         945  
  376         833  
2673             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2674             ],
2675             [#Rule rhss_76
2676             'rhss', 1,
2677 169     169   458 sub { [ $_[1] ] }
2678             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2679             ],
2680             [#Rule rule_77
2681             'rule', 4,
2682             sub {
2683 39     39   179 my ($name, $rhs, $prec, $code) = @_[1..4];
2684              
2685 39         170 my %index = symbol_index($rhs);
2686 39 50       297 $code->[0] = prefixcode(%index).$code->[0] if ($code);
2687              
2688 39 100       234 insert_delaying_code(\$code) if $metatree;
2689 39         189 make_accessors($name, $rhs);
2690            
2691 39         96 push(@{$rhs}, $prec, $name, $code); # only three???? what with prefixofcode?
  39         138  
2692 39         150 $rhs
2693             }
2694             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2695             ],
2696             [#Rule rule_78
2697             'rule', 2,
2698             sub {
2699 506     506   1216 my ($name, $rhs) = @_[1, 2];
2700 506         770 my $code;
2701              
2702             # Be careful: $defaultaction must be replicated per action
2703             # to emulate "yacc/yapp" true behavior.
2704             # There was a previous bug when %metatree and %defaultaction
2705             # were activated ------------------V
2706 506   100     2337 $code = $defaultaction && [ @$defaultaction ];
2707              
2708             defined($rhs)
2709             and $rhs->[-1][0] eq 'CODE'
2710 506 100 100     2400 and $code = ${pop(@{$rhs})}[1];
  182         325  
  182         432  
2711              
2712 506         1363 my %index = symbol_index($rhs);
2713 506 100       1797 $code->[0] = prefixcode(%index).$code->[0] if ($code);
2714 506         1586 make_accessors($name, $rhs);
2715              
2716 506 100       1403 insert_delaying_code(\$code) if $metatree;
2717            
2718 506         822 push(@{$rhs}, undef, $name, $code);
  506         1375  
2719              
2720 506         1384 $rhs
2721             }
2722             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2723             ],
2724             [#Rule rhs_79
2725             'rhs', 0, undef
2726             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2727             ],
2728             [#Rule rhs_80
2729             'rhs', 1, undef
2730             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2731             ],
2732             [#Rule rhselts_81
2733             'rhselts', 2,
2734             sub {
2735 890     890   1445 push(@{$_[1]},$_[2]);
  890         2077  
2736 890         1902 $_[1]
2737             }
2738             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2739             ],
2740             [#Rule rhselts_82
2741             'rhselts', 1,
2742 549     549   1423 sub { [ $_[1] ] }
2743             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2744             ],
2745             [#Rule rhseltwithid_83
2746             'rhseltwithid', 3,
2747             sub {
2748 116     116   197 push @{$_[1][1]}, $_[3][0];
  116         359  
2749 116         299 $_[1]
2750             }
2751             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2752             ],
2753             [#Rule rhseltwithid_84
2754             'rhseltwithid', 2,
2755             sub {
2756             # check that is an identifier
2757 71 50   71   235 _SyntaxError(2,"\$ is allowed for identifiers only (Use dot notation instead)",$lineno[0])
2758             if not_an_id($_[2][1][0]);
2759 71         145 push @{$_[2][1]}, $_[2][1][0];
  71         229  
2760 71         187 $_[2]
2761             }
2762             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2763             ],
2764             [#Rule rhseltwithid_85
2765             'rhseltwithid', 2,
2766 0     0   0 sub { _SyntaxError(2,"\$ is allowed for identifiers only",$lineno[0]) }
2767             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2768             ],
2769             [#Rule rhseltwithid_86
2770             'rhseltwithid', 1,
2771             sub {
2772 1252     1252   2659 $_[1];
2773             }
2774             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2775             ],
2776             [#Rule rhselt_87
2777             'rhselt', 1,
2778 1241     1241   3235 sub { [ 'SYMB', $_[1] ] }
2779             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2780             ],
2781             [#Rule rhselt_88
2782             'rhselt', 1,
2783 190     190   559 sub { [ 'CODE', $_[1] ] }
2784             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2785             ],
2786             [#Rule rhselt_89
2787             'rhselt', 2,
2788             sub {
2789 0     0   0 my $cname = $_[2][0];
2790 0         0 $conflict{$cname}{total}++;
2791 0         0 [ 'CONFLICTHANDLER', $_[2] ]
2792             }
2793             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2794             ],
2795             [#Rule rhselt_90
2796             'rhselt', 1,
2797             sub {
2798 0     0   0 $conflict{$_[1][0]}{totalviewpoint}++;
2799 0         0 [ 'CONFLICTVIEWPOINT', $_[1] ]
2800             }
2801             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2802             ],
2803             [#Rule rhselt_91
2804             'rhselt', 4,
2805             sub {
2806 8     8   28 my ($name, $rhs) = @_[2, 3];
2807              
2808              
2809 8   50     55 my $code = $defaultaction && [ @$defaultaction ];
2810 8 50       44 $code =[ ' goto &Parse::Eyapp::Driver::YYActionforParenthesis', $lineno[0]] unless $metatree;
2811              
2812             defined($rhs)
2813             and $rhs->[-1][0] eq 'CODE'
2814 8 50 33     48 and $code = ${pop(@$rhs)}[1];
  0         0  
2815              
2816 8         26 my %index = symbol_index($rhs);
2817 8 50       45 $code->[0] = prefixcode(%index).$code->[0] if ($code);
2818              
2819 8 50       24 insert_delaying_code(\$code) if $metatree;
2820            
2821 8         33 my $A = token('PAREN-'.++$labelno);
2822 8         35 _AddRules($A, [[@$rhs, undef, $name, $code]]);
2823              
2824 8         30 [ 'SYMB', $A]
2825             }
2826             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2827             ],
2828             [#Rule rhselt_92
2829             'rhselt', 2,
2830             sub {
2831 6     6   16 my ($what, $val) = @{$_[1]};
  6         15  
2832 6 50       24 _SyntaxError(1, "Star(*) operator can't be applied to an action", $lineno[0])
2833             if $what eq 'CODE';
2834 6         24 my $A = token('STAR-'.++$labelno);
2835 6         15 my $code_rec = ' goto &Parse::Eyapp::Driver::YYActionforT_TX1X2 ';
2836 6         13 my $code_empty = ' goto &Parse::Eyapp::Driver::YYActionforT_empty ';
2837              
2838 6         22 my $rhss = [
2839             rhs([ $A, $val], name => $_[2], code => $code_rec),
2840             rhs([], name => $_[2], code => $code_empty),
2841             ];
2842 6         22 _AddRules($A, $rhss);
2843 6         23 [ 'SYMB', $A]
2844             }
2845             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2846             ],
2847             [#Rule rhselt_93
2848             'rhselt', 5,
2849             sub {
2850 5     5   20 my ($what, $val) = @{$_[1]};
  5         17  
2851 5 50       19 _SyntaxError(1, "Star(*) operator can't be applied to an action", $lineno[0])
2852             if $what eq 'CODE';
2853 5         25 my $B = token('STAR-'.++$labelno);
2854 5         18 my $code_rec = ' goto &Parse::Eyapp::Driver::YYActionforT_TX1X2 ';
2855 5         11 my $code_single = ' goto &Parse::Eyapp::Driver::YYActionforT_single ';
2856 5         29 my $rhss = [#rhs [token , [value, line]] ..., prec, name, code ]
2857             rhs([ $B, $_[4], $val], name => $_[3], code => $code_rec),
2858             rhs([ $val], name => $_[3], code => $code_single),
2859             ];
2860 5         23 _AddRules($B, $rhss);
2861              
2862 5         17 my $A = token('STAR-'.++$labelno);
2863 5         24 my $code_empty = ' goto &Parse::Eyapp::Driver::YYActionforT_empty ';
2864 5         13 $code_single = ' { $_[1] } # optimize '."\n";
2865              
2866 5         14 $rhss = [
2867             rhs([ $B ], name => $_[3], code => $code_single ),
2868             rhs([], name => $_[3], code => $code_empty),
2869             ];
2870 5         20 _AddRules($A, $rhss);
2871 5         23 [ 'SYMB', $A ]
2872             }
2873             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2874             ],
2875             [#Rule rhselt_94
2876             'rhselt', 2,
2877             sub {
2878 1     1   2 my ($what, $val) = @{$_[1]};
  1         3  
2879 1 50       3 _SyntaxError(1, "Question(?) operator can't be applied to an action", $lineno[0])
2880             if $what eq 'CODE';
2881 1         4 my $A = token('OPTIONAL-'.++$labelno);
2882 1         3 my $code_single = ' goto &Parse::Eyapp::Driver::YYActionforT_single ';
2883 1         1 my $code_empty = ' goto &Parse::Eyapp::Driver::YYActionforT_empty ';
2884              
2885 1         4 my $rhss = [
2886             rhs([ $val], name => $_[2], code => $code_single),
2887             rhs([], name => $_[2], code => $code_empty),
2888             ];
2889 1         10 _AddRules($A, $rhss);
2890 1         4 [ 'SYMB', $A]
2891             }
2892             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2893             ],
2894             [#Rule rhselt_95
2895             'rhselt', 5,
2896             sub {
2897 17     17   45 my ($what, $val) = @{$_[1]};
  17         54  
2898 17 50       76 _SyntaxError(1, "Plus(+) operator can't be applied to an action", $lineno[0])
2899             if $what eq 'CODE';
2900 17         95 my $A = token('PLUS-'.++$labelno);
2901 17         50 my $code_rec = ' goto &Parse::Eyapp::Driver::YYActionforT_TX1X2 ';
2902 17         40 my $code_single = ' goto &Parse::Eyapp::Driver::YYActionforT_single ';
2903              
2904 17         98 my $rhss = [
2905             rhs([$A, $_[4], $val], name => $_[3], code => $code_rec),
2906             rhs([$val], name => $_[3], code => $code_single),
2907             ];
2908 17         183 _AddRules($A, $rhss);
2909 17         87 [ 'SYMB', $A]
2910             }
2911             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2912             ],
2913             [#Rule rhselt_96
2914             'rhselt', 2,
2915             sub {
2916 4     4   10 my ($what, $val) = @{$_[1]};
  4         12  
2917 4 50       16 _SyntaxError(1, "Plus(+) operator can't be applied to an action", $lineno[0])
2918             if $what eq 'CODE';
2919 4         21 my $A = token('PLUS-'.++$labelno);
2920 4         9 my $code_rec = ' goto &Parse::Eyapp::Driver::YYActionforT_TX1X2 ';
2921 4         9 my $code_single = ' goto &Parse::Eyapp::Driver::YYActionforT_single ';
2922              
2923 4         18 my $rhss = [
2924             rhs([$A, $val], name => $_[2], code => $code_rec),
2925             rhs([$val], name => $_[2], code => $code_single)
2926             ];
2927              
2928 4         54 _AddRules($A, $rhss);
2929 4         18 [ 'SYMB', $A]
2930             }
2931             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2932             ],
2933             [#Rule optname_97
2934             'optname', 0, undef
2935             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2936             ],
2937             [#Rule optname_98
2938             'optname', 2,
2939             sub {
2940             # save bypass status
2941 357     357   815 $_[2][2] = $_[1][0];
2942 357         777 $_[2]
2943             }
2944             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2945             ],
2946             [#Rule optname_99
2947             'optname', 3,
2948             sub { # LABELs are used for dynamic conflict resolution
2949             # save bypass status
2950 0     0   0 $_[2][2] = $_[1][0];
2951             # 0: identifier 1: line number 2: bypass
2952             # concat the label to the name
2953 0         0 $_[2][0] .= "$_[3][0]";
2954              
2955 0         0 $_[2]
2956             }
2957             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2958             ],
2959             [#Rule optname_100
2960             'optname', 2,
2961             sub { # LABELs are used for dynamic conflict resolution
2962             # save bypass status
2963 0     0   0 $_[2][2] = $_[1][0];
2964 0         0 $_[2]
2965             }
2966             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2967             ],
2968             [#Rule prec_101
2969             'prec', 2,
2970             sub {
2971             defined($$term{$_[2][0]})
2972 39 50   39   236 or do {
2973 0         0 _SyntaxError(1,"No precedence for symbol $_[2][0]",
2974             $_[2][1]);
2975 0         0 return undef;
2976             };
2977              
2978 39         173 ++$$precterm{$_[2][0]};
2979 39         148 $$term{$_[2][0]}[1];
2980             }
2981             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2982             ],
2983             [#Rule epscode_102
2984             'epscode', 0,
2985 23     23   70 sub { $defaultaction }
2986             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2987             ],
2988             [#Rule epscode_103
2989             'epscode', 1,
2990 16     16   71 sub { $_[1] }
2991             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2992             ],
2993             [#Rule code_104
2994             'code', 1,
2995 191     191   451 sub { $_[1] }
2996             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
2997             ],
2998             [#Rule code_105
2999             'code', 1,
3000             sub {
3001 15 50   15   69 _SyntaxError(2, "%begin code is allowed only when metatree is active\n", $lineno[0])
3002             unless $metatree;
3003 15         39 my $code = $_[1];
3004 15         54 push @$code, 'BEGINCODE';
3005 15         48 return $code;
3006             }
3007             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
3008             ],
3009             [#Rule tail_106
3010             'tail', 0, undef
3011             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
3012             ],
3013             [#Rule tail_107
3014             'tail', 1,
3015 54     54   193 sub { $tail=$_[1] }
3016             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
3017 54         36161 ]
3018             ],
3019             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
3020             yybypass => 0,
3021             yybuildingtree => 0,
3022             yyprefix => '',
3023             yyaccessors => {
3024             },
3025             yyconflicthandlers => {}
3026             ,
3027             yystateconflict => { },
3028             @_,
3029             );
3030 54         1062 bless($self,$class);
3031              
3032 54         696 $self->make_node_classes('TERMINAL', '_OPTIONAL', '_STAR_LIST', '_PLUS_LIST',
3033             '_SUPERSTART',
3034             'eyapp_1',
3035             'symbol_2',
3036             'symbol_3',
3037             'ident_4',
3038             'prodname_5',
3039             'prodname_6',
3040             'prodname_7',
3041             'head_8',
3042             'perlident_9',
3043             'perlident_10',
3044             'headsec_11',
3045             'headsec_12',
3046             'decls_13',
3047             'decls_14',
3048             'decl_15',
3049             'decl_16',
3050             'decl_17',
3051             'decl_18',
3052             'decl_19',
3053             'decl_20',
3054             'decl_21',
3055             'decl_22',
3056             'decl_23',
3057             'decl_24',
3058             'decl_25',
3059             'decl_26',
3060             'decl_27',
3061             'decl_28',
3062             'decl_29',
3063             'decl_30',
3064             'decl_31',
3065             'decl_32',
3066             'decl_33',
3067             'decl_34',
3068             'decl_35',
3069             'decl_36',
3070             'decl_37',
3071             'decl_38',
3072             'decl_39',
3073             'decl_40',
3074             'decl_41',
3075             'decl_42',
3076             'decl_43',
3077             'decl_44',
3078             'decl_45',
3079             'decl_46',
3080             'decl_47',
3081             'decl_48',
3082             'decl_49',
3083             'neg_50',
3084             'neg_51',
3085             'typedecl_52',
3086             'typedecl_53',
3087             'symlist_54',
3088             'symlist_55',
3089             'toklist_56',
3090             'toklist_57',
3091             'tokendef_58',
3092             'tokendef_59',
3093             'tokendef_60',
3094             'tokendef_61',
3095             'tokendef_62',
3096             'tokendef_63',
3097             'identlist_64',
3098             'identlist_65',
3099             'body_66',
3100             'body_67',
3101             'rulesec_68',
3102             'rulesec_69',
3103             'startrules_70',
3104             '_CODE',
3105             'startrules_72',
3106             'rules_73',
3107             'rules_74',
3108             'rhss_75',
3109             'rhss_76',
3110             'rule_77',
3111             'rule_78',
3112             'rhs_79',
3113             'rhs_80',
3114             'rhselts_81',
3115             'rhselts_82',
3116             'rhseltwithid_83',
3117             'rhseltwithid_84',
3118             'rhseltwithid_85',
3119             'rhseltwithid_86',
3120             'rhselt_87',
3121             'rhselt_88',
3122             'rhselt_89',
3123             'rhselt_90',
3124             'rhselt_91',
3125             'rhselt_92',
3126             'rhselt_93',
3127             'rhselt_94',
3128             'rhselt_95',
3129             'rhselt_96',
3130             'optname_97',
3131             'optname_98',
3132             'optname_99',
3133             'optname_100',
3134             'prec_101',
3135             'epscode_102',
3136             'epscode_103',
3137             'code_104',
3138             'code_105',
3139             'tail_106',
3140             'tail_107', );
3141 54         197 $self;
3142             }
3143              
3144              
3145             sub _Error {
3146 0     0   0 my($value)=$_[0]->YYCurval;
3147              
3148 0         0 my $token = $$value[0];
3149 0 0       0 my($what)= $token ? "input: '$token'" : "symbol";
3150              
3151 0         0 _SyntaxError(1,"Unexpected $what",$$value[1]);
3152             }
3153              
3154             sub slurp_perl_code {
3155 221     221 0 444 my($level,$from,$code);
3156              
3157 221         400 $from=pos($$input);
3158              
3159 221         391 $level=1;
3160 221         835 while($$input=~/([{}])/gc) {
3161 935 50       2519 substr($$input,pos($$input)-1,1) eq '\\' #Quoted
3162             and next;
3163 935 100       3536 $level += ($1 eq '{' ? 1 : -1)
    100          
3164             or last;
3165             }
3166             $level
3167 221 50       610 and _SyntaxError(2,"Unmatched { opened line $lineno[0]",-1);
3168 221         647 $code = substr($$input,$from,pos($$input)-$from-1);
3169 221         439 $lineno[1]+= $code=~tr/\n//;
3170 221         1043 return [ $code, $lineno[0] ];
3171             }
3172              
3173             my %headertoken = (
3174             start => 'START',
3175             expect => 'EXPECT',
3176             token => 'TOKEN',
3177             strict => 'STRICT',
3178             type => 'TYPE',
3179             union => 'UNION',
3180             namingscheme => 'NAMINGSCHEME',
3181             metatree => 'METATREE',
3182             nocompact => 'NOCOMPACT',
3183             conflict => 'CONFLICT',
3184             whites => 'WHITES',
3185             );
3186              
3187             # Used for <%name LIST_of_STH +>, <%name OPT_STH ?>
3188             my %listtoken = (
3189             '*' => 'STAR',
3190             '+' => 'PLUS',
3191             '?' => 'OPTION',
3192             );
3193              
3194             my $ID = qr{[A-Za-z_][A-Za-z0-9_]*};
3195             my $LABEL = qr{:[A-Za-z0-9_]+};
3196             my $STRING = qr {
3197             ' # opening apostrophe
3198             (?:[^'\\]| # an ordinary character
3199             \\\\| # escaped \ i.e. \\
3200             \\'| # escaped apostrophe i.e. \'
3201             \\ # escape i.e. \
3202             )*? # non greedy repetitions
3203             ' # closing apostrophe
3204             }x;
3205              
3206             # Head section: \n separates declarations
3207             my $HEADERWHITESPACES = qr{
3208             (?:
3209             [\t\ ]+ # Any white space char but \n
3210             | \#[^\n]* # Perl like comments
3211             | /\*.*?\*/ # C like comments
3212             )+
3213             }xs;
3214              
3215             # Head section: \n is not significant
3216             my $BODYWHITESPACES = qr{
3217             (?:
3218             \s+ # Any white space char, including \n
3219             | \#[^\n]* # Perl like comments
3220             | /\*.*?\*/ # C like comments
3221             )+
3222             }xs;
3223              
3224             my $REGEXP = qr{
3225             / # opening slash
3226             (?:[^/\\]| # an ordinary character
3227             \\\\| # escaped \ i.e. \\
3228             \\/| # escaped slash i.e. \/
3229             \\ # escape i.e. \
3230             )*? # non greedy repetitions
3231             / # closing slash
3232             }xs;
3233              
3234             sub _Lexer {
3235            
3236             #At EOF
3237 4852 100   4852   12151 pos($$input) >= length($$input)
3238             and return('',[ undef, -1 ]);
3239              
3240             #In TAIL section
3241             $lexlevel > 1
3242 4798 100       9996 and do {
3243 54         157 my($pos)=pos($$input);
3244              
3245 54         130 $lineno[0]=$lineno[1];
3246 54         124 $lineno[1]=-1;
3247 54         233 pos($$input)=length($$input);
3248 54         371 return('TAILCODE',[ substr($$input,$pos), $lineno[0] ]);
3249             };
3250              
3251             #Skip blanks
3252             $lexlevel == 0
3253             ? $$input=~m{\G($HEADERWHITESPACES)}gc
3254             : $$input=~m{\G($BODYWHITESPACES)}gc
3255 4744 100       35012 and do {
    100          
3256 3519         8947 my($blanks)=$1;
3257              
3258             #Maybe At EOF
3259 3519 50       7908 pos($$input) >= length($$input) and return('',[ undef, -1 ]);
3260              
3261 3519         7160 $lineno[1]+= $blanks=~tr/\n//;
3262             };
3263              
3264 4744         8144 $lineno[0]=$lineno[1];
3265              
3266 4744 50       15995 $$input=~/\G($LABEL)/gc
3267             and return('LABEL',[ $1, $lineno[0] ]);
3268              
3269 4744 100       21545 $$input=~/\G($ID)/gc
3270             and return('IDENT',[ $1, $lineno[0] ]);
3271              
3272              
3273             $$input=~/\G($STRING)/gc
3274 3222 100       15134 and do {
3275 752         1629 my $string = $1;
3276              
3277             # The string 'error' is reserved for the special token 'error'
3278 752 50       1759 $string eq "'error'" and do {
3279 0         0 _SyntaxError(0,"Literal 'error' ".
3280             "will be treated as error token",$lineno[0]);
3281 0         0 return('IDENT',[ 'error', $lineno[0] ]);
3282             };
3283              
3284 752         1273 my $lines = $string =~ tr/\n//;
3285 752 50       1673 _SyntaxError(2, "Constant string $string contains newlines",$lineno[0]) if $lines;
3286 752         1168 $lineno[1] += $lines;
3287              
3288 752 50       1612 $string = chr(0) if $string eq "''";
3289              
3290 752         3245 return('LITERAL',[ $string, $lineno[0] ]);
3291             };
3292              
3293             # New section: body or tail
3294             $$input=~/\G(%%)/gc
3295 2470 100       6428 and do {
3296 108         234 ++$lexlevel;
3297 108         591 return($1, [ $1, $lineno[0] ]);
3298             };
3299              
3300 2362 100       7780 $$input=~/\G\s*\{/gc and return ('CODE', &slurp_perl_code()); # }
3301              
3302 2156 100       4530 if($lexlevel == 0) {# In head section
3303              
3304 751 100       2565 $$input=~/\G%(left|right|nonassoc)/gc and return('ASSOC',[ uc($1), $lineno[0] ]);
3305              
3306             $$input=~/\G%\{/gc
3307 590 100       1411 and do {
3308 34         83 my($code);
3309              
3310 34 50       208 $$input=~/\G(.*?)%}/sgc or _SyntaxError(2,"Unmatched %{ opened line $lineno[0]",-1);
3311              
3312 34         109 $code=$1;
3313 34         114 $lineno[1]+= $code=~tr/\n//;
3314 34         174 return('HEADCODE',[ $code, $lineno[0] ]);
3315             };
3316              
3317 556 100       1264 $$input=~/\G%prefix\s+([A-Za-z_][A-Za-z0-9_:]*::)/gc and return('PREFIX',[ $1, $lineno[0] ]);
3318              
3319             $$input=~/\G%(tree((?:\s+(?:bypass|alias)){0,2}))/gc
3320 555 100       1363 and do {
3321 34 50       181 my $treeoptions = defined($2)? $2 : '';
3322 34         180 return('TREE',[ $treeoptions, $lineno[0] ])
3323             };
3324              
3325 521 100       1324 $$input=~/\G%(?:(semantic|syntactic|dummy)(?:\s+token)?)\b/gc and return(uc($1),[ undef, $lineno[0] ]);
3326              
3327 502 50       1120 $$input=~/\G%(?:(incremental)(?:\s+lexer)?)\b/gc and return(uc($1),[ undef, $lineno[0] ]);
3328              
3329 502 100       1231 $$input=~/\G%(lexer|defaultaction|union)\b\s*/gc and return(uc($1),[ undef, $lineno[0] ]);
3330              
3331 487 50       1314 $$input=~/\G([0-9]+)/gc and return('NUMBER',[ $1, $lineno[0] ]);
3332              
3333 487 50       1153 $$input=~/\G%expect-rr/gc and return('EXPECTRR',[ undef, $lineno[0] ]);
3334              
3335 487 50       1089 $$input=~/\G%(explorer)/gc and return('EXPLORER',[ undef, $lineno[0] ]);
3336              
3337 487 100       2349 $$input=~/\G%($ID)/gc and return($headertoken{$1},[ undef, $lineno[0] ]);
3338              
3339 465 50       2945 $$input=~/\G($REGEXP)/gc and return('REGEXP',[ $1, $lineno[0] ]);
3340              
3341 465 50       1606 $$input=~/\G::/gc and return('::',[ undef, $lineno[0] ]);
3342              
3343             }
3344             else { # In rule section
3345              
3346             # like in <%name LIST_of_STH *>
3347             # like in <%name LIST_of_STH +>
3348             # like in <%name OPT_STH ?>
3349             # returns STAR or PLUS or OPTION
3350             $$input=~/\G(?:<\s*%name\s*($ID)\s*)?([*+?])\s*>/gc
3351 1405 100       8102 and return($listtoken{$2},[ $1, $lineno[0] ]);
3352              
3353             # like in %name LIST_of_STH *
3354             # like in %name LIST_of_STH +
3355             # like in %name OPT_STH ?
3356             # returns STAR or PLUS or OPTION
3357             $$input=~/\G(?:%name\s*($ID)\s*)?([*+?])/gc
3358 1400 100       7265 and return($listtoken{$2},[ $1, $lineno[0] ]);
3359              
3360             $$input=~/\G%no\s+bypass/gc
3361 1372 100       4707 and do {
3362             #my $bp = defined($1)?0:1;
3363 2         11 return('NAME',[ 0, $lineno[0] ]);
3364             };
3365              
3366 1370 100       3320 $$input=~/\G%(prec)/gc
3367             and return('PREC',[ undef, $lineno[0] ]);
3368              
3369 1331 50       2912 $$input=~/\G%(PREC)/gc
3370             and return('DPREC',[ undef, $lineno[0] ]);
3371              
3372             $$input=~/\G%name/gc
3373 1331 100       3204 and do {
3374             # return current bypass status
3375 355         1619 return('NAME',[ $bypass, $lineno[0] ]);
3376             };
3377              
3378             # Now label is returned in the "common" area
3379             # $$input=~/\G($LABEL)/gc
3380             # and return('LABEL',[ $1, $lineno[0] ]);
3381              
3382 976 100       2194 $$input=~/\G%begin\s*{/gc # }
3383             and return ('BEGINCODE', &slurp_perl_code());
3384              
3385             #********** research *************#
3386 961 50       2791 $$input=~/\G%([a-zA-Z_]\w*)\?/gc
3387             and return('VIEWPOINT',[ $1, $lineno[0] ]);
3388              
3389              
3390             }
3391              
3392             #Always return something
3393 1426 50       4100 $$input=~/\G(.)/sg
3394             or die "Parse::Eyapp::Grammar::Parse: Match (.) failed: report as a BUG";
3395              
3396 1426         3031 my $char = $1;
3397              
3398 1426         2760 $char =~ s/\cM/\n/; # dos to unix
3399              
3400 1426 100       3317 $char eq "\n" and ++$lineno[1];
3401              
3402 1426         6650 ( $char ,[ $char, $lineno[0] ]);
3403              
3404             }
3405              
3406             sub _SyntaxError {
3407 0     0   0 my($level,$message,$lineno)=@_;
3408              
3409 0 0       0 $message= "*".
3410             [ 'Warning', 'Error', 'Fatal' ]->[$level].
3411             "* $message, at ".
3412             ($lineno < 0 ? "eof" : "line $lineno")." at file $filename\n";
3413              
3414 0 0       0 $level > 1
3415             and die $message;
3416              
3417 0         0 warn $message;
3418              
3419 0 0       0 $level > 0
3420             and ++$nberr;
3421              
3422 0 0       0 $nberr == 20
3423             and die "*Fatal* Too many errors detected.\n"
3424             }
3425              
3426             # _AddRules
3427             # There was a serious error I introduced between versions 171 and 172 (subversion
3428             # numbers). I delayed the instruction
3429             # my ($tmprule)=[ $lhs, [], splice(@$rhs,-3)];
3430             # with catastrophic consequences for the resulting
3431             # LALR tables.
3432             # The splice of the ($precedence, $name, $code)
3433             # must be done before this line, if not the counts of nullables
3434             # will no work!
3435             # @$rhs
3436             # or do {
3437             # ++$$nullable{$lhs};
3438             # ++$epsrules;
3439             # };
3440              
3441             sub _AddRules {
3442 215     215   378 my($lhs,$lineno)=@{$_[0]};
  215         561  
3443 215         444 my($rhss)=$_[1];
3444              
3445             ref($$nterm{$lhs})
3446 215 50       676 and do {
3447 0         0 _SyntaxError(1,"Non-terminal $lhs redefined: ".
3448             "Previously declared line $$syms{$lhs}",$lineno);
3449 0         0 return;
3450             };
3451              
3452             ref($$term{$lhs})
3453 215 50       686 and do {
3454 0 0       0 my($where) = exists($$token{$lhs}) ? $$token{$lhs} : $$syms{$lhs};
3455 0         0 _SyntaxError(1,"Non-terminal $lhs previously ".
3456             "declared as token line $where",$lineno);
3457 0         0 return;
3458             };
3459              
3460             ref($$nterm{$lhs}) #declared through %type
3461 215 50       593 or do {
3462 215         516 $$syms{$lhs}=$lineno; #Say it's declared here
3463 215         450 delete($$term{$lhs}); #No more a terminal
3464             };
3465 215         495 $$nterm{$lhs}=[]; #It's a non-terminal now
3466            
3467             # Hal Finkel's patch: a non terminal is a semantic child
3468 215         451 $$semantic{$lhs} = 1;
3469              
3470 215         412 my($epsrules)=0; #To issue a warning if more than one epsilon rule
3471              
3472 215         471 for my $rhs (@$rhss) {
3473             # ($precedence, $name, $code)
3474 629         1902 my ($tmprule)=[ $lhs, [], splice(@$rhs,-3)];
3475              
3476             # Warning! the splice of the ($precedence, $name, $code)
3477             # must be done before this line, if not the counts of nullables
3478             # will no work!
3479             @$rhs
3480 629 100       1586 or do {
3481 16         39 ++$$nullable{$lhs};
3482 16         50 ++$epsrules;
3483             };
3484              
3485             # Reserve position for current rule
3486 629         1181 push(@$rules, undef);
3487 629         999 my $position = $#$rules;
3488              
3489             # Expand to auxiliary productions all the intermediate codes
3490 629         1546 $tmprule->[1] = process_production($rhs);
3491 629         1057 $$rules[$position] = $tmprule;
3492 629         888 push(@{$$nterm{$lhs}},$position);
  629         1405  
3493             }
3494              
3495 215 50       623 $epsrules > 1
3496             and _SyntaxError(0,"More than one empty rule for symbol $lhs",$lineno);
3497             }
3498              
3499             # This sub is called fro Parse::Eyapp::Grammar::new
3500             # 0 1 2 3 4 5 6 7 8
3501             # Args: object, input, firstline, filename, tree, nocompact, lexerisdefined, acceptinputprefix, start
3502             # See the call to thsi sub 'Parse' inside sub new in module Grammar.pm
3503             sub Parse {
3504 54     54 0 192 my($self)=shift;
3505              
3506 54 50       833 @_ > 0
3507             or croak("No input grammar\n");
3508              
3509 54         424 my($parsed)={};
3510              
3511 54         139 $input=\$_[0]; # we did a shift for $self, one less
3512              
3513 54         117 $lexlevel=0;
3514 54         176 my $firstline = $_[1];
3515 54 50       182 $filename = $_[2] or croak "Unknown input file";
3516 54 50       273 @lineno= $firstline? ($firstline, $firstline) : (1,1);
3517              
3518 54         120 $tree = $_[3];
3519 54 50       192 if ($tree) { # factorize!
3520 0         0 $buildingtree = 1;
3521 0         0 $bypass = 0;
3522 0         0 $alias = 0;
3523 0         0 $defaultaction = [ ' goto &Parse::Eyapp::Driver::YYBuildAST ', 0];
3524 0         0 $namingscheme = [ '\&give_rhs_name', 0];
3525             }
3526              
3527 54         111 $nocompact = $_[4];
3528              
3529 54         113 $nberr=0;
3530 54         124 $prec=0;
3531 54         103 $labelno=0;
3532              
3533 54         110 $head=[];
3534 54         111 $tail="";
3535              
3536 54         100 $syms={};
3537 54         103 $token={};
3538 54         118 $term={};
3539 54         410 $termdef={};
3540 54         111 $nterm={};
3541 54         152 $rules=[ undef ]; #reserve slot 0 for start rule
3542 54         109 $precterm={};
3543              
3544 54         116 $start="";
3545 54 50       173 $start = $_[7] if ($_[7]);
3546              
3547 54         137 $nullable={};
3548 54         106 $expect=0;
3549 54         106 $semantic = {};
3550 54         104 $strict = 0;
3551              
3552 54         294 pos($$input)=0;
3553              
3554              
3555 54         486 $self->YYParse(yylex => \&_Lexer, yyerror => \&_Error); #???
3556              
3557 54 50       229 $nberr
3558             and _SyntaxError(2,"Errors detected: No output",-1);
3559              
3560 54         856 @$parsed{ 'HEAD', 'TAIL', 'RULES', 'NTERM', 'TERM',
3561             'NULL', 'PREC', 'SYMS', 'START', 'EXPECT',
3562             'SEMANTIC', 'BYPASS', 'ACCESSORS', 'BUILDINGTREE',
3563             'PREFIX',
3564             'NAMINGSCHEME',
3565             'NOCOMPACT',
3566             'CONFLICTHANDLERS',
3567             'TERMDEF',
3568             'WHITES',
3569             'LEXERISDEFINED',
3570             'INCREMENTAL',
3571             'STRICT',
3572             'DUMMY',
3573             }
3574             = ( $head, $tail, $rules, $nterm, $term,
3575             $nullable, $precterm, $syms, $start, $expect,
3576             $semantic, $bypass, $accessors, $buildingtree,
3577             $prefix,
3578             $namingscheme,
3579             $nocompact,
3580             \%conflict,
3581             $termdef,
3582             $whites,
3583             $lexer,
3584             $incremental,
3585             $strict,
3586             $dummy,
3587             );
3588              
3589 54         165 undef($input);
3590 54         120 undef($lexlevel);
3591 54         143 undef(@lineno);
3592 54         125 undef($nberr);
3593 54         110 undef($prec);
3594 54         125 undef($labelno);
3595 54         144 undef($incremental);
3596              
3597 54         131 undef($head);
3598 54         95 undef($tail);
3599              
3600 54         114 undef($syms);
3601 54         178 undef($token);
3602 54         105 undef($term);
3603 54         105 undef($termdef);
3604 54         102 undef($whites);
3605 54         122 undef($nterm);
3606 54         106 undef($rules);
3607 54         126 undef($precterm);
3608              
3609 54         114 undef($start);
3610 54         103 undef($nullable);
3611 54         119 undef($expect);
3612 54         128 undef($defaultaction);
3613 54         114 undef($semantic);
3614 54         113 undef($buildingtree);
3615 54         111 undef($strict);
3616              
3617 54         214 $parsed
3618             }
3619              
3620              
3621              
3622             =for None
3623              
3624             =cut
3625              
3626              
3627             ################ @@@@@@@@@ End of User Code @@@@@@@@@ ###################
3628              
3629              
3630              
3631             1;