File Coverage

blib/lib/Parse/Eyapp/Parse.pm
Criterion Covered Total %
statement 438 678 64.6
branch 157 256 61.3
condition 31 50 62.0
subroutine 62 112 55.3
pod 4 17 23.5
total 692 1113 62.1


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