;
struct:
- property_list 'struct' optional_identifier opt_struct_body
+ property_list 'struct' optional_anonymous_identifier opt_struct_body
{{
"TYPE" => "STRUCT",
"PROPERTIES" => $_[1],
;
union:
- property_list 'union' optional_identifier opt_union_body
+ property_list 'union' optional_anonymous_identifier opt_union_body
{{
"TYPE" => "UNION",
"PROPERTIES" => $_[1],
IDENTIFIER
;
+optional_anonymous_identifier:
+ { anonymous_identifier($_[0]) }
+ |
+ IDENTIFIER
+;
+
constant:
CONSTANT
;
%%
use Parse::Pidl qw(error);
+use File::Basename;
#####################################################################
# flatten an array of hashes into a single hash
return $v;
}
+sub anonymous_identifier($)
+{
+ my($parser)=shift;
+ my $name = "__pidl_anonymous_";
+ $name .= basename($parser->YYData->{FILE});
+ $name .= "_";
+ $name .= $parser->YYData->{LINE};
+ $name .= "_";
+ $name .= $parser->YYData->{ANONYMOUS_COUNTER}++;
+
+ $name =~ s/\./_/g;
+ $name =~ s/\//_/g;
+ $name =~ s/\\/_/g;
+
+ return $name;
+}
+
sub _Error {
if (exists $_[0]->YYData->{ERRMSG}) {
error($_[0]->YYData, $_[0]->YYData->{ERRMSG});
$self->YYData->{INPUT} = $data;
$self->YYData->{LINE} = 0;
$self->YYData->{LAST_TOKEN} = "NONE";
+ $self->YYData->{ANONYMOUS_COUNTER} = 0;
my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );
}
},
{#State 16
- DEFAULT => -120
+ DEFAULT => -122
},
{#State 17
DEFAULT => -11
DEFAULT => -99
},
{#State 48
- DEFAULT => -119
+ DEFAULT => -121
},
{#State 49
ACTIONS => {
ACTIONS => {
";" => 86
},
- DEFAULT => -121,
+ DEFAULT => -123,
GOTOS => {
'optional_semicolon' => 85
}
DEFAULT => -13
},
{#State 86
- DEFAULT => -122
+ DEFAULT => -124
},
{#State 87
ACTIONS => {
ACTIONS => {
";" => 86
},
- DEFAULT => -121,
+ DEFAULT => -123,
GOTOS => {
'optional_semicolon' => 124
}
ACTIONS => {
'IDENTIFIER' => 126
},
- DEFAULT => -117,
+ DEFAULT => -119,
GOTOS => {
- 'optional_identifier' => 127
+ 'optional_anonymous_identifier' => 127
}
},
{#State 93
ACTIONS => {
'IDENTIFIER' => 126
},
- DEFAULT => -117,
+ DEFAULT => -119,
GOTOS => {
- 'optional_identifier' => 129
+ 'optional_anonymous_identifier' => 129
}
},
{#State 99
},
{#State 101
ACTIONS => {
- 'IDENTIFIER' => 126
+ 'IDENTIFIER' => 130
},
DEFAULT => -117,
GOTOS => {
- 'optional_identifier' => 130
+ 'optional_identifier' => 131
}
},
{#State 102
ACTIONS => {
- 'IDENTIFIER' => 126
+ 'IDENTIFIER' => 130
},
DEFAULT => -117,
GOTOS => {
- 'optional_identifier' => 131
+ 'optional_identifier' => 132
}
},
{#State 103
'identifier' => 96,
'struct' => 62,
'enum' => 65,
- 'type' => 132,
+ 'type' => 133,
'union' => 67,
'sign' => 97
}
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 133
+ 'identifier' => 134
}
},
{#State 106
DEFAULT => -75,
GOTOS => {
- 'pointers' => 134
+ 'pointers' => 135
}
},
{#State 107
},
{#State 113
ACTIONS => {
- "}" => 135,
+ "}" => 136,
"," => 83
}
},
{#State 117
ACTIONS => {
"," => 83,
- ")" => 136
+ ")" => 137
}
},
{#State 118
{#State 125
DEFAULT => -75,
GOTOS => {
- 'pointers' => 137
+ 'pointers' => 138
}
},
{#State 126
- DEFAULT => -118
+ DEFAULT => -120
},
{#State 127
ACTIONS => {
- "{" => 139
+ "{" => 140
},
DEFAULT => -71,
GOTOS => {
- 'union_body' => 140,
- 'opt_union_body' => 138
+ 'union_body' => 141,
+ 'opt_union_body' => 139
}
},
{#State 128
},
{#State 129
ACTIONS => {
- "{" => 142
+ "{" => 143
},
DEFAULT => -61,
GOTOS => {
- 'struct_body' => 141,
- 'opt_struct_body' => 143
+ 'struct_body' => 142,
+ 'opt_struct_body' => 144
}
},
{#State 130
+ DEFAULT => -118
+ },
+ {#State 131
ACTIONS => {
- "{" => 144
+ "{" => 145
},
DEFAULT => -44,
GOTOS => {
- 'opt_enum_body' => 146,
- 'enum_body' => 145
+ 'opt_enum_body' => 147,
+ 'enum_body' => 146
}
},
- {#State 131
+ {#State 132
ACTIONS => {
- "{" => 148
+ "{" => 149
},
DEFAULT => -52,
GOTOS => {
- 'bitmap_body' => 149,
- 'opt_bitmap_body' => 147
+ 'bitmap_body' => 150,
+ 'opt_bitmap_body' => 148
}
},
- {#State 132
+ {#State 133
DEFAULT => -77
},
- {#State 133
+ {#State 134
ACTIONS => {
- "(" => 150
+ "(" => 151
}
},
- {#State 134
+ {#State 135
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 152
+ "*" => 153
},
GOTOS => {
- 'identifier' => 151
+ 'identifier' => 152
}
},
- {#State 135
+ {#State 136
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 153,
+ 'anytext' => 154,
'text' => 51,
'constant' => 47
}
},
- {#State 136
+ {#State 137
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 154,
+ 'anytext' => 155,
'text' => 51,
'constant' => 47
}
},
- {#State 137
+ {#State 138
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 152
+ "*" => 153
},
GOTOS => {
- 'identifier' => 155
+ 'identifier' => 156
}
},
- {#State 138
+ {#State 139
DEFAULT => -73
},
- {#State 139
+ {#State 140
DEFAULT => -68,
GOTOS => {
- 'union_elements' => 156
+ 'union_elements' => 157
}
},
- {#State 140
+ {#State 141
DEFAULT => -72
},
- {#State 141
+ {#State 142
DEFAULT => -62
},
- {#State 142
+ {#State 143
DEFAULT => -78,
GOTOS => {
- 'element_list1' => 157
+ 'element_list1' => 158
}
},
- {#State 143
+ {#State 144
DEFAULT => -63
},
- {#State 144
+ {#State 145
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 158,
- 'enum_element' => 159,
- 'enum_elements' => 160
+ 'identifier' => 159,
+ 'enum_element' => 160,
+ 'enum_elements' => 161
}
},
- {#State 145
+ {#State 146
DEFAULT => -45
},
- {#State 146
+ {#State 147
DEFAULT => -46
},
- {#State 147
+ {#State 148
DEFAULT => -54
},
- {#State 148
+ {#State 149
ACTIONS => {
'IDENTIFIER' => 26
},
DEFAULT => -57,
GOTOS => {
- 'identifier' => 163,
- 'bitmap_element' => 162,
- 'bitmap_elements' => 161,
- 'opt_bitmap_elements' => 164
+ 'identifier' => 164,
+ 'bitmap_element' => 163,
+ 'bitmap_elements' => 162,
+ 'opt_bitmap_elements' => 165
}
},
- {#State 149
+ {#State 150
DEFAULT => -53
},
- {#State 150
+ {#State 151
ACTIONS => {
"," => -82,
- "void" => 168,
- "const" => 166,
+ "void" => 169,
+ "const" => 167,
")" => -82
},
DEFAULT => -80,
GOTOS => {
- 'optional_const' => 165,
- 'element_list2' => 167
+ 'optional_const' => 166,
+ 'element_list2' => 168
}
},
- {#State 151
+ {#State 152
ACTIONS => {
- "[" => 169,
- "=" => 171
+ "[" => 170,
+ "=" => 172
},
GOTOS => {
- 'array_len' => 170
+ 'array_len' => 171
}
},
- {#State 152
+ {#State 153
DEFAULT => -76
},
- {#State 153
+ {#State 154
ACTIONS => {
"-" => 69,
":" => 68,
},
DEFAULT => -115
},
- {#State 154
+ {#State 155
ACTIONS => {
":" => 68,
"<" => 71,
},
DEFAULT => -114
},
- {#State 155
+ {#State 156
ACTIONS => {
- "[" => 169
+ "[" => 170
},
DEFAULT => -86,
GOTOS => {
- 'array_len' => 172
+ 'array_len' => 173
}
},
- {#State 156
+ {#State 157
ACTIONS => {
- "}" => 173
+ "}" => 174
},
DEFAULT => -89,
GOTOS => {
- 'optional_base_element' => 175,
- 'property_list' => 174
+ 'optional_base_element' => 176,
+ 'property_list' => 175
}
},
- {#State 157
+ {#State 158
ACTIONS => {
- "}" => 176
+ "}" => 177
},
DEFAULT => -89,
GOTOS => {
- 'base_element' => 177,
- 'property_list' => 178
+ 'base_element' => 178,
+ 'property_list' => 179
}
},
- {#State 158
+ {#State 159
ACTIONS => {
- "=" => 179
+ "=" => 180
},
DEFAULT => -49
},
- {#State 159
+ {#State 160
DEFAULT => -47
},
- {#State 160
+ {#State 161
ACTIONS => {
- "}" => 180,
- "," => 181
+ "}" => 181,
+ "," => 182
}
},
- {#State 161
+ {#State 162
ACTIONS => {
- "," => 182
+ "," => 183
},
DEFAULT => -58
},
- {#State 162
+ {#State 163
DEFAULT => -55
},
- {#State 163
+ {#State 164
ACTIONS => {
- "=" => 183
+ "=" => 184
}
},
- {#State 164
+ {#State 165
ACTIONS => {
- "}" => 184
+ "}" => 185
}
},
- {#State 165
+ {#State 166
DEFAULT => -89,
GOTOS => {
- 'base_element' => 185,
- 'property_list' => 178
+ 'base_element' => 186,
+ 'property_list' => 179
}
},
- {#State 166
+ {#State 167
DEFAULT => -81
},
- {#State 167
+ {#State 168
ACTIONS => {
- "," => 186,
- ")" => 187
+ "," => 187,
+ ")" => 188
}
},
- {#State 168
+ {#State 169
DEFAULT => -83
},
- {#State 169
+ {#State 170
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
- "]" => 188,
+ "]" => 189,
'IDENTIFIER' => 26
},
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 189,
+ 'anytext' => 190,
'text' => 51,
'constant' => 47
}
},
- {#State 170
+ {#State 171
ACTIONS => {
- "=" => 190
+ "=" => 191
}
},
- {#State 171
+ {#State 172
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 191,
+ 'anytext' => 192,
'text' => 51,
'constant' => 47
}
},
- {#State 172
+ {#State 173
ACTIONS => {
- ";" => 192
+ ";" => 193
}
},
- {#State 173
+ {#State 174
DEFAULT => -70
},
- {#State 174
+ {#State 175
ACTIONS => {
"[" => 20
},
DEFAULT => -89,
GOTOS => {
- 'base_or_empty' => 193,
- 'base_element' => 194,
- 'empty_element' => 195,
- 'property_list' => 196
+ 'base_or_empty' => 194,
+ 'base_element' => 195,
+ 'empty_element' => 196,
+ 'property_list' => 197
}
},
- {#State 175
+ {#State 176
DEFAULT => -69
},
- {#State 176
+ {#State 177
DEFAULT => -60
},
- {#State 177
+ {#State 178
ACTIONS => {
- ";" => 197
+ ";" => 198
}
},
- {#State 178
+ {#State 179
ACTIONS => {
'IDENTIFIER' => 26,
"signed" => 100,
'identifier' => 96,
'struct' => 62,
'enum' => 65,
- 'type' => 198,
+ 'type' => 199,
'union' => 67,
'sign' => 97
}
},
- {#State 179
+ {#State 180
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 199,
+ 'anytext' => 200,
'text' => 51,
'constant' => 47
}
},
- {#State 180
+ {#State 181
DEFAULT => -43
},
- {#State 181
+ {#State 182
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 158,
- 'enum_element' => 200
+ 'identifier' => 159,
+ 'enum_element' => 201
}
},
- {#State 182
+ {#State 183
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 163,
- 'bitmap_element' => 201
+ 'identifier' => 164,
+ 'bitmap_element' => 202
}
},
- {#State 183
+ {#State 184
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 202,
+ 'anytext' => 203,
'text' => 51,
'constant' => 47
}
},
- {#State 184
+ {#State 185
DEFAULT => -51
},
- {#State 185
+ {#State 186
DEFAULT => -84
},
- {#State 186
+ {#State 187
ACTIONS => {
- "const" => 166
+ "const" => 167
},
DEFAULT => -80,
GOTOS => {
- 'optional_const' => 203
+ 'optional_const' => 204
}
},
- {#State 187
+ {#State 188
ACTIONS => {
- ";" => 204
+ ";" => 205
}
},
- {#State 188
+ {#State 189
ACTIONS => {
- "[" => 169
+ "[" => 170
},
DEFAULT => -86,
GOTOS => {
- 'array_len' => 205
+ 'array_len' => 206
}
},
- {#State 189
+ {#State 190
ACTIONS => {
"-" => 69,
":" => 68,
"(" => 78,
"*" => 80,
"." => 81,
- "]" => 206,
+ "]" => 207,
">" => 82
}
},
- {#State 190
+ {#State 191
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 207,
+ 'anytext' => 208,
'text' => 51,
'constant' => 47
}
},
- {#State 191
+ {#State 192
ACTIONS => {
"-" => 69,
":" => 68,
"?" => 70,
"<" => 71,
- ";" => 208,
+ ";" => 209,
"+" => 73,
"~" => 72,
"&" => 75,
">" => 82
}
},
- {#State 192
+ {#State 193
DEFAULT => -29
},
- {#State 193
+ {#State 194
DEFAULT => -67
},
- {#State 194
+ {#State 195
ACTIONS => {
- ";" => 209
+ ";" => 210
}
},
- {#State 195
+ {#State 196
DEFAULT => -66
},
- {#State 196
+ {#State 197
ACTIONS => {
'IDENTIFIER' => 26,
"signed" => 100,
- ";" => 210,
+ ";" => 211,
'void' => 93,
"unsigned" => 104,
"[" => 20
'identifier' => 96,
'struct' => 62,
'enum' => 65,
- 'type' => 198,
+ 'type' => 199,
'union' => 67,
'sign' => 97
}
},
- {#State 197
+ {#State 198
DEFAULT => -79
},
- {#State 198
+ {#State 199
DEFAULT => -75,
GOTOS => {
- 'pointers' => 211
+ 'pointers' => 212
}
},
- {#State 199
+ {#State 200
ACTIONS => {
"-" => 69,
":" => 68,
},
DEFAULT => -50
},
- {#State 200
+ {#State 201
DEFAULT => -48
},
- {#State 201
+ {#State 202
DEFAULT => -56
},
- {#State 202
+ {#State 203
ACTIONS => {
"-" => 69,
":" => 68,
},
DEFAULT => -59
},
- {#State 203
+ {#State 204
DEFAULT => -89,
GOTOS => {
- 'base_element' => 212,
- 'property_list' => 178
+ 'base_element' => 213,
+ 'property_list' => 179
}
},
- {#State 204
+ {#State 205
DEFAULT => -28
},
- {#State 205
+ {#State 206
DEFAULT => -87
},
- {#State 206
+ {#State 207
ACTIONS => {
- "[" => 169
+ "[" => 170
},
DEFAULT => -86,
GOTOS => {
- 'array_len' => 213
+ 'array_len' => 214
}
},
- {#State 207
+ {#State 208
ACTIONS => {
"-" => 69,
":" => 68,
"?" => 70,
"<" => 71,
- ";" => 214,
+ ";" => 215,
"+" => 73,
"~" => 72,
"&" => 75,
">" => 82
}
},
- {#State 208
+ {#State 209
DEFAULT => -26
},
- {#State 209
+ {#State 210
DEFAULT => -65
},
- {#State 210
+ {#State 211
DEFAULT => -64
},
- {#State 211
+ {#State 212
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 152
+ "*" => 153
},
GOTOS => {
- 'identifier' => 215
+ 'identifier' => 216
}
},
- {#State 212
+ {#State 213
DEFAULT => -85
},
- {#State 213
+ {#State 214
DEFAULT => -88
},
- {#State 214
+ {#State 215
DEFAULT => -27
},
- {#State 215
+ {#State 216
ACTIONS => {
- "[" => 169
+ "[" => 170
},
DEFAULT => -86,
GOTOS => {
- 'array_len' => 216
+ 'array_len' => 217
}
},
- {#State 216
+ {#State 217
DEFAULT => -74
}
],
'optional_identifier', 1, undef
],
[#Rule 119
- 'constant', 1, undef
+ 'optional_anonymous_identifier', 0,
+sub
+#line 503 "idl.yp"
+{ anonymous_identifier($_[0]) }
],
[#Rule 120
+ 'optional_anonymous_identifier', 1, undef
+ ],
+ [#Rule 121
+ 'constant', 1, undef
+ ],
+ [#Rule 122
'text', 1,
sub
+<<<<<<< HEAD
#line 531 "idl.yp"
+=======
+#line 513 "idl.yp"
+>>>>>>> 239255a... TODO pidl/IDL: give anonymous structs and unions a name...
{ "\"$_[1]\"" }
],
- [#Rule 121
+ [#Rule 123
'optional_semicolon', 0, undef
],
- [#Rule 122
+ [#Rule 124
'optional_semicolon', 1, undef
]
],
bless($self,$class);
}
+<<<<<<< HEAD
#line 543 "idl.yp"
+=======
+#line 525 "idl.yp"
+>>>>>>> 239255a... TODO pidl/IDL: give anonymous structs and unions a name...
use Parse::Pidl qw(error);
+use File::Basename;
#####################################################################
# flatten an array of hashes into a single hash
return $v;
}
+sub anonymous_identifier($)
+{
+ my($parser)=shift;
+ my $name = "__pidl_anonymous_";
+ $name .= basename($parser->YYData->{FILE});
+ $name .= "_";
+ $name .= $parser->YYData->{LINE};
+ $name .= "_";
+ $name .= $parser->YYData->{ANONYMOUS_COUNTER}++;
+
+ $name =~ s/\./_/g;
+ $name =~ s/\//_/g;
+ $name =~ s/\\/_/g;
+
+ return $name;
+}
+
sub _Error {
if (exists $_[0]->YYData->{ERRMSG}) {
error($_[0]->YYData, $_[0]->YYData->{ERRMSG});
$self->YYData->{INPUT} = $data;
$self->YYData->{LINE} = 0;
$self->YYData->{LAST_TOKEN} = "NONE";
+ $self->YYData->{ANONYMOUS_COUNTER} = 0;
my $idl = $self->YYParse( yylex => \&_Lexer, yyerror => \&_Error );