1 ####################################################################
3 # This file was generated using Parse::Yapp version 1.05.
5 # Don't edit this file, use source file instead.
7 # ANY CHANGE MADE HERE WILL BE LOST !
9 ####################################################################
10 package Parse
::Pidl
::IDL
;
14 @ISA= qw
( Parse
::Yapp
::Driver
);
15 use Parse
::Yapp
::Driver
;
22 and $class=ref($class);
24 my($self)=$class->SUPER::new
( yyversion
=> '1.05',
177 'base_interface' => 33
207 'interface_names' => 37
271 'property_list' => 54,
328 'optional_semicolon' => 81
360 'property_list' => 54,
389 'existingtype' => 96,
392 'property_list' => 90,
407 'property_list' => 101
532 'commalisttext' => 110
589 'commalisttext' => 114
682 'optional_semicolon' => 121
700 'existingtype' => 96,
703 'property_list' => 90,
718 'optional_identifier' => 124
753 'optional_identifier' => 126
768 'optional_identifier' => 127
777 'optional_identifier' => 128
800 'decl_bitmap' => 132,
1074 'union_body' => 144,
1075 'opt_union_body' => 142
1087 'struct_body' => 145,
1088 'opt_struct_body' => 147
1097 'opt_enum_body' => 150,
1107 'bitmap_body' => 153,
1108 'opt_bitmap_body' => 151
1208 'union_elements' => 163
1220 'element_list1' => 164
1231 'identifier' => 165,
1232 'enum_element' => 166,
1233 'enum_elements' => 167
1251 'identifier' => 170,
1252 'bitmap_element' => 169,
1253 'bitmap_elements' => 168,
1254 'opt_bitmap_elements' => 171
1268 'base_element' => 172,
1269 'element_list2' => 174,
1270 'property_list' => 173
1367 'optional_base_element' => 184,
1368 'property_list' => 183
1377 'base_element' => 186,
1378 'property_list' => 173
1428 'existingtype' => 96,
1431 'property_list' => 90,
1512 'base_or_empty' => 200,
1513 'base_element' => 201,
1514 'empty_element' => 202,
1515 'property_list' => 203
1551 'identifier' => 165,
1552 'enum_element' => 206
1560 'identifier' => 170,
1561 'bitmap_element' => 207
1590 'base_element' => 210,
1591 'property_list' => 173
1667 'existingtype' => 96,
1670 'property_list' => 90,
1803 { push(@
{$_[1]}, $_[2]); $_[1] }
1809 { push(@
{$_[1]}, $_[2]); $_[1] }
1815 { push(@
{$_[1]}, $_[2]); $_[1] }
1821 { push(@
{$_[1]}, $_[2]); $_[1] }
1827 { push(@
{$_[1]}, $_[2]); $_[1] }
1836 "FILE" => $_[0]->YYData->{FILE
},
1837 "LINE" => $_[0]->YYData->{LINE
}
1845 "TYPE" => "INCLUDE",
1847 "FILE" => $_[0]->YYData->{FILE
},
1848 "LINE" => $_[0]->YYData->{LINE
}
1856 "TYPE" => "IMPORTLIB",
1858 "FILE" => $_[0]->YYData->{FILE
},
1859 "LINE" => $_[0]->YYData->{LINE
}
1872 { push(@
{$_[1]}, $_[3]); $_[1] }
1879 "TYPE" => "COCLASS",
1880 "PROPERTIES" => $_[1],
1883 "FILE" => $_[0]->YYData->{FILE
},
1884 "LINE" => $_[0]->YYData->{LINE
},
1888 'interface_names', 0, undef
1891 'interface_names', 4,
1894 { push(@
{$_[1]}, $_[2]); $_[1] }
1901 "TYPE" => "INTERFACE",
1902 "PROPERTIES" => $_[1],
1906 "FILE" => $_[0]->YYData->{FILE
},
1907 "LINE" => $_[0]->YYData->{LINE
},
1911 'base_interface', 0, undef
1914 'base_interface', 2,
1929 { push(@
{$_[1]}, $_[2]); $_[1] }
1932 'definition', 1, undef
1935 'definition', 1, undef
1938 'definition', 1, undef
1941 'definition', 1, undef
1944 'definition', 1, undef
1953 "POINTERS" => $_[3],
1956 "FILE" => $_[0]->YYData->{FILE
},
1957 "LINE" => $_[0]->YYData->{LINE
},
1967 "POINTERS" => $_[3],
1969 "ARRAY_LEN" => $_[5],
1971 "FILE" => $_[0]->YYData->{FILE
},
1972 "LINE" => $_[0]->YYData->{LINE
},
1980 "TYPE" => "FUNCTION",
1982 "RETURN_TYPE" => $_[2],
1983 "PROPERTIES" => $_[1],
1984 "ELEMENTS" => $_[5],
1985 "FILE" => $_[0]->YYData->{FILE
},
1986 "LINE" => $_[0]->YYData->{LINE
},
1994 "TYPE" => "DECLARE",
1995 "PROPERTIES" => $_[2],
1998 "FILE" => $_[0]->YYData->{FILE
},
1999 "LINE" => $_[0]->YYData->{LINE
},
2003 'decl_type', 1, undef
2006 'decl_type', 1, undef
2009 'decl_type', 1, undef
2040 "TYPE" => "TYPEDEF",
2041 "PROPERTIES" => $_[1],
2044 "ARRAY_LEN" => $_[5],
2045 "FILE" => $_[0]->YYData->{FILE
},
2046 "LINE" => $_[0]->YYData->{LINE
},
2050 'usertype', 1, undef
2053 'usertype', 1, undef
2056 'usertype', 1, undef
2059 'usertype', 1, undef
2077 { ($_[1]?
$_[1]:"signed") ." $_[2]" }
2080 'existingtype', 1, undef
2101 'opt_enum_body', 0, undef
2104 'opt_enum_body', 1, undef
2112 "PROPERTIES" => $_[1],
2127 { push(@
{$_[1]}, $_[3]); $_[1] }
2130 'enum_element', 1, undef
2136 { "$_[1]$_[2]$_[3]" }
2145 'opt_bitmap_body', 0, undef
2148 'opt_bitmap_body', 1, undef
2156 "PROPERTIES" => $_[1],
2162 'bitmap_elements', 1,
2168 'bitmap_elements', 3,
2171 { push(@
{$_[1]}, $_[3]); $_[1] }
2174 'opt_bitmap_elements', 0, undef
2177 'opt_bitmap_elements', 1, undef
2180 'bitmap_element', 3,
2183 { "$_[1] ( $_[3] )" }
2192 'opt_struct_body', 0, undef
2195 'opt_struct_body', 1, undef
2203 "PROPERTIES" => $_[1],
2215 "PROPERTIES" => $_[1],
2218 "FILE" => $_[0]->YYData->{FILE
},
2219 "LINE" => $_[0]->YYData->{LINE
},
2223 'base_or_empty', 2, undef
2226 'base_or_empty', 1, undef
2229 'optional_base_element', 2,
2232 { $_[2]->{PROPERTIES
} = FlattenHash
([$_[1],$_[2]->{PROPERTIES
}]); $_[2] }
2235 'union_elements', 0, undef
2238 'union_elements', 2,
2241 { push(@
{$_[1]}, $_[2]); $_[1] }
2250 'opt_union_body', 0, undef
2253 'opt_union_body', 1, undef
2261 "PROPERTIES" => $_[1],
2273 "PROPERTIES" => $_[1],
2274 "POINTERS" => $_[3],
2275 "ARRAY_LEN" => $_[5],
2276 "FILE" => $_[0]->YYData->{FILE
},
2277 "LINE" => $_[0]->YYData->{LINE
},
2293 'element_list1', 0, undef
2299 { push(@
{$_[1]}, $_[2]); $_[1] }
2302 'element_list2', 0, undef
2305 'element_list2', 1, undef
2317 { push(@
{$_[1]}, $_[3]); $_[1] }
2320 'array_len', 0, undef
2326 { push(@
{$_[3]}, "*"); $_[3] }
2332 { push(@
{$_[4]}, "$_[2]"); $_[4] }
2335 'property_list', 0, undef
2341 { FlattenHash
([$_[1],$_[3]]); }
2353 { FlattenHash
([$_[1], $_[3]]); }
2359 {{ "$_[1]" => "1" }}
2365 {{ "$_[1]" => "$_[3]" }}
2368 'listtext', 1, undef
2377 'commalisttext', 1, undef
2404 { "$_[1]$_[2]$_[3]" }
2410 { "$_[1]$_[2]$_[3]" }
2416 { "$_[1]$_[2]$_[3]" }
2422 { "$_[1]$_[2]$_[3]" }
2428 { "$_[1]$_[2]$_[3]" }
2434 { "$_[1]$_[2]$_[3]" }
2440 { "$_[1]$_[2]$_[3]" }
2446 { "$_[1]$_[2]$_[3]" }
2452 { "$_[1]$_[2]$_[3]" }
2458 { "$_[1]$_[2]$_[3]" }
2464 { "$_[1]$_[2]$_[3]" }
2470 { "$_[1]$_[2]$_[3]" }
2476 { "$_[1]$_[2]$_[3]" }
2482 { "$_[1]$_[2]$_[3]$_[4]$_[5]" }
2488 { "$_[1]$_[2]$_[3]$_[4]$_[5]" }
2491 'identifier', 1, undef
2494 'optional_identifier', 1, undef
2497 'optional_identifier', 0, undef
2500 'constant', 1, undef
2509 'optional_semicolon', 0, undef
2512 'optional_semicolon', 1, undef
2516 bless($self,$class);
2522 use Parse
::Pidl
qw(error);
2524 #####################################################################
2525 # flatten an array of hashes into a single hash
2531 for my $k (keys %{$d}) {
2540 #####################################################################
2541 # traverse a perl data structure removing any empty arrays or
2542 # hashes and any hash elements that map to undef
2547 return undef if (not defined($v));
2548 if (ref($v) eq "ARRAY") {
2549 foreach my $i (0 .. $#{$v}) {
2550 CleanData
($v->[$i]);
2551 if (ref($v->[$i]) eq "ARRAY" && $#{$v->[$i]}==-1) {
2556 # this removes any undefined elements from the array
2557 @
{$v} = grep { defined $_ } @
{$v};
2558 } elsif (ref($v) eq "HASH") {
2559 foreach my $x (keys %{$v}) {
2560 CleanData
($v->{$x});
2561 if (!defined $v->{$x}) { delete($v->{$x}); next; }
2562 if (ref($v->{$x}) eq "ARRAY" && $#{$v->{$x}}==-1) { delete($v->{$x}); next; }
2569 if (exists $_[0]->YYData->{ERRMSG
}) {
2570 error
($_[0]->YYData, $_[0]->YYData->{ERRMSG
});
2571 delete $_[0]->YYData->{ERRMSG
};
2574 my $last_token = $_[0]->YYData->{LAST_TOKEN
};
2576 error
($_[0]->YYData, "Syntax error near '$last_token'");
2583 $parser->YYData->{INPUT
} or return('',undef);
2586 $parser->YYData->{INPUT
} =~ s/^[ \t]*//;
2588 for ($parser->YYData->{INPUT
}) {
2590 if (s/^\# (\d+) \"(.*?)\"( \d+|)//) {
2591 $parser->YYData->{LINE
} = $1-1;
2592 $parser->YYData->{FILE
} = $2;
2595 if (s/^\#line (\d+) \"(.*?)\"( \d+|)//) {
2596 $parser->YYData->{LINE
} = $1-1;
2597 $parser->YYData->{FILE
} = $2;
2600 if (s/^(\#.*)$//m) {
2605 $parser->YYData->{LINE
}++;
2608 if (s/^\"(.*?)\"//) {
2609 $parser->YYData->{LAST_TOKEN
} = $1;
2612 if (s/^(\d+)(\W|$)/$2/) {
2613 $parser->YYData->{LAST_TOKEN
} = $1;
2614 return('CONSTANT',$1);
2616 if (s/^([\w_]+)//) {
2617 $parser->YYData->{LAST_TOKEN
} = $1;
2619 /^(coclass
|interface
|const
|typedef
|declare
|union
2620 |struct
|enum
|bitmap
|void
|unsigned
|signed
|import
|include
2624 return('IDENTIFIER',$1);
2627 $parser->YYData->{LAST_TOKEN
} = $1;
2635 my ($data,$filename) = @_;
2637 my $self = new Parse
::Pidl
::IDL
;
2639 $self->YYData->{FILE
} = $filename;
2640 $self->YYData->{INPUT
} = $data;
2641 $self->YYData->{LINE
} = 0;
2642 $self->YYData->{LAST_TOKEN
} = "NONE";
2644 my $idl = $self->YYParse( yylex
=> \
&_Lexer
, yyerror
=> \
&_Error
);
2646 return CleanData
($idl);
2651 my ($filename,$incdirs) = @_;
2653 my $saved_delim = $/;
2655 my $cpp = $ENV{CPP
};
2656 if (! defined $cpp) {
2659 my $includes = join('',map { " -I$_" } @
$incdirs);
2660 my $data = `$cpp -D__PIDL__$includes -xc $filename`;
2663 return parse_string
($data, $filename);