r4518: added proper support for "typedef enum" in pidl. We can now use enums as types...
[samba.git] / source4 / build / pidl / idl.pm
1 ####################################################################
2 #
3 #    This file was generated using Parse::Yapp version 1.05.
4 #
5 #        Don't edit this file, use source file instead.
6 #
7 #             ANY CHANGE MADE HERE WILL BE LOST !
8 #
9 ####################################################################
10 package idl;
11 use vars qw ( @ISA );
12 use strict;
13
14 @ISA= qw ( Parse::Yapp::Driver );
15 #Included Parse/Yapp/Driver.pm file----------------------------------------
16 {
17 #
18 # Module Parse::Yapp::Driver
19 #
20 # This module is part of the Parse::Yapp package available on your
21 # nearest CPAN
22 #
23 # Any use of this module in a standalone parser make the included
24 # text under the same copyright as the Parse::Yapp module itself.
25 #
26 # This notice should remain unchanged.
27 #
28 # (c) Copyright 1998-2001 Francois Desarmenien, all rights reserved.
29 # (see the pod text in Parse::Yapp module for use and distribution rights)
30 #
31
32 package Parse::Yapp::Driver;
33
34 require 5.004;
35
36 use strict;
37
38 use vars qw ( $VERSION $COMPATIBLE $FILENAME );
39
40 $VERSION = '1.05';
41 $COMPATIBLE = '0.07';
42 $FILENAME=__FILE__;
43
44 use Carp;
45
46 #Known parameters, all starting with YY (leading YY will be discarded)
47 my(%params)=(YYLEX => 'CODE', 'YYERROR' => 'CODE', YYVERSION => '',
48                          YYRULES => 'ARRAY', YYSTATES => 'ARRAY', YYDEBUG => '');
49 #Mandatory parameters
50 my(@params)=('LEX','RULES','STATES');
51
52 sub new {
53     my($class)=shift;
54         my($errst,$nberr,$token,$value,$check,$dotpos);
55     my($self)={ ERROR => \&_Error,
56                                 ERRST => \$errst,
57                 NBERR => \$nberr,
58                                 TOKEN => \$token,
59                                 VALUE => \$value,
60                                 DOTPOS => \$dotpos,
61                                 STACK => [],
62                                 DEBUG => 0,
63                                 CHECK => \$check };
64
65         _CheckParams( [], \%params, \@_, $self );
66
67                 exists($$self{VERSION})
68         and     $$self{VERSION} < $COMPATIBLE
69         and     croak "Yapp driver version $VERSION ".
70                           "incompatible with version $$self{VERSION}:\n".
71                           "Please recompile parser module.";
72
73         ref($class)
74     and $class=ref($class);
75
76     bless($self,$class);
77 }
78
79 sub YYParse {
80     my($self)=shift;
81     my($retval);
82
83         _CheckParams( \@params, \%params, \@_, $self );
84
85         if($$self{DEBUG}) {
86                 _DBLoad();
87                 $retval = eval '$self->_DBParse()';#Do not create stab entry on compile
88         $@ and die $@;
89         }
90         else {
91                 $retval = $self->_Parse();
92         }
93     $retval
94 }
95
96 sub YYData {
97         my($self)=shift;
98
99                 exists($$self{USER})
100         or      $$self{USER}={};
101
102         $$self{USER};
103         
104 }
105
106 sub YYErrok {
107         my($self)=shift;
108
109         ${$$self{ERRST}}=0;
110     undef;
111 }
112
113 sub YYNberr {
114         my($self)=shift;
115
116         ${$$self{NBERR}};
117 }
118
119 sub YYRecovering {
120         my($self)=shift;
121
122         ${$$self{ERRST}} != 0;
123 }
124
125 sub YYAbort {
126         my($self)=shift;
127
128         ${$$self{CHECK}}='ABORT';
129     undef;
130 }
131
132 sub YYAccept {
133         my($self)=shift;
134
135         ${$$self{CHECK}}='ACCEPT';
136     undef;
137 }
138
139 sub YYError {
140         my($self)=shift;
141
142         ${$$self{CHECK}}='ERROR';
143     undef;
144 }
145
146 sub YYSemval {
147         my($self)=shift;
148         my($index)= $_[0] - ${$$self{DOTPOS}} - 1;
149
150                 $index < 0
151         and     -$index <= @{$$self{STACK}}
152         and     return $$self{STACK}[$index][1];
153
154         undef;  #Invalid index
155 }
156
157 sub YYCurtok {
158         my($self)=shift;
159
160         @_
161     and ${$$self{TOKEN}}=$_[0];
162     ${$$self{TOKEN}};
163 }
164
165 sub YYCurval {
166         my($self)=shift;
167
168         @_
169     and ${$$self{VALUE}}=$_[0];
170     ${$$self{VALUE}};
171 }
172
173 sub YYExpect {
174     my($self)=shift;
175
176     keys %{$self->{STATES}[$self->{STACK}[-1][0]]{ACTIONS}}
177 }
178
179 sub YYLexer {
180     my($self)=shift;
181
182         $$self{LEX};
183 }
184
185
186 #################
187 # Private stuff #
188 #################
189
190
191 sub _CheckParams {
192         my($mandatory,$checklist,$inarray,$outhash)=@_;
193         my($prm,$value);
194         my($prmlst)={};
195
196         while(($prm,$value)=splice(@$inarray,0,2)) {
197         $prm=uc($prm);
198                         exists($$checklist{$prm})
199                 or      croak("Unknow parameter '$prm'");
200                         ref($value) eq $$checklist{$prm}
201                 or      croak("Invalid value for parameter '$prm'");
202         $prm=unpack('@2A*',$prm);
203                 $$outhash{$prm}=$value;
204         }
205         for (@$mandatory) {
206                         exists($$outhash{$_})
207                 or      croak("Missing mandatory parameter '".lc($_)."'");
208         }
209 }
210
211 sub _Error {
212         print "Parse error.\n";
213 }
214
215 sub _DBLoad {
216         {
217                 no strict 'refs';
218
219                         exists(${__PACKAGE__.'::'}{_DBParse})#Already loaded ?
220                 and     return;
221         }
222         my($fname)=__FILE__;
223         my(@drv);
224         open(DRV,"<$fname") or die "Report this as a BUG: Cannot open $fname";
225         while(<DRV>) {
226                         /^\s*sub\s+_Parse\s*{\s*$/ .. /^\s*}\s*#\s*_Parse\s*$/
227                 and     do {
228                         s/^#DBG>//;
229                         push(@drv,$_);
230                 }
231         }
232         close(DRV);
233
234         $drv[0]=~s/_P/_DBP/;
235         eval join('',@drv);
236 }
237
238 #Note that for loading debugging version of the driver,
239 #this file will be parsed from 'sub _Parse' up to '}#_Parse' inclusive.
240 #So, DO NOT remove comment at end of sub !!!
241 sub _Parse {
242     my($self)=shift;
243
244         my($rules,$states,$lex,$error)
245      = @$self{ 'RULES', 'STATES', 'LEX', 'ERROR' };
246         my($errstatus,$nberror,$token,$value,$stack,$check,$dotpos)
247      = @$self{ 'ERRST', 'NBERR', 'TOKEN', 'VALUE', 'STACK', 'CHECK', 'DOTPOS' };
248
249 #DBG>   my($debug)=$$self{DEBUG};
250 #DBG>   my($dbgerror)=0;
251
252 #DBG>   my($ShowCurToken) = sub {
253 #DBG>           my($tok)='>';
254 #DBG>           for (split('',$$token)) {
255 #DBG>                   $tok.=          (ord($_) < 32 or ord($_) > 126)
256 #DBG>                                   ?       sprintf('<%02X>',ord($_))
257 #DBG>                                   :       $_;
258 #DBG>           }
259 #DBG>           $tok.='<';
260 #DBG>   };
261
262         $$errstatus=0;
263         $$nberror=0;
264         ($$token,$$value)=(undef,undef);
265         @$stack=( [ 0, undef ] );
266         $$check='';
267
268     while(1) {
269         my($actions,$act,$stateno);
270
271         $stateno=$$stack[-1][0];
272         $actions=$$states[$stateno];
273
274 #DBG>   print STDERR ('-' x 40),"\n";
275 #DBG>           $debug & 0x2
276 #DBG>   and     print STDERR "In state $stateno:\n";
277 #DBG>           $debug & 0x08
278 #DBG>   and     print STDERR "Stack:[".
279 #DBG>                                    join(',',map { $$_[0] } @$stack).
280 #DBG>                                    "]\n";
281
282
283         if  (exists($$actions{ACTIONS})) {
284
285                                 defined($$token)
286             or  do {
287                                 ($$token,$$value)=&$lex($self);
288 #DBG>                           $debug & 0x01
289 #DBG>                   and     print STDERR "Need token. Got ".&$ShowCurToken."\n";
290                         };
291
292             $act=   exists($$actions{ACTIONS}{$$token})
293                     ?   $$actions{ACTIONS}{$$token}
294                     :   exists($$actions{DEFAULT})
295                         ?   $$actions{DEFAULT}
296                         :   undef;
297         }
298         else {
299             $act=$$actions{DEFAULT};
300 #DBG>                   $debug & 0x01
301 #DBG>           and     print STDERR "Don't need token.\n";
302         }
303
304             defined($act)
305         and do {
306
307                 $act > 0
308             and do {        #shift
309
310 #DBG>                           $debug & 0x04
311 #DBG>                   and     print STDERR "Shift and go to state $act.\n";
312
313                                         $$errstatus
314                                 and     do {
315                                         --$$errstatus;
316
317 #DBG>                                   $debug & 0x10
318 #DBG>                           and     $dbgerror
319 #DBG>                           and     $$errstatus == 0
320 #DBG>                           and     do {
321 #DBG>                                   print STDERR "**End of Error recovery.\n";
322 #DBG>                                   $dbgerror=0;
323 #DBG>                           };
324                                 };
325
326
327                 push(@$stack,[ $act, $$value ]);
328
329                                         $$token ne ''   #Don't eat the eof
330                                 and     $$token=$$value=undef;
331                 next;
332             };
333
334             #reduce
335             my($lhs,$len,$code,@sempar,$semval);
336             ($lhs,$len,$code)=@{$$rules[-$act]};
337
338 #DBG>                   $debug & 0x04
339 #DBG>           and     $act
340 #DBG>           and     print STDERR "Reduce using rule ".-$act." ($lhs,$len): ";
341
342                 $act
343             or  $self->YYAccept();
344
345             $$dotpos=$len;
346
347                 unpack('A1',$lhs) eq '@'    #In line rule
348             and do {
349                     $lhs =~ /^\@[0-9]+\-([0-9]+)$/
350                 or  die "In line rule name '$lhs' ill formed: ".
351                         "report it as a BUG.\n";
352                 $$dotpos = $1;
353             };
354
355             @sempar =       $$dotpos
356                         ?   map { $$_[1] } @$stack[ -$$dotpos .. -1 ]
357                         :   ();
358
359             $semval = $code ? &$code( $self, @sempar )
360                             : @sempar ? $sempar[0] : undef;
361
362             splice(@$stack,-$len,$len);
363
364                 $$check eq 'ACCEPT'
365             and do {
366
367 #DBG>                   $debug & 0x04
368 #DBG>           and     print STDERR "Accept.\n";
369
370                                 return($semval);
371                         };
372
373                 $$check eq 'ABORT'
374             and do {
375
376 #DBG>                   $debug & 0x04
377 #DBG>           and     print STDERR "Abort.\n";
378
379                                 return(undef);
380
381                         };
382
383 #DBG>                   $debug & 0x04
384 #DBG>           and     print STDERR "Back to state $$stack[-1][0], then ";
385
386                 $$check eq 'ERROR'
387             or  do {
388 #DBG>                           $debug & 0x04
389 #DBG>                   and     print STDERR 
390 #DBG>                               "go to state $$states[$$stack[-1][0]]{GOTOS}{$lhs}.\n";
391
392 #DBG>                           $debug & 0x10
393 #DBG>                   and     $dbgerror
394 #DBG>                   and     $$errstatus == 0
395 #DBG>                   and     do {
396 #DBG>                           print STDERR "**End of Error recovery.\n";
397 #DBG>                           $dbgerror=0;
398 #DBG>                   };
399
400                             push(@$stack,
401                      [ $$states[$$stack[-1][0]]{GOTOS}{$lhs}, $semval ]);
402                 $$check='';
403                 next;
404             };
405
406 #DBG>                   $debug & 0x04
407 #DBG>           and     print STDERR "Forced Error recovery.\n";
408
409             $$check='';
410
411         };
412
413         #Error
414             $$errstatus
415         or   do {
416
417             $$errstatus = 1;
418             &$error($self);
419                 $$errstatus # if 0, then YYErrok has been called
420             or  next;       # so continue parsing
421
422 #DBG>                   $debug & 0x10
423 #DBG>           and     do {
424 #DBG>                   print STDERR "**Entering Error recovery.\n";
425 #DBG>                   ++$dbgerror;
426 #DBG>           };
427
428             ++$$nberror;
429
430         };
431
432                         $$errstatus == 3        #The next token is not valid: discard it
433                 and     do {
434                                 $$token eq ''   # End of input: no hope
435                         and     do {
436 #DBG>                           $debug & 0x10
437 #DBG>                   and     print STDERR "**At eof: aborting.\n";
438                                 return(undef);
439                         };
440
441 #DBG>                   $debug & 0x10
442 #DBG>           and     print STDERR "**Dicard invalid token ".&$ShowCurToken.".\n";
443
444                         $$token=$$value=undef;
445                 };
446
447         $$errstatus=3;
448
449                 while(    @$stack
450                           and (         not exists($$states[$$stack[-1][0]]{ACTIONS})
451                                 or  not exists($$states[$$stack[-1][0]]{ACTIONS}{error})
452                                         or      $$states[$$stack[-1][0]]{ACTIONS}{error} <= 0)) {
453
454 #DBG>                   $debug & 0x10
455 #DBG>           and     print STDERR "**Pop state $$stack[-1][0].\n";
456
457                         pop(@$stack);
458                 }
459
460                         @$stack
461                 or      do {
462
463 #DBG>                   $debug & 0x10
464 #DBG>           and     print STDERR "**No state left on stack: aborting.\n";
465
466                         return(undef);
467                 };
468
469                 #shift the error token
470
471 #DBG>                   $debug & 0x10
472 #DBG>           and     print STDERR "**Shift \$error token and go to state ".
473 #DBG>                                            $$states[$$stack[-1][0]]{ACTIONS}{error}.
474 #DBG>                                            ".\n";
475
476                 push(@$stack, [ $$states[$$stack[-1][0]]{ACTIONS}{error}, undef ]);
477
478     }
479
480     #never reached
481         croak("Error in driver logic. Please, report it as a BUG");
482
483 }#_Parse
484 #DO NOT remove comment
485
486 1;
487
488 }
489 #End of include--------------------------------------------------
490
491
492
493
494 sub new {
495         my($class)=shift;
496         ref($class)
497     and $class=ref($class);
498
499     my($self)=$class->SUPER::new( yyversion => '1.05',
500                                   yystates =>
501 [
502         {#State 0
503                 DEFAULT => -1,
504                 GOTOS => {
505                         'idl' => 1
506                 }
507         },
508         {#State 1
509                 ACTIONS => {
510                         '' => 2
511                 },
512                 DEFAULT => -49,
513                 GOTOS => {
514                         'interface' => 3,
515                         'coclass' => 4,
516                         'property_list' => 5
517                 }
518         },
519         {#State 2
520                 DEFAULT => 0
521         },
522         {#State 3
523                 DEFAULT => -2
524         },
525         {#State 4
526                 DEFAULT => -3
527         },
528         {#State 5
529                 ACTIONS => {
530                         "coclass" => 6,
531                         "interface" => 8,
532                         "[" => 7
533                 }
534         },
535         {#State 6
536                 ACTIONS => {
537                         'IDENTIFIER' => 9
538                 },
539                 GOTOS => {
540                         'identifier' => 10
541                 }
542         },
543         {#State 7
544                 ACTIONS => {
545                         'IDENTIFIER' => 9
546                 },
547                 GOTOS => {
548                         'identifier' => 11,
549                         'properties' => 13,
550                         'property' => 12
551                 }
552         },
553         {#State 8
554                 ACTIONS => {
555                         'IDENTIFIER' => 9
556                 },
557                 GOTOS => {
558                         'identifier' => 14
559                 }
560         },
561         {#State 9
562                 DEFAULT => -73
563         },
564         {#State 10
565                 ACTIONS => {
566                         "{" => 15
567                 }
568         },
569         {#State 11
570                 ACTIONS => {
571                         "(" => 16
572                 },
573                 DEFAULT => -53
574         },
575         {#State 12
576                 DEFAULT => -51
577         },
578         {#State 13
579                 ACTIONS => {
580                         "," => 17,
581                         "]" => 18
582                 }
583         },
584         {#State 14
585                 ACTIONS => {
586                         ":" => 19
587                 },
588                 DEFAULT => -8,
589                 GOTOS => {
590                         'base_interface' => 20
591                 }
592         },
593         {#State 15
594                 DEFAULT => -5,
595                 GOTOS => {
596                         'interfaces' => 21
597                 }
598         },
599         {#State 16
600                 ACTIONS => {
601                         'CONSTANT' => 28,
602                         'TEXT' => 22,
603                         'IDENTIFIER' => 9
604                 },
605                 DEFAULT => -59,
606                 GOTOS => {
607                         'identifier' => 23,
608                         'listtext' => 26,
609                         'anytext' => 25,
610                         'text' => 24,
611                         'constant' => 27
612                 }
613         },
614         {#State 17
615                 ACTIONS => {
616                         'IDENTIFIER' => 9
617                 },
618                 GOTOS => {
619                         'identifier' => 11,
620                         'property' => 29
621                 }
622         },
623         {#State 18
624                 DEFAULT => -50
625         },
626         {#State 19
627                 ACTIONS => {
628                         'IDENTIFIER' => 9
629                 },
630                 GOTOS => {
631                         'identifier' => 30
632                 }
633         },
634         {#State 20
635                 ACTIONS => {
636                         "{" => 31
637                 }
638         },
639         {#State 21
640                 ACTIONS => {
641                         "}" => 32
642                 },
643                 DEFAULT => -49,
644                 GOTOS => {
645                         'interface' => 33,
646                         'property_list' => 34
647                 }
648         },
649         {#State 22
650                 DEFAULT => -75
651         },
652         {#State 23
653                 DEFAULT => -60
654         },
655         {#State 24
656                 DEFAULT => -62
657         },
658         {#State 25
659                 ACTIONS => {
660                         "-" => 35,
661                         "+" => 36,
662                         "&" => 38,
663                         "{" => 37,
664                         "/" => 39,
665                         "|" => 40,
666                         "(" => 41,
667                         "*" => 42,
668                         "." => 43,
669                         ">" => 44
670                 },
671                 DEFAULT => -55
672         },
673         {#State 26
674                 ACTIONS => {
675                         "," => 45,
676                         ")" => 46
677                 }
678         },
679         {#State 27
680                 DEFAULT => -61
681         },
682         {#State 28
683                 DEFAULT => -74
684         },
685         {#State 29
686                 DEFAULT => -52
687         },
688         {#State 30
689                 DEFAULT => -9
690         },
691         {#State 31
692                 ACTIONS => {
693                         "typedef" => 47,
694                         "const" => 53
695                 },
696                 DEFAULT => -49,
697                 GOTOS => {
698                         'const' => 52,
699                         'function' => 48,
700                         'typedef' => 54,
701                         'definitions' => 49,
702                         'definition' => 51,
703                         'property_list' => 50
704                 }
705         },
706         {#State 32
707                 ACTIONS => {
708                         ";" => 56
709                 },
710                 DEFAULT => -76,
711                 GOTOS => {
712                         'optional_semicolon' => 55
713                 }
714         },
715         {#State 33
716                 DEFAULT => -6
717         },
718         {#State 34
719                 ACTIONS => {
720                         "[" => 7,
721                         "interface" => 8
722                 }
723         },
724         {#State 35
725                 ACTIONS => {
726                         'CONSTANT' => 28,
727                         'TEXT' => 22,
728                         'IDENTIFIER' => 9
729                 },
730                 DEFAULT => -59,
731                 GOTOS => {
732                         'identifier' => 23,
733                         'text' => 24,
734                         'anytext' => 57,
735                         'constant' => 27
736                 }
737         },
738         {#State 36
739                 ACTIONS => {
740                         'CONSTANT' => 28,
741                         'TEXT' => 22,
742                         'IDENTIFIER' => 9
743                 },
744                 DEFAULT => -59,
745                 GOTOS => {
746                         'identifier' => 23,
747                         'text' => 24,
748                         'anytext' => 58,
749                         'constant' => 27
750                 }
751         },
752         {#State 37
753                 ACTIONS => {
754                         'CONSTANT' => 28,
755                         'TEXT' => 22,
756                         'IDENTIFIER' => 9
757                 },
758                 DEFAULT => -59,
759                 GOTOS => {
760                         'identifier' => 23,
761                         'text' => 24,
762                         'anytext' => 59,
763                         'constant' => 27,
764                         'commalisttext' => 60
765                 }
766         },
767         {#State 38
768                 ACTIONS => {
769                         'CONSTANT' => 28,
770                         'TEXT' => 22,
771                         'IDENTIFIER' => 9
772                 },
773                 DEFAULT => -59,
774                 GOTOS => {
775                         'identifier' => 23,
776                         'text' => 24,
777                         'anytext' => 61,
778                         'constant' => 27
779                 }
780         },
781         {#State 39
782                 ACTIONS => {
783                         'CONSTANT' => 28,
784                         'TEXT' => 22,
785                         'IDENTIFIER' => 9
786                 },
787                 DEFAULT => -59,
788                 GOTOS => {
789                         'identifier' => 23,
790                         'text' => 24,
791                         'anytext' => 62,
792                         'constant' => 27
793                 }
794         },
795         {#State 40
796                 ACTIONS => {
797                         'CONSTANT' => 28,
798                         'TEXT' => 22,
799                         'IDENTIFIER' => 9
800                 },
801                 DEFAULT => -59,
802                 GOTOS => {
803                         'identifier' => 23,
804                         'text' => 24,
805                         'anytext' => 63,
806                         'constant' => 27
807                 }
808         },
809         {#State 41
810                 ACTIONS => {
811                         'CONSTANT' => 28,
812                         'TEXT' => 22,
813                         'IDENTIFIER' => 9
814                 },
815                 DEFAULT => -59,
816                 GOTOS => {
817                         'identifier' => 23,
818                         'text' => 24,
819                         'anytext' => 59,
820                         'constant' => 27,
821                         'commalisttext' => 64
822                 }
823         },
824         {#State 42
825                 ACTIONS => {
826                         'CONSTANT' => 28,
827                         'TEXT' => 22,
828                         'IDENTIFIER' => 9
829                 },
830                 DEFAULT => -59,
831                 GOTOS => {
832                         'identifier' => 23,
833                         'text' => 24,
834                         'anytext' => 65,
835                         'constant' => 27
836                 }
837         },
838         {#State 43
839                 ACTIONS => {
840                         'CONSTANT' => 28,
841                         'TEXT' => 22,
842                         'IDENTIFIER' => 9
843                 },
844                 DEFAULT => -59,
845                 GOTOS => {
846                         'identifier' => 23,
847                         'text' => 24,
848                         'anytext' => 66,
849                         'constant' => 27
850                 }
851         },
852         {#State 44
853                 ACTIONS => {
854                         'CONSTANT' => 28,
855                         'TEXT' => 22,
856                         'IDENTIFIER' => 9
857                 },
858                 DEFAULT => -59,
859                 GOTOS => {
860                         'identifier' => 23,
861                         'text' => 24,
862                         'anytext' => 67,
863                         'constant' => 27
864                 }
865         },
866         {#State 45
867                 ACTIONS => {
868                         'CONSTANT' => 28,
869                         'TEXT' => 22,
870                         'IDENTIFIER' => 9
871                 },
872                 DEFAULT => -59,
873                 GOTOS => {
874                         'identifier' => 23,
875                         'text' => 24,
876                         'anytext' => 68,
877                         'constant' => 27
878                 }
879         },
880         {#State 46
881                 DEFAULT => -54
882         },
883         {#State 47
884                 DEFAULT => -49,
885                 GOTOS => {
886                         'property_list' => 69
887                 }
888         },
889         {#State 48
890                 DEFAULT => -12
891         },
892         {#State 49
893                 ACTIONS => {
894                         "}" => 70,
895                         "typedef" => 47,
896                         "const" => 53
897                 },
898                 DEFAULT => -49,
899                 GOTOS => {
900                         'const' => 52,
901                         'function' => 48,
902                         'typedef' => 54,
903                         'definition' => 71,
904                         'property_list' => 50
905                 }
906         },
907         {#State 50
908                 ACTIONS => {
909                         'IDENTIFIER' => 9,
910                         "enum" => 72,
911                         "[" => 7,
912                         'void' => 73
913                 },
914                 DEFAULT => -49,
915                 GOTOS => {
916                         'identifier' => 75,
917                         'struct' => 76,
918                         'enum' => 77,
919                         'type' => 78,
920                         'union' => 79,
921                         'property_list' => 74
922                 }
923         },
924         {#State 51
925                 DEFAULT => -10
926         },
927         {#State 52
928                 DEFAULT => -13
929         },
930         {#State 53
931                 ACTIONS => {
932                         'IDENTIFIER' => 9
933                 },
934                 GOTOS => {
935                         'identifier' => 80
936                 }
937         },
938         {#State 54
939                 DEFAULT => -14
940         },
941         {#State 55
942                 DEFAULT => -4
943         },
944         {#State 56
945                 DEFAULT => -77
946         },
947         {#State 57
948                 ACTIONS => {
949                         "{" => 37
950                 },
951                 DEFAULT => -63
952         },
953         {#State 58
954                 ACTIONS => {
955                         "{" => 37
956                 },
957                 DEFAULT => -70
958         },
959         {#State 59
960                 ACTIONS => {
961                         "-" => 35,
962                         "+" => 36,
963                         "&" => 38,
964                         "{" => 37,
965                         "/" => 39,
966                         "(" => 41,
967                         "|" => 40,
968                         "*" => 42,
969                         "." => 43,
970                         ">" => 44
971                 },
972                 DEFAULT => -57
973         },
974         {#State 60
975                 ACTIONS => {
976                         "}" => 81,
977                         "," => 82
978                 }
979         },
980         {#State 61
981                 ACTIONS => {
982                         "{" => 37
983                 },
984                 DEFAULT => -68
985         },
986         {#State 62
987                 ACTIONS => {
988                         "{" => 37
989                 },
990                 DEFAULT => -69
991         },
992         {#State 63
993                 ACTIONS => {
994                         "{" => 37
995                 },
996                 DEFAULT => -67
997         },
998         {#State 64
999                 ACTIONS => {
1000                         "," => 82,
1001                         ")" => 83
1002                 }
1003         },
1004         {#State 65
1005                 ACTIONS => {
1006                         "{" => 37
1007                 },
1008                 DEFAULT => -65
1009         },
1010         {#State 66
1011                 ACTIONS => {
1012                         "{" => 37
1013                 },
1014                 DEFAULT => -64
1015         },
1016         {#State 67
1017                 ACTIONS => {
1018                         "{" => 37
1019                 },
1020                 DEFAULT => -66
1021         },
1022         {#State 68
1023                 ACTIONS => {
1024                         "-" => 35,
1025                         "+" => 36,
1026                         "&" => 38,
1027                         "{" => 37,
1028                         "/" => 39,
1029                         "(" => 41,
1030                         "|" => 40,
1031                         "*" => 42,
1032                         "." => 43,
1033                         ">" => 44
1034                 },
1035                 DEFAULT => -56
1036         },
1037         {#State 69
1038                 ACTIONS => {
1039                         'IDENTIFIER' => 9,
1040                         "enum" => 72,
1041                         "[" => 7,
1042                         'void' => 73
1043                 },
1044                 DEFAULT => -49,
1045                 GOTOS => {
1046                         'identifier' => 75,
1047                         'struct' => 76,
1048                         'enum' => 77,
1049                         'type' => 84,
1050                         'union' => 79,
1051                         'property_list' => 74
1052                 }
1053         },
1054         {#State 70
1055                 ACTIONS => {
1056                         ";" => 56
1057                 },
1058                 DEFAULT => -76,
1059                 GOTOS => {
1060                         'optional_semicolon' => 85
1061                 }
1062         },
1063         {#State 71
1064                 DEFAULT => -11
1065         },
1066         {#State 72
1067                 ACTIONS => {
1068                         "{" => 86
1069                 }
1070         },
1071         {#State 73
1072                 DEFAULT => -23
1073         },
1074         {#State 74
1075                 ACTIONS => {
1076                         "union" => 87,
1077                         "[" => 7,
1078                         "struct" => 88
1079                 }
1080         },
1081         {#State 75
1082                 DEFAULT => -22
1083         },
1084         {#State 76
1085                 DEFAULT => -19
1086         },
1087         {#State 77
1088                 DEFAULT => -21
1089         },
1090         {#State 78
1091                 ACTIONS => {
1092                         'IDENTIFIER' => 9
1093                 },
1094                 GOTOS => {
1095                         'identifier' => 89
1096                 }
1097         },
1098         {#State 79
1099                 DEFAULT => -20
1100         },
1101         {#State 80
1102                 ACTIONS => {
1103                         'IDENTIFIER' => 9
1104                 },
1105                 GOTOS => {
1106                         'identifier' => 90
1107                 }
1108         },
1109         {#State 81
1110                 ACTIONS => {
1111                         'CONSTANT' => 28,
1112                         'TEXT' => 22,
1113                         'IDENTIFIER' => 9
1114                 },
1115                 DEFAULT => -59,
1116                 GOTOS => {
1117                         'identifier' => 23,
1118                         'text' => 24,
1119                         'anytext' => 91,
1120                         'constant' => 27
1121                 }
1122         },
1123         {#State 82
1124                 ACTIONS => {
1125                         'CONSTANT' => 28,
1126                         'TEXT' => 22,
1127                         'IDENTIFIER' => 9
1128                 },
1129                 DEFAULT => -59,
1130                 GOTOS => {
1131                         'identifier' => 23,
1132                         'text' => 24,
1133                         'anytext' => 92,
1134                         'constant' => 27
1135                 }
1136         },
1137         {#State 83
1138                 ACTIONS => {
1139                         'CONSTANT' => 28,
1140                         'TEXT' => 22,
1141                         'IDENTIFIER' => 9
1142                 },
1143                 DEFAULT => -59,
1144                 GOTOS => {
1145                         'identifier' => 23,
1146                         'text' => 24,
1147                         'anytext' => 93,
1148                         'constant' => 27
1149                 }
1150         },
1151         {#State 84
1152                 ACTIONS => {
1153                         'IDENTIFIER' => 9
1154                 },
1155                 GOTOS => {
1156                         'identifier' => 94
1157                 }
1158         },
1159         {#State 85
1160                 DEFAULT => -7
1161         },
1162         {#State 86
1163                 ACTIONS => {
1164                         'IDENTIFIER' => 9
1165                 },
1166                 GOTOS => {
1167                         'identifier' => 95,
1168                         'enum_element' => 96,
1169                         'enum_elements' => 97
1170                 }
1171         },
1172         {#State 87
1173                 ACTIONS => {
1174                         "{" => 98
1175                 }
1176         },
1177         {#State 88
1178                 ACTIONS => {
1179                         "{" => 99
1180                 }
1181         },
1182         {#State 89
1183                 ACTIONS => {
1184                         "(" => 100
1185                 }
1186         },
1187         {#State 90
1188                 ACTIONS => {
1189                         "[" => 103,
1190                         "=" => 102
1191                 },
1192                 GOTOS => {
1193                         'array_len' => 101
1194                 }
1195         },
1196         {#State 91
1197                 ACTIONS => {
1198                         "-" => 35,
1199                         "+" => 36,
1200                         "*" => 42,
1201                         "{" => 37,
1202                         "&" => 38,
1203                         "/" => 39,
1204                         "|" => 40,
1205                         "(" => 41,
1206                         "." => 43,
1207                         ">" => 44
1208                 },
1209                 DEFAULT => -72
1210         },
1211         {#State 92
1212                 ACTIONS => {
1213                         "-" => 35,
1214                         "+" => 36,
1215                         "&" => 38,
1216                         "{" => 37,
1217                         "/" => 39,
1218                         "(" => 41,
1219                         "|" => 40,
1220                         "*" => 42,
1221                         "." => 43,
1222                         ">" => 44
1223                 },
1224                 DEFAULT => -58
1225         },
1226         {#State 93
1227                 ACTIONS => {
1228                         "{" => 37
1229                 },
1230                 DEFAULT => -71
1231         },
1232         {#State 94
1233                 ACTIONS => {
1234                         "[" => 103
1235                 },
1236                 DEFAULT => -46,
1237                 GOTOS => {
1238                         'array_len' => 104
1239                 }
1240         },
1241         {#State 95
1242                 ACTIONS => {
1243                         "=" => 105
1244                 },
1245                 DEFAULT => -27
1246         },
1247         {#State 96
1248                 DEFAULT => -25
1249         },
1250         {#State 97
1251                 ACTIONS => {
1252                         "}" => 106,
1253                         "," => 107
1254                 }
1255         },
1256         {#State 98
1257                 ACTIONS => {
1258                         "[" => 110
1259                 },
1260                 GOTOS => {
1261                         'union_elements' => 108,
1262                         'union_element' => 109
1263                 }
1264         },
1265         {#State 99
1266                 DEFAULT => -40,
1267                 GOTOS => {
1268                         'element_list1' => 111
1269                 }
1270         },
1271         {#State 100
1272                 ACTIONS => {
1273                         "," => -42,
1274                         "void" => 114,
1275                         ")" => -42
1276                 },
1277                 DEFAULT => -49,
1278                 GOTOS => {
1279                         'base_element' => 112,
1280                         'element_list2' => 115,
1281                         'property_list' => 113
1282                 }
1283         },
1284         {#State 101
1285                 ACTIONS => {
1286                         "=" => 116
1287                 }
1288         },
1289         {#State 102
1290                 ACTIONS => {
1291                         'IDENTIFIER' => 9,
1292                         'CONSTANT' => 28,
1293                         'TEXT' => 22
1294                 },
1295                 DEFAULT => -59,
1296                 GOTOS => {
1297                         'identifier' => 23,
1298                         'text' => 24,
1299                         'anytext' => 117,
1300                         'constant' => 27
1301                 }
1302         },
1303         {#State 103
1304                 ACTIONS => {
1305                         'IDENTIFIER' => 9,
1306                         'CONSTANT' => 28,
1307                         'TEXT' => 22,
1308                         "]" => 119
1309                 },
1310                 DEFAULT => -59,
1311                 GOTOS => {
1312                         'identifier' => 23,
1313                         'text' => 24,
1314                         'anytext' => 118,
1315                         'constant' => 27
1316                 }
1317         },
1318         {#State 104
1319                 ACTIONS => {
1320                         ";" => 120
1321                 }
1322         },
1323         {#State 105
1324                 ACTIONS => {
1325                         'CONSTANT' => 28,
1326                         'TEXT' => 22,
1327                         'IDENTIFIER' => 9
1328                 },
1329                 DEFAULT => -59,
1330                 GOTOS => {
1331                         'identifier' => 23,
1332                         'text' => 24,
1333                         'anytext' => 121,
1334                         'constant' => 27
1335                 }
1336         },
1337         {#State 106
1338                 DEFAULT => -24
1339         },
1340         {#State 107
1341                 ACTIONS => {
1342                         'IDENTIFIER' => 9
1343                 },
1344                 GOTOS => {
1345                         'identifier' => 95,
1346                         'enum_element' => 122
1347                 }
1348         },
1349         {#State 108
1350                 ACTIONS => {
1351                         "}" => 123,
1352                         "[" => 110
1353                 },
1354                 GOTOS => {
1355                         'union_element' => 124
1356                 }
1357         },
1358         {#State 109
1359                 DEFAULT => -31
1360         },
1361         {#State 110
1362                 ACTIONS => {
1363                         "case" => 125,
1364                         "default" => 126
1365                 }
1366         },
1367         {#State 111
1368                 ACTIONS => {
1369                         "}" => 127
1370                 },
1371                 DEFAULT => -49,
1372                 GOTOS => {
1373                         'base_element' => 128,
1374                         'property_list' => 113
1375                 }
1376         },
1377         {#State 112
1378                 DEFAULT => -44
1379         },
1380         {#State 113
1381                 ACTIONS => {
1382                         'IDENTIFIER' => 9,
1383                         "enum" => 72,
1384                         "[" => 7,
1385                         'void' => 73
1386                 },
1387                 DEFAULT => -49,
1388                 GOTOS => {
1389                         'identifier' => 75,
1390                         'struct' => 76,
1391                         'enum' => 77,
1392                         'type' => 129,
1393                         'union' => 79,
1394                         'property_list' => 74
1395                 }
1396         },
1397         {#State 114
1398                 DEFAULT => -43
1399         },
1400         {#State 115
1401                 ACTIONS => {
1402                         "," => 130,
1403                         ")" => 131
1404                 }
1405         },
1406         {#State 116
1407                 ACTIONS => {
1408                         'IDENTIFIER' => 9,
1409                         'CONSTANT' => 28,
1410                         'TEXT' => 22
1411                 },
1412                 DEFAULT => -59,
1413                 GOTOS => {
1414                         'identifier' => 23,
1415                         'text' => 24,
1416                         'anytext' => 132,
1417                         'constant' => 27
1418                 }
1419         },
1420         {#State 117
1421                 ACTIONS => {
1422                         "-" => 35,
1423                         ";" => 133,
1424                         "+" => 36,
1425                         "&" => 38,
1426                         "{" => 37,
1427                         "/" => 39,
1428                         "(" => 41,
1429                         "|" => 40,
1430                         "*" => 42,
1431                         "." => 43,
1432                         ">" => 44
1433                 }
1434         },
1435         {#State 118
1436                 ACTIONS => {
1437                         "-" => 35,
1438                         "+" => 36,
1439                         "&" => 38,
1440                         "{" => 37,
1441                         "/" => 39,
1442                         "(" => 41,
1443                         "|" => 40,
1444                         "*" => 42,
1445                         "." => 43,
1446                         "]" => 134,
1447                         ">" => 44
1448                 }
1449         },
1450         {#State 119
1451                 DEFAULT => -47
1452         },
1453         {#State 120
1454                 DEFAULT => -18
1455         },
1456         {#State 121
1457                 ACTIONS => {
1458                         "-" => 35,
1459                         "+" => 36,
1460                         "&" => 38,
1461                         "{" => 37,
1462                         "/" => 39,
1463                         "(" => 41,
1464                         "|" => 40,
1465                         "*" => 42,
1466                         "." => 43,
1467                         ">" => 44
1468                 },
1469                 DEFAULT => -28
1470         },
1471         {#State 122
1472                 DEFAULT => -26
1473         },
1474         {#State 123
1475                 DEFAULT => -30
1476         },
1477         {#State 124
1478                 DEFAULT => -32
1479         },
1480         {#State 125
1481                 ACTIONS => {
1482                         "(" => 135
1483                 }
1484         },
1485         {#State 126
1486                 ACTIONS => {
1487                         "]" => 136
1488                 }
1489         },
1490         {#State 127
1491                 DEFAULT => -29
1492         },
1493         {#State 128
1494                 ACTIONS => {
1495                         ";" => 137
1496                 }
1497         },
1498         {#State 129
1499                 DEFAULT => -38,
1500                 GOTOS => {
1501                         'pointers' => 138
1502                 }
1503         },
1504         {#State 130
1505                 DEFAULT => -49,
1506                 GOTOS => {
1507                         'base_element' => 139,
1508                         'property_list' => 113
1509                 }
1510         },
1511         {#State 131
1512                 ACTIONS => {
1513                         ";" => 140
1514                 }
1515         },
1516         {#State 132
1517                 ACTIONS => {
1518                         "-" => 35,
1519                         ";" => 141,
1520                         "+" => 36,
1521                         "&" => 38,
1522                         "{" => 37,
1523                         "/" => 39,
1524                         "(" => 41,
1525                         "|" => 40,
1526                         "*" => 42,
1527                         "." => 43,
1528                         ">" => 44
1529                 }
1530         },
1531         {#State 133
1532                 DEFAULT => -15
1533         },
1534         {#State 134
1535                 DEFAULT => -48
1536         },
1537         {#State 135
1538                 ACTIONS => {
1539                         'IDENTIFIER' => 9,
1540                         'CONSTANT' => 28,
1541                         'TEXT' => 22
1542                 },
1543                 DEFAULT => -59,
1544                 GOTOS => {
1545                         'identifier' => 23,
1546                         'text' => 24,
1547                         'anytext' => 142,
1548                         'constant' => 27
1549                 }
1550         },
1551         {#State 136
1552                 ACTIONS => {
1553                         ";" => 143
1554                 },
1555                 DEFAULT => -49,
1556                 GOTOS => {
1557                         'base_element' => 144,
1558                         'property_list' => 113
1559                 }
1560         },
1561         {#State 137
1562                 DEFAULT => -41
1563         },
1564         {#State 138
1565                 ACTIONS => {
1566                         'IDENTIFIER' => 9,
1567                         "*" => 146
1568                 },
1569                 GOTOS => {
1570                         'identifier' => 145
1571                 }
1572         },
1573         {#State 139
1574                 DEFAULT => -45
1575         },
1576         {#State 140
1577                 DEFAULT => -17
1578         },
1579         {#State 141
1580                 DEFAULT => -16
1581         },
1582         {#State 142
1583                 ACTIONS => {
1584                         "-" => 35,
1585                         "+" => 36,
1586                         "&" => 38,
1587                         "{" => 37,
1588                         "/" => 39,
1589                         "(" => 41,
1590                         "|" => 40,
1591                         "*" => 42,
1592                         "." => 43,
1593                         ")" => 147,
1594                         ">" => 44
1595                 }
1596         },
1597         {#State 143
1598                 DEFAULT => -36
1599         },
1600         {#State 144
1601                 ACTIONS => {
1602                         ";" => 148
1603                 }
1604         },
1605         {#State 145
1606                 ACTIONS => {
1607                         "[" => 103
1608                 },
1609                 DEFAULT => -46,
1610                 GOTOS => {
1611                         'array_len' => 149
1612                 }
1613         },
1614         {#State 146
1615                 DEFAULT => -39
1616         },
1617         {#State 147
1618                 ACTIONS => {
1619                         "]" => 150
1620                 }
1621         },
1622         {#State 148
1623                 DEFAULT => -35
1624         },
1625         {#State 149
1626                 DEFAULT => -37
1627         },
1628         {#State 150
1629                 ACTIONS => {
1630                         ";" => 151
1631                 },
1632                 DEFAULT => -49,
1633                 GOTOS => {
1634                         'base_element' => 152,
1635                         'property_list' => 113
1636                 }
1637         },
1638         {#State 151
1639                 DEFAULT => -34
1640         },
1641         {#State 152
1642                 ACTIONS => {
1643                         ";" => 153
1644                 }
1645         },
1646         {#State 153
1647                 DEFAULT => -33
1648         }
1649 ],
1650                                   yyrules  =>
1651 [
1652         [#Rule 0
1653                  '$start', 2, undef
1654         ],
1655         [#Rule 1
1656                  'idl', 0, undef
1657         ],
1658         [#Rule 2
1659                  'idl', 2,
1660 sub
1661 #line 19 "build/pidl/idl.yp"
1662 { push(@{$_[1]}, $_[2]); $_[1] }
1663         ],
1664         [#Rule 3
1665                  'idl', 2,
1666 sub
1667 #line 20 "build/pidl/idl.yp"
1668 { push(@{$_[1]}, $_[2]); $_[1] }
1669         ],
1670         [#Rule 4
1671                  'coclass', 7,
1672 sub
1673 #line 24 "build/pidl/idl.yp"
1674 {$_[3] => {
1675                "TYPE" => "COCLASS", 
1676                            "PROPERTIES" => $_[1],
1677                        "NAME" => $_[3],
1678                        "DATA" => $_[5],
1679           }}
1680         ],
1681         [#Rule 5
1682                  'interfaces', 0, undef
1683         ],
1684         [#Rule 6
1685                  'interfaces', 2,
1686 sub
1687 #line 34 "build/pidl/idl.yp"
1688 { push(@{$_[1]}, $_[2]); $_[1] }
1689         ],
1690         [#Rule 7
1691                  'interface', 8,
1692 sub
1693 #line 38 "build/pidl/idl.yp"
1694 {$_[3] => {
1695                "TYPE" => "INTERFACE", 
1696                            "PROPERTIES" => $_[1],
1697                        "NAME" => $_[3],
1698                            "BASE" => $_[4],
1699                        "DATA" => $_[6],
1700           }}
1701         ],
1702         [#Rule 8
1703                  'base_interface', 0, undef
1704         ],
1705         [#Rule 9
1706                  'base_interface', 2,
1707 sub
1708 #line 49 "build/pidl/idl.yp"
1709 { $_[2] }
1710         ],
1711         [#Rule 10
1712                  'definitions', 1,
1713 sub
1714 #line 53 "build/pidl/idl.yp"
1715 { [ $_[1] ] }
1716         ],
1717         [#Rule 11
1718                  'definitions', 2,
1719 sub
1720 #line 54 "build/pidl/idl.yp"
1721 { push(@{$_[1]}, $_[2]); $_[1] }
1722         ],
1723         [#Rule 12
1724                  'definition', 1, undef
1725         ],
1726         [#Rule 13
1727                  'definition', 1, undef
1728         ],
1729         [#Rule 14
1730                  'definition', 1, undef
1731         ],
1732         [#Rule 15
1733                  'const', 6,
1734 sub
1735 #line 62 "build/pidl/idl.yp"
1736 {{
1737                      "TYPE"  => "CONST", 
1738                      "DTYPE"  => $_[2],
1739                      "NAME"  => $_[3],
1740                      "VALUE" => $_[5]
1741         }}
1742         ],
1743         [#Rule 16
1744                  'const', 7,
1745 sub
1746 #line 69 "build/pidl/idl.yp"
1747 {{
1748                      "TYPE"  => "CONST", 
1749                      "DTYPE"  => $_[2],
1750                      "NAME"  => $_[3],
1751                      "ARRAY_LEN" => $_[4],
1752                      "VALUE" => $_[6],
1753         }}
1754         ],
1755         [#Rule 17
1756                  'function', 7,
1757 sub
1758 #line 80 "build/pidl/idl.yp"
1759 {{
1760                 "TYPE" => "FUNCTION",
1761                 "NAME" => $_[3],
1762                 "RETURN_TYPE" => $_[2],
1763                 "PROPERTIES" => $_[1],
1764                 "DATA" => $_[5]
1765          }}
1766         ],
1767         [#Rule 18
1768                  'typedef', 6,
1769 sub
1770 #line 90 "build/pidl/idl.yp"
1771 {{
1772                      "TYPE" => "TYPEDEF", 
1773                      "PROPERTIES" => $_[2],
1774                      "NAME" => $_[4],
1775                      "DATA" => $_[3],
1776                      "ARRAY_LEN" => $_[5]
1777         }}
1778         ],
1779         [#Rule 19
1780                  'type', 1, undef
1781         ],
1782         [#Rule 20
1783                  'type', 1, undef
1784         ],
1785         [#Rule 21
1786                  'type', 1, undef
1787         ],
1788         [#Rule 22
1789                  'type', 1, undef
1790         ],
1791         [#Rule 23
1792                  'type', 1,
1793 sub
1794 #line 100 "build/pidl/idl.yp"
1795 { "void" }
1796         ],
1797         [#Rule 24
1798                  'enum', 4,
1799 sub
1800 #line 105 "build/pidl/idl.yp"
1801 {{
1802                      "TYPE" => "ENUM", 
1803                      "ELEMENTS" => $_[3]
1804         }}
1805         ],
1806         [#Rule 25
1807                  'enum_elements', 1,
1808 sub
1809 #line 112 "build/pidl/idl.yp"
1810 { [ $_[1] ] }
1811         ],
1812         [#Rule 26
1813                  'enum_elements', 3,
1814 sub
1815 #line 113 "build/pidl/idl.yp"
1816 { push(@{$_[1]}, $_[3]); $_[1] }
1817         ],
1818         [#Rule 27
1819                  'enum_element', 1, undef
1820         ],
1821         [#Rule 28
1822                  'enum_element', 3,
1823 sub
1824 #line 117 "build/pidl/idl.yp"
1825 { "$_[1]$_[2]$_[3]" }
1826         ],
1827         [#Rule 29
1828                  'struct', 5,
1829 sub
1830 #line 121 "build/pidl/idl.yp"
1831 {{
1832                      "TYPE" => "STRUCT", 
1833                      "PROPERTIES" => $_[1],
1834                      "ELEMENTS" => $_[4]
1835         }}
1836         ],
1837         [#Rule 30
1838                  'union', 5,
1839 sub
1840 #line 129 "build/pidl/idl.yp"
1841 {{
1842                 "TYPE" => "UNION",
1843                 "PROPERTIES" => $_[1],
1844                 "DATA" => $_[4]
1845          }}
1846         ],
1847         [#Rule 31
1848                  'union_elements', 1,
1849 sub
1850 #line 137 "build/pidl/idl.yp"
1851 { [ $_[1] ] }
1852         ],
1853         [#Rule 32
1854                  'union_elements', 2,
1855 sub
1856 #line 138 "build/pidl/idl.yp"
1857 { push(@{$_[1]}, $_[2]); $_[1] }
1858         ],
1859         [#Rule 33
1860                  'union_element', 8,
1861 sub
1862 #line 143 "build/pidl/idl.yp"
1863 {{
1864                 "TYPE" => "UNION_ELEMENT",
1865                 "CASE" => $_[4],
1866                 "DATA" => $_[7]
1867          }}
1868         ],
1869         [#Rule 34
1870                  'union_element', 7,
1871 sub
1872 #line 149 "build/pidl/idl.yp"
1873 {{
1874                 "TYPE" => "EMPTY",
1875                 "CASE" => $_[4],
1876          }}
1877         ],
1878         [#Rule 35
1879                  'union_element', 5,
1880 sub
1881 #line 154 "build/pidl/idl.yp"
1882 {{
1883                 "TYPE" => "UNION_ELEMENT",
1884                 "CASE" => "default",
1885                 "DATA" => $_[4]
1886          }}
1887         ],
1888         [#Rule 36
1889                  'union_element', 4,
1890 sub
1891 #line 160 "build/pidl/idl.yp"
1892 {{
1893                 "TYPE" => "EMPTY",
1894                 "CASE" => "default",
1895          }}
1896         ],
1897         [#Rule 37
1898                  'base_element', 5,
1899 sub
1900 #line 167 "build/pidl/idl.yp"
1901 {{
1902                            "NAME" => $_[4],
1903                            "TYPE" => $_[2],
1904                            "PROPERTIES" => $_[1],
1905                            "POINTERS" => $_[3],
1906                            "ARRAY_LEN" => $_[5]
1907               }}
1908         ],
1909         [#Rule 38
1910                  'pointers', 0,
1911 sub
1912 #line 179 "build/pidl/idl.yp"
1913 { 0 }
1914         ],
1915         [#Rule 39
1916                  'pointers', 2,
1917 sub
1918 #line 180 "build/pidl/idl.yp"
1919 { $_[1]+1 }
1920         ],
1921         [#Rule 40
1922                  'element_list1', 0, undef
1923         ],
1924         [#Rule 41
1925                  'element_list1', 3,
1926 sub
1927 #line 187 "build/pidl/idl.yp"
1928 { push(@{$_[1]}, $_[2]); $_[1] }
1929         ],
1930         [#Rule 42
1931                  'element_list2', 0, undef
1932         ],
1933         [#Rule 43
1934                  'element_list2', 1, undef
1935         ],
1936         [#Rule 44
1937                  'element_list2', 1,
1938 sub
1939 #line 193 "build/pidl/idl.yp"
1940 { [ $_[1] ] }
1941         ],
1942         [#Rule 45
1943                  'element_list2', 3,
1944 sub
1945 #line 194 "build/pidl/idl.yp"
1946 { push(@{$_[1]}, $_[3]); $_[1] }
1947         ],
1948         [#Rule 46
1949                  'array_len', 0, undef
1950         ],
1951         [#Rule 47
1952                  'array_len', 2,
1953 sub
1954 #line 199 "build/pidl/idl.yp"
1955 { "*" }
1956         ],
1957         [#Rule 48
1958                  'array_len', 3,
1959 sub
1960 #line 200 "build/pidl/idl.yp"
1961 { "$_[2]" }
1962         ],
1963         [#Rule 49
1964                  'property_list', 0, undef
1965         ],
1966         [#Rule 50
1967                  'property_list', 4,
1968 sub
1969 #line 206 "build/pidl/idl.yp"
1970 { util::FlattenHash([$_[1],$_[3]]); }
1971         ],
1972         [#Rule 51
1973                  'properties', 1,
1974 sub
1975 #line 209 "build/pidl/idl.yp"
1976 { $_[1] }
1977         ],
1978         [#Rule 52
1979                  'properties', 3,
1980 sub
1981 #line 210 "build/pidl/idl.yp"
1982 { util::FlattenHash([$_[1], $_[3]]); }
1983         ],
1984         [#Rule 53
1985                  'property', 1,
1986 sub
1987 #line 213 "build/pidl/idl.yp"
1988 {{ "$_[1]" => "1"     }}
1989         ],
1990         [#Rule 54
1991                  'property', 4,
1992 sub
1993 #line 214 "build/pidl/idl.yp"
1994 {{ "$_[1]" => "$_[3]" }}
1995         ],
1996         [#Rule 55
1997                  'listtext', 1, undef
1998         ],
1999         [#Rule 56
2000                  'listtext', 3,
2001 sub
2002 #line 219 "build/pidl/idl.yp"
2003 { "$_[1] $_[3]" }
2004         ],
2005         [#Rule 57
2006                  'commalisttext', 1, undef
2007         ],
2008         [#Rule 58
2009                  'commalisttext', 3,
2010 sub
2011 #line 224 "build/pidl/idl.yp"
2012 { "$_[1],$_[3]" }
2013         ],
2014         [#Rule 59
2015                  'anytext', 0,
2016 sub
2017 #line 228 "build/pidl/idl.yp"
2018 { "" }
2019         ],
2020         [#Rule 60
2021                  'anytext', 1, undef
2022         ],
2023         [#Rule 61
2024                  'anytext', 1, undef
2025         ],
2026         [#Rule 62
2027                  'anytext', 1, undef
2028         ],
2029         [#Rule 63
2030                  'anytext', 3,
2031 sub
2032 #line 230 "build/pidl/idl.yp"
2033 { "$_[1]$_[2]$_[3]" }
2034         ],
2035         [#Rule 64
2036                  'anytext', 3,
2037 sub
2038 #line 231 "build/pidl/idl.yp"
2039 { "$_[1]$_[2]$_[3]" }
2040         ],
2041         [#Rule 65
2042                  'anytext', 3,
2043 sub
2044 #line 232 "build/pidl/idl.yp"
2045 { "$_[1]$_[2]$_[3]" }
2046         ],
2047         [#Rule 66
2048                  'anytext', 3,
2049 sub
2050 #line 233 "build/pidl/idl.yp"
2051 { "$_[1]$_[2]$_[3]" }
2052         ],
2053         [#Rule 67
2054                  'anytext', 3,
2055 sub
2056 #line 234 "build/pidl/idl.yp"
2057 { "$_[1]$_[2]$_[3]" }
2058         ],
2059         [#Rule 68
2060                  'anytext', 3,
2061 sub
2062 #line 235 "build/pidl/idl.yp"
2063 { "$_[1]$_[2]$_[3]" }
2064         ],
2065         [#Rule 69
2066                  'anytext', 3,
2067 sub
2068 #line 236 "build/pidl/idl.yp"
2069 { "$_[1]$_[2]$_[3]" }
2070         ],
2071         [#Rule 70
2072                  'anytext', 3,
2073 sub
2074 #line 237 "build/pidl/idl.yp"
2075 { "$_[1]$_[2]$_[3]" }
2076         ],
2077         [#Rule 71
2078                  'anytext', 5,
2079 sub
2080 #line 238 "build/pidl/idl.yp"
2081 { "$_[1]$_[2]$_[3]$_[4]$_[5]" }
2082         ],
2083         [#Rule 72
2084                  'anytext', 5,
2085 sub
2086 #line 239 "build/pidl/idl.yp"
2087 { "$_[1]$_[2]$_[3]$_[4]$_[5]" }
2088         ],
2089         [#Rule 73
2090                  'identifier', 1, undef
2091         ],
2092         [#Rule 74
2093                  'constant', 1, undef
2094         ],
2095         [#Rule 75
2096                  'text', 1,
2097 sub
2098 #line 248 "build/pidl/idl.yp"
2099 { "\"$_[1]\"" }
2100         ],
2101         [#Rule 76
2102                  'optional_semicolon', 0, undef
2103         ],
2104         [#Rule 77
2105                  'optional_semicolon', 1, undef
2106         ]
2107 ],
2108                                   @_);
2109     bless($self,$class);
2110 }
2111
2112 #line 259 "build/pidl/idl.yp"
2113
2114
2115 use util;
2116
2117 sub _Error {
2118         if (exists $_[0]->YYData->{ERRMSG}) {
2119                 print $_[0]->YYData->{ERRMSG};
2120                 delete $_[0]->YYData->{ERRMSG};
2121                 return;
2122         };
2123         my $line = $_[0]->YYData->{LINE};
2124         my $last_token = $_[0]->YYData->{LAST_TOKEN};
2125         my $file = $_[0]->YYData->{INPUT_FILENAME};
2126         
2127         print "$file:$line: Syntax error near '$last_token'\n";
2128 }
2129
2130 sub _Lexer($)
2131 {
2132         my($parser)=shift;
2133
2134         $parser->YYData->{INPUT}
2135         or  return('',undef);
2136
2137 again:
2138         $parser->YYData->{INPUT} =~ s/^[ \t]*//;
2139
2140         for ($parser->YYData->{INPUT}) {
2141                 if (/^\#/) {
2142                         if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
2143                                 $parser->YYData->{LINE} = $1-1;
2144                                 $parser->YYData->{INPUT_FILENAME} = $2;
2145                                 goto again;
2146                         }
2147                         if (s/^\#line (\d+) \"(.*?)\"( \d+|)//) {
2148                                 $parser->YYData->{LINE} = $1-1;
2149                                 $parser->YYData->{INPUT_FILENAME} = $2;
2150                                 goto again;
2151                         }
2152                         if (s/^(\#.*)$//m) {
2153                                 goto again;
2154                         }
2155                 }
2156                 if (s/^(\n)//) {
2157                         $parser->YYData->{LINE}++;
2158                         goto again;
2159                 }
2160                 if (s/^\"(.*?)\"//) {
2161                         $parser->YYData->{LAST_TOKEN} = $1;
2162                         return('TEXT',$1); 
2163                 }
2164                 if (s/^(\d+)(\W|$)/$2/) {
2165                         $parser->YYData->{LAST_TOKEN} = $1;
2166                         return('CONSTANT',$1); 
2167                 }
2168                 if (s/^([\w_]+)//) {
2169                         $parser->YYData->{LAST_TOKEN} = $1;
2170                         if ($1 =~ 
2171                             /^(coclass|interface|const|typedef|union
2172                               |struct|enum|void|case|default)$/x) {
2173                                 return $1;
2174                         }
2175                         return('IDENTIFIER',$1);
2176                 }
2177                 if (s/^(.)//s) {
2178                         $parser->YYData->{LAST_TOKEN} = $1;
2179                         return($1,$1);
2180                 }
2181         }
2182 }
2183
2184 sub parse_idl($$)
2185 {
2186         my $self = shift;
2187         my $filename = shift;
2188
2189         my $saved_delim = $/;
2190         undef $/;
2191         my $cpp = $ENV{CPP};
2192         if (! defined $cpp) {
2193                 $cpp = "cpp"
2194         }
2195         my $data = `$cpp -xc $filename`;
2196         $/ = $saved_delim;
2197
2198     $self->YYData->{INPUT} = $data;
2199     $self->YYData->{LINE} = 0;
2200     $self->YYData->{LAST_TOKEN} = "NONE";
2201
2202         my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );
2203
2204         foreach my $x (@{$idl}) {
2205                 # Add [in] ORPCTHIS *this, [out] ORPCTHAT *that
2206                 # for 'object' interfaces
2207                 if (defined($x->{PROPERTIES}->{object})) {
2208                         foreach my $e (@{$x->{DATA}}) {
2209                                 if($e->{TYPE} eq "FUNCTION") {
2210                                         $e->{PROPERTIES}->{object} = 1;
2211                                         unshift(@{$e->{DATA}}, 
2212                         { 'NAME' => 'ORPCthis',
2213                           'POINTERS' => 0,
2214                           'PROPERTIES' => { 'in' => '1' },
2215                           'TYPE' => 'ORPCTHIS'
2216                         });
2217                                         unshift(@{$e->{DATA}},
2218                         { 'NAME' => 'ORPCthat',
2219                           'POINTERS' => 0,
2220                           'PROPERTIES' => { 'out' => '1' },
2221                                                   'TYPE' => 'ORPCTHAT'
2222                         });
2223                                 }
2224                         }
2225                 }
2226                 
2227                 # Do the inheritance
2228                 if (defined($x->{BASE}) and $x->{BASE} ne "") {
2229                         my $parent = util::get_interface($idl, $x->{BASE});
2230
2231                         if(not defined($parent)) { 
2232                                 die("No such parent interface " . $x->{BASE});
2233                         }
2234                         
2235                         @{$x->{INHERITED_DATA}} = (@{$parent->{INHERITED_DATA}}, @{$x->{DATA}});
2236                 } else {
2237                         $x->{INHERITED_DATA} = $x->{DATA};
2238                 }
2239         }
2240
2241         return $idl;
2242 }
2243
2244 1;