"PROPERTIES" => $_[1],
"NAME" => $_[3],
"DATA" => $_[5],
+ "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "LINE" => $_[0]->YYData->{LINE},
}}
;
"NAME" => $_[3],
"BASE" => $_[4],
"DATA" => $_[6],
+ "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "LINE" => $_[0]->YYData->{LINE},
}}
;
"TYPE" => "CONST",
"DTYPE" => $_[2],
"NAME" => $_[3],
- "VALUE" => $_[5]
+ "VALUE" => $_[5],
+ "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "LINE" => $_[0]->YYData->{LINE},
}}
| 'const' identifier identifier array_len '=' anytext ';'
{{
"NAME" => $_[3],
"ARRAY_LEN" => $_[4],
"VALUE" => $_[6],
+ "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "LINE" => $_[0]->YYData->{LINE},
}}
;
"NAME" => $_[3],
"RETURN_TYPE" => $_[2],
"PROPERTIES" => $_[1],
- "ELEMENTS" => $_[5]
- }}
+ "ELEMENTS" => $_[5],
+ "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "LINE" => $_[0]->YYData->{LINE},
+ }}
;
declare: 'declare' property_list decl_type identifier';'
"PROPERTIES" => $_[2],
"NAME" => $_[4],
"DATA" => $_[3],
+ "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "LINE" => $_[0]->YYData->{LINE},
}}
;
"PROPERTIES" => $_[2],
"NAME" => $_[4],
"DATA" => $_[3],
- "ARRAY_LEN" => $_[5]
+ "ARRAY_LEN" => $_[5],
+ "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "LINE" => $_[0]->YYData->{LINE},
}}
;
enum: 'enum' '{' enum_elements '}'
{{
- "TYPE" => "ENUM",
+ "TYPE" => "ENUM",
"ELEMENTS" => $_[3]
}}
;
{{
"NAME" => "",
"TYPE" => "EMPTY",
- "PROPERTIES" => $_[0],
- "POINTERS" => 0
+ "PROPERTIES" => $_[1],
+ "POINTERS" => 0,
+ "ARRAY_LEN" => [],
+ "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "LINE" => $_[0]->YYData->{LINE},
}}
;
"TYPE" => $_[2],
"PROPERTIES" => $_[1],
"POINTERS" => $_[3],
- "ARRAY_LEN" => $_[5]
+ "ARRAY_LEN" => $_[5],
+ "FILE" => $_[0]->YYData->{INPUT_FILENAME},
+ "LINE" => $_[0]->YYData->{LINE},
}}
;
;
array_len:
- #empty
- | '[' ']' { "*" }
- | '[' anytext ']' { "$_[2]" }
+ #empty { [] }
+ | '[' ']' array_len { push(@{$_[3]}, "*"); $_[3] }
+ | '[' anytext ']' array_len { push(@{$_[4]}, "$_[2]"); $_[4] }
;
| anytext '&' anytext { "$_[1]$_[2]$_[3]" }
| anytext '/' anytext { "$_[1]$_[2]$_[3]" }
| anytext '+' anytext { "$_[1]$_[2]$_[3]" }
+ | anytext '~' anytext { "$_[1]$_[2]$_[3]" }
| anytext '(' commalisttext ')' anytext { "$_[1]$_[2]$_[3]$_[4]$_[5]" }
| anytext '{' commalisttext '}' anytext { "$_[1]$_[2]$_[3]$_[4]$_[5]" }
;
# start code
%%
-use util;
+use pidl::util;
sub _Error {
- if (exists $_[0]->YYData->{ERRMSG}) {
+ if (exists $_[0]->YYData->{ERRMSG}) {
print $_[0]->YYData->{ERRMSG};
delete $_[0]->YYData->{ERRMSG};
return;
if (! defined $cpp) {
$cpp = "cpp"
}
- my $data = `$cpp -xc $filename`;
+ my $data = `$cpp -D__PIDL__ -xc $filename`;
$/ = $saved_delim;
$self->YYData->{INPUT} = $data;
my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );
- foreach my $x (@{$idl}) {
- # Do the inheritance
- if (defined($x->{BASE}) and $x->{BASE} ne "") {
- my $parent = util::get_interface($idl, $x->{BASE});
-
- if(not defined($parent)) {
- die("No such parent interface " . $x->{BASE});
- }
-
- @{$x->{INHERITED_DATA}} = (@{$parent->{INHERITED_DATA}}, @{$x->{DATA}});
- } else {
- $x->{INHERITED_DATA} = $x->{DATA};
- }
- }
-
- return $idl;
+ return util::CleanData($idl);
}