;
struct:
- property_list 'struct' optional_anonymous_identifier opt_struct_body
+ property_list 'struct' optional_identifier opt_struct_body
{{
"TYPE" => "STRUCT",
"PROPERTIES" => $_[1],
;
union:
- property_list 'union' optional_anonymous_identifier opt_union_body
+ property_list 'union' optional_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 => -122
+ DEFAULT => -120
},
{#State 17
DEFAULT => -11
DEFAULT => -99
},
{#State 48
- DEFAULT => -121
+ DEFAULT => -119
},
{#State 49
ACTIONS => {
ACTIONS => {
";" => 86
},
- DEFAULT => -123,
+ DEFAULT => -121,
GOTOS => {
'optional_semicolon' => 85
}
DEFAULT => -13
},
{#State 86
- DEFAULT => -124
+ DEFAULT => -122
},
{#State 87
ACTIONS => {
ACTIONS => {
";" => 86
},
- DEFAULT => -123,
+ DEFAULT => -121,
GOTOS => {
'optional_semicolon' => 124
}
ACTIONS => {
'IDENTIFIER' => 126
},
- DEFAULT => -119,
+ DEFAULT => -117,
GOTOS => {
- 'optional_anonymous_identifier' => 127
+ 'optional_identifier' => 127
}
},
{#State 93
ACTIONS => {
'IDENTIFIER' => 126
},
- DEFAULT => -119,
+ DEFAULT => -117,
GOTOS => {
- 'optional_anonymous_identifier' => 129
+ 'optional_identifier' => 129
}
},
{#State 99
},
{#State 101
ACTIONS => {
- 'IDENTIFIER' => 130
+ 'IDENTIFIER' => 126
},
DEFAULT => -117,
GOTOS => {
- 'optional_identifier' => 131
+ 'optional_identifier' => 130
}
},
{#State 102
ACTIONS => {
- 'IDENTIFIER' => 130
+ 'IDENTIFIER' => 126
},
DEFAULT => -117,
GOTOS => {
- 'optional_identifier' => 132
+ 'optional_identifier' => 131
}
},
{#State 103
'identifier' => 96,
'struct' => 62,
'enum' => 65,
- 'type' => 133,
+ 'type' => 132,
'union' => 67,
'sign' => 97
}
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 134
+ 'identifier' => 133
}
},
{#State 106
DEFAULT => -75,
GOTOS => {
- 'pointers' => 135
+ 'pointers' => 134
}
},
{#State 107
},
{#State 113
ACTIONS => {
- "}" => 136,
+ "}" => 135,
"," => 83
}
},
{#State 117
ACTIONS => {
"," => 83,
- ")" => 137
+ ")" => 136
}
},
{#State 118
{#State 125
DEFAULT => -75,
GOTOS => {
- 'pointers' => 138
+ 'pointers' => 137
}
},
{#State 126
- DEFAULT => -120
+ DEFAULT => -118
},
{#State 127
ACTIONS => {
- "{" => 140
+ "{" => 139
},
DEFAULT => -71,
GOTOS => {
- 'union_body' => 141,
- 'opt_union_body' => 139
+ 'union_body' => 140,
+ 'opt_union_body' => 138
}
},
{#State 128
},
{#State 129
ACTIONS => {
- "{" => 143
+ "{" => 142
},
DEFAULT => -61,
GOTOS => {
- 'struct_body' => 142,
- 'opt_struct_body' => 144
+ 'struct_body' => 141,
+ 'opt_struct_body' => 143
}
},
{#State 130
- DEFAULT => -118
- },
- {#State 131
ACTIONS => {
- "{" => 145
+ "{" => 144
},
DEFAULT => -44,
GOTOS => {
- 'opt_enum_body' => 147,
- 'enum_body' => 146
+ 'opt_enum_body' => 146,
+ 'enum_body' => 145
}
},
- {#State 132
+ {#State 131
ACTIONS => {
- "{" => 149
+ "{" => 148
},
DEFAULT => -52,
GOTOS => {
- 'bitmap_body' => 150,
- 'opt_bitmap_body' => 148
+ 'bitmap_body' => 149,
+ 'opt_bitmap_body' => 147
}
},
- {#State 133
+ {#State 132
DEFAULT => -77
},
- {#State 134
+ {#State 133
ACTIONS => {
- "(" => 151
+ "(" => 150
}
},
- {#State 135
+ {#State 134
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 153
+ "*" => 152
},
GOTOS => {
- 'identifier' => 152
+ 'identifier' => 151
}
},
- {#State 136
+ {#State 135
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 154,
+ 'anytext' => 153,
'text' => 51,
'constant' => 47
}
},
- {#State 137
+ {#State 136
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 155,
+ 'anytext' => 154,
'text' => 51,
'constant' => 47
}
},
- {#State 138
+ {#State 137
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 153
+ "*" => 152
},
GOTOS => {
- 'identifier' => 156
+ 'identifier' => 155
}
},
- {#State 139
+ {#State 138
DEFAULT => -73
},
- {#State 140
+ {#State 139
DEFAULT => -68,
GOTOS => {
- 'union_elements' => 157
+ 'union_elements' => 156
}
},
- {#State 141
+ {#State 140
DEFAULT => -72
},
- {#State 142
+ {#State 141
DEFAULT => -62
},
- {#State 143
+ {#State 142
DEFAULT => -78,
GOTOS => {
- 'element_list1' => 158
+ 'element_list1' => 157
}
},
- {#State 144
+ {#State 143
DEFAULT => -63
},
- {#State 145
+ {#State 144
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 159,
- 'enum_element' => 160,
- 'enum_elements' => 161
+ 'identifier' => 158,
+ 'enum_element' => 159,
+ 'enum_elements' => 160
}
},
- {#State 146
+ {#State 145
DEFAULT => -45
},
- {#State 147
+ {#State 146
DEFAULT => -46
},
- {#State 148
+ {#State 147
DEFAULT => -54
},
- {#State 149
+ {#State 148
ACTIONS => {
'IDENTIFIER' => 26
},
DEFAULT => -57,
GOTOS => {
- 'identifier' => 164,
- 'bitmap_element' => 163,
- 'bitmap_elements' => 162,
- 'opt_bitmap_elements' => 165
+ 'identifier' => 163,
+ 'bitmap_element' => 162,
+ 'bitmap_elements' => 161,
+ 'opt_bitmap_elements' => 164
}
},
- {#State 150
+ {#State 149
DEFAULT => -53
},
- {#State 151
+ {#State 150
ACTIONS => {
"," => -82,
- "void" => 169,
- "const" => 167,
+ "void" => 168,
+ "const" => 166,
")" => -82
},
DEFAULT => -80,
GOTOS => {
- 'optional_const' => 166,
- 'element_list2' => 168
+ 'optional_const' => 165,
+ 'element_list2' => 167
}
},
- {#State 152
+ {#State 151
ACTIONS => {
- "[" => 170,
- "=" => 172
+ "[" => 169,
+ "=" => 171
},
GOTOS => {
- 'array_len' => 171
+ 'array_len' => 170
}
},
- {#State 153
+ {#State 152
DEFAULT => -76
},
- {#State 154
+ {#State 153
ACTIONS => {
"-" => 69,
":" => 68,
},
DEFAULT => -115
},
- {#State 155
+ {#State 154
ACTIONS => {
":" => 68,
"<" => 71,
},
DEFAULT => -114
},
- {#State 156
+ {#State 155
ACTIONS => {
- "[" => 170
+ "[" => 169
},
DEFAULT => -86,
GOTOS => {
- 'array_len' => 173
+ 'array_len' => 172
}
},
- {#State 157
+ {#State 156
ACTIONS => {
- "}" => 174
+ "}" => 173
},
DEFAULT => -89,
GOTOS => {
- 'optional_base_element' => 176,
- 'property_list' => 175
+ 'optional_base_element' => 175,
+ 'property_list' => 174
}
},
- {#State 158
+ {#State 157
ACTIONS => {
- "}" => 177
+ "}" => 176
},
DEFAULT => -89,
GOTOS => {
- 'base_element' => 178,
- 'property_list' => 179
+ 'base_element' => 177,
+ 'property_list' => 178
}
},
- {#State 159
+ {#State 158
ACTIONS => {
- "=" => 180
+ "=" => 179
},
DEFAULT => -49
},
- {#State 160
+ {#State 159
DEFAULT => -47
},
- {#State 161
+ {#State 160
ACTIONS => {
- "}" => 181,
- "," => 182
+ "}" => 180,
+ "," => 181
}
},
- {#State 162
+ {#State 161
ACTIONS => {
- "," => 183
+ "," => 182
},
DEFAULT => -58
},
- {#State 163
+ {#State 162
DEFAULT => -55
},
- {#State 164
+ {#State 163
ACTIONS => {
- "=" => 184
+ "=" => 183
}
},
- {#State 165
+ {#State 164
ACTIONS => {
- "}" => 185
+ "}" => 184
}
},
- {#State 166
+ {#State 165
DEFAULT => -89,
GOTOS => {
- 'base_element' => 186,
- 'property_list' => 179
+ 'base_element' => 185,
+ 'property_list' => 178
}
},
- {#State 167
+ {#State 166
DEFAULT => -81
},
- {#State 168
+ {#State 167
ACTIONS => {
- "," => 187,
- ")" => 188
+ "," => 186,
+ ")" => 187
}
},
- {#State 169
+ {#State 168
DEFAULT => -83
},
- {#State 170
+ {#State 169
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
- "]" => 189,
+ "]" => 188,
'IDENTIFIER' => 26
},
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 190,
+ 'anytext' => 189,
'text' => 51,
'constant' => 47
}
},
- {#State 171
+ {#State 170
ACTIONS => {
- "=" => 191
+ "=" => 190
}
},
- {#State 172
+ {#State 171
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 192,
+ 'anytext' => 191,
'text' => 51,
'constant' => 47
}
},
- {#State 173
+ {#State 172
ACTIONS => {
- ";" => 193
+ ";" => 192
}
},
- {#State 174
+ {#State 173
DEFAULT => -70
},
- {#State 175
+ {#State 174
ACTIONS => {
"[" => 20
},
DEFAULT => -89,
GOTOS => {
- 'base_or_empty' => 194,
- 'base_element' => 195,
- 'empty_element' => 196,
- 'property_list' => 197
+ 'base_or_empty' => 193,
+ 'base_element' => 194,
+ 'empty_element' => 195,
+ 'property_list' => 196
}
},
- {#State 176
+ {#State 175
DEFAULT => -69
},
- {#State 177
+ {#State 176
DEFAULT => -60
},
- {#State 178
+ {#State 177
ACTIONS => {
- ";" => 198
+ ";" => 197
}
},
- {#State 179
+ {#State 178
ACTIONS => {
'IDENTIFIER' => 26,
"signed" => 100,
'identifier' => 96,
'struct' => 62,
'enum' => 65,
- 'type' => 199,
+ 'type' => 198,
'union' => 67,
'sign' => 97
}
},
- {#State 180
+ {#State 179
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 200,
+ 'anytext' => 199,
'text' => 51,
'constant' => 47
}
},
- {#State 181
+ {#State 180
DEFAULT => -43
},
- {#State 182
+ {#State 181
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 159,
- 'enum_element' => 201
+ 'identifier' => 158,
+ 'enum_element' => 200
}
},
- {#State 183
+ {#State 182
ACTIONS => {
'IDENTIFIER' => 26
},
GOTOS => {
- 'identifier' => 164,
- 'bitmap_element' => 202
+ 'identifier' => 163,
+ 'bitmap_element' => 201
}
},
- {#State 184
+ {#State 183
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 203,
+ 'anytext' => 202,
'text' => 51,
'constant' => 47
}
},
- {#State 185
+ {#State 184
DEFAULT => -51
},
- {#State 186
+ {#State 185
DEFAULT => -84
},
- {#State 187
+ {#State 186
ACTIONS => {
- "const" => 167
+ "const" => 166
},
DEFAULT => -80,
GOTOS => {
- 'optional_const' => 204
+ 'optional_const' => 203
}
},
- {#State 188
+ {#State 187
ACTIONS => {
- ";" => 205
+ ";" => 204
}
},
- {#State 189
+ {#State 188
ACTIONS => {
- "[" => 170
+ "[" => 169
},
DEFAULT => -86,
GOTOS => {
- 'array_len' => 206
+ 'array_len' => 205
}
},
- {#State 190
+ {#State 189
ACTIONS => {
"-" => 69,
":" => 68,
"(" => 78,
"*" => 80,
"." => 81,
- "]" => 207,
+ "]" => 206,
">" => 82
}
},
- {#State 191
+ {#State 190
ACTIONS => {
'CONSTANT' => 48,
'TEXT' => 16,
DEFAULT => -97,
GOTOS => {
'identifier' => 50,
- 'anytext' => 208,
+ 'anytext' => 207,
'text' => 51,
'constant' => 47
}
},
- {#State 192
+ {#State 191
ACTIONS => {
"-" => 69,
":" => 68,
"?" => 70,
"<" => 71,
- ";" => 209,
+ ";" => 208,
"+" => 73,
"~" => 72,
"&" => 75,
">" => 82
}
},
- {#State 193
+ {#State 192
DEFAULT => -29
},
- {#State 194
+ {#State 193
DEFAULT => -67
},
- {#State 195
+ {#State 194
ACTIONS => {
- ";" => 210
+ ";" => 209
}
},
- {#State 196
+ {#State 195
DEFAULT => -66
},
- {#State 197
+ {#State 196
ACTIONS => {
'IDENTIFIER' => 26,
"signed" => 100,
- ";" => 211,
+ ";" => 210,
'void' => 93,
"unsigned" => 104,
"[" => 20
'identifier' => 96,
'struct' => 62,
'enum' => 65,
- 'type' => 199,
+ 'type' => 198,
'union' => 67,
'sign' => 97
}
},
- {#State 198
+ {#State 197
DEFAULT => -79
},
- {#State 199
+ {#State 198
DEFAULT => -75,
GOTOS => {
- 'pointers' => 212
+ 'pointers' => 211
}
},
- {#State 200
+ {#State 199
ACTIONS => {
"-" => 69,
":" => 68,
},
DEFAULT => -50
},
- {#State 201
+ {#State 200
DEFAULT => -48
},
- {#State 202
+ {#State 201
DEFAULT => -56
},
- {#State 203
+ {#State 202
ACTIONS => {
"-" => 69,
":" => 68,
},
DEFAULT => -59
},
- {#State 204
+ {#State 203
DEFAULT => -89,
GOTOS => {
- 'base_element' => 213,
- 'property_list' => 179
+ 'base_element' => 212,
+ 'property_list' => 178
}
},
- {#State 205
+ {#State 204
DEFAULT => -28
},
- {#State 206
+ {#State 205
DEFAULT => -87
},
- {#State 207
+ {#State 206
ACTIONS => {
- "[" => 170
+ "[" => 169
},
DEFAULT => -86,
GOTOS => {
- 'array_len' => 214
+ 'array_len' => 213
}
},
- {#State 208
+ {#State 207
ACTIONS => {
"-" => 69,
":" => 68,
"?" => 70,
"<" => 71,
- ";" => 215,
+ ";" => 214,
"+" => 73,
"~" => 72,
"&" => 75,
">" => 82
}
},
- {#State 209
+ {#State 208
DEFAULT => -26
},
- {#State 210
+ {#State 209
DEFAULT => -65
},
- {#State 211
+ {#State 210
DEFAULT => -64
},
- {#State 212
+ {#State 211
ACTIONS => {
'IDENTIFIER' => 26,
- "*" => 153
+ "*" => 152
},
GOTOS => {
- 'identifier' => 216
+ 'identifier' => 215
}
},
- {#State 213
+ {#State 212
DEFAULT => -85
},
- {#State 214
+ {#State 213
DEFAULT => -88
},
- {#State 215
+ {#State 214
DEFAULT => -27
},
- {#State 216
+ {#State 215
ACTIONS => {
- "[" => 170
+ "[" => 169
},
DEFAULT => -86,
GOTOS => {
- 'array_len' => 217
+ 'array_len' => 216
}
},
- {#State 217
+ {#State 216
DEFAULT => -74
}
],
'optional_identifier', 1, undef
],
[#Rule 119
- '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
+ [#Rule 120
'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 123
+ [#Rule 121
'optional_semicolon', 0, undef
],
- [#Rule 124
+ [#Rule 122
'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 );