########################
# IDL Parse::Yapp parser
# Copyright (C) Andrew Tridgell <tridge@samba.org>
-# released under the GNU GPL version 2 or later
+# released under the GNU GPL version 3 or later
| idl import { push(@{$_[1]}, $_[2]); $_[1] }
| idl include { push(@{$_[1]}, $_[2]); $_[1] }
| idl importlib { push(@{$_[1]}, $_[2]); $_[1] }
+ | idl cpp_quote { push(@{$_[1]}, $_[2]); $_[1] }
;
import: 'import' commalist ';' {{
| interface_names 'interface' identifier ';' { push(@{$_[1]}, $_[2]); $_[1] }
;
-interface: property_list 'interface' identifier base_interface '{' definitions '}' optional_semicolon
+interface: property_list 'interface' identifier '{' definitions '}' optional_semicolon
{{
"TYPE" => "INTERFACE",
"PROPERTIES" => $_[1],
"NAME" => $_[3],
- "BASE" => $_[4],
- "DATA" => $_[6],
+ "DATA" => $_[5],
"FILE" => $_[0]->YYData->{FILE},
"LINE" => $_[0]->YYData->{LINE},
}}
;
-base_interface:
- #empty
- | ':' identifier { $_[2] }
+cpp_quote: 'cpp_quote' '(' text ')'
+ {{
+ "TYPE" => "CPP_QUOTE",
+ "FILE" => $_[0]->YYData->{FILE},
+ "LINE" => $_[0]->YYData->{LINE},
+ "DATA" => $_[3]
+ }}
;
definitions:
;
-definition: function | const | typedef | declare | typedecl
+definition: function | const | typedef | typedecl
;
const: 'const' identifier pointers identifier '=' anytext ';'
}}
;
-declare: 'declare' property_list decl_type identifier';'
- {{
- "TYPE" => "DECLARE",
- "PROPERTIES" => $_[2],
- "NAME" => $_[4],
- "DATA" => $_[3],
- "FILE" => $_[0]->YYData->{FILE},
- "LINE" => $_[0]->YYData->{LINE},
- }}
-;
-
-decl_type: decl_enum | decl_bitmap | decl_union
-;
-
-decl_enum: 'enum'
- {{
- "TYPE" => "ENUM"
- }}
-;
-
-decl_bitmap: 'bitmap'
- {{
- "TYPE" => "BITMAP"
- }}
-;
-
-decl_union: 'union'
- {{
- "TYPE" => "UNION"
- }}
-;
-
typedef: property_list 'typedef' type identifier array_len ';'
{{
"TYPE" => "TYPEDEF",
;
element_list1:
- #empty
+ { [] }
| element_list1 base_element ';' { push(@{$_[1]}, $_[2]); $_[1] }
;
;
property: identifier {{ "$_[1]" => "1" }}
- | identifier '(' listtext ')' {{ "$_[1]" => "$_[3]" }}
-;
-
-listtext:
- anytext
- | listtext ',' anytext { "$_[1] $_[3]" }
+ | identifier '(' commalisttext ')' {{ "$_[1]" => "$_[3]" }}
;
commalisttext:
if (ref($v) eq "ARRAY") {
foreach my $i (0 .. $#{$v}) {
CleanData($v->[$i]);
- if (ref($v->[$i]) eq "ARRAY" && $#{$v->[$i]}==-1) {
- $v->[$i] = undef;
- next;
- }
}
# this removes any undefined elements from the array
@{$v} = grep { defined $_ } @{$v};
foreach my $x (keys %{$v}) {
CleanData($v->{$x});
if (!defined $v->{$x}) { delete($v->{$x}); next; }
- if (ref($v->{$x}) eq "ARRAY" && $#{$v->{$x}}==-1) { delete($v->{$x}); next; }
}
}
return $v;
error($_[0]->YYData, $_[0]->YYData->{ERRMSG});
delete $_[0]->YYData->{ERRMSG};
return;
- };
+ }
my $last_token = $_[0]->YYData->{LAST_TOKEN};
error($_[0]->YYData, "Syntax error near '$last_token'");
if (s/^([\w_]+)//) {
$parser->YYData->{LAST_TOKEN} = $1;
if ($1 =~
- /^(coclass|interface|const|typedef|declare|union
+ /^(coclass|interface|const|typedef|union|cpp_quote
|struct|enum|bitmap|void|unsigned|signed|import|include
|importlib)$/x) {
return $1;