3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-23 19:22:40 +01:00

CGrammar: Wrap struct/union member declaration list with commas to disambiguate nested structs/unions

This commit is contained in:
Pragmatic Software 2014-07-04 02:58:55 +00:00
parent 8b72c03d34
commit 8b626cc81e
2 changed files with 3 additions and 2 deletions

View File

@ -13,7 +13,7 @@ use warnings;
# These are set automatically by the build/commit script # These are set automatically by the build/commit script
use constant { use constant {
BUILD_NAME => "PBot", BUILD_NAME => "PBot",
BUILD_REVISION => 699, BUILD_REVISION => 700,
BUILD_DATE => "2014-07-03", BUILD_DATE => "2014-07-03",
}; };

View File

@ -788,6 +788,7 @@ declaration:
$return .= " $initializers[0]->[1]"; $return .= " $initializers[0]->[1]";
} }
} }
$return =~ s/,$//;
$return .= ".\n" unless $arg{context} eq 'for init'; $return .= ".\n" unless $arg{context} eq 'for init';
} }
} }
@ -1552,7 +1553,7 @@ struct_or_union_specifier:
$return = join('',@{$item{'comment(?)'}}) . $item{struct_or_union}; $return = join('',@{$item{'comment(?)'}}) . $item{struct_or_union};
if ($identifier) { $return .= " tagged $identifier"; } if ($identifier) { $return .= " tagged $identifier"; }
my $plural = $item{struct_declaration_list} =~ / and / ? 's' : ''; my $plural = $item{struct_declaration_list} =~ / and / ? 's' : '';
$return .= " with member$plural $item{struct_declaration_list}"; $return .= ", with member$plural $item{struct_declaration_list},";
} }
| struct_or_union identifier | struct_or_union identifier
{ {