mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-23 04:19:27 +01:00
CGrammar: Update compound-statements to C11's block-item-list mixing declarations and statements
This commit is contained in:
parent
07f9ef6120
commit
469e16ce28
@ -13,7 +13,7 @@ use warnings;
|
||||
# These are set automatically by the build/commit script
|
||||
use constant {
|
||||
BUILD_NAME => "PBot",
|
||||
BUILD_REVISION => 694,
|
||||
BUILD_REVISION => 695,
|
||||
BUILD_DATE => "2014-07-02",
|
||||
};
|
||||
|
||||
|
@ -162,20 +162,23 @@ function_definition:
|
||||
$return .= join('', @{$item{'compound_statement(?)'}});
|
||||
}
|
||||
|
||||
block_item_list:
|
||||
block_item(s)
|
||||
{ $return = join('', @{$item{'block_item(s)'}}); }
|
||||
|
||||
block_item:
|
||||
declaration
|
||||
| statement
|
||||
|
||||
compound_statement:
|
||||
'{' declaration_list(?) statement_list(?) '}'
|
||||
'{' block_item_list(s?) '}'
|
||||
{
|
||||
my $declaration_list = join('',@{$item{'declaration_list(?)'}});
|
||||
my $statement_list = join('',@{$item{'statement_list(?)'}});
|
||||
my $block_items = join('', @{$item{'block_item_list(s?)'}});
|
||||
|
||||
$return = "Begin new block.\n" if not $arg{context};
|
||||
|
||||
if ($declaration_list) {
|
||||
$return .= $declaration_list;
|
||||
}
|
||||
|
||||
if ($statement_list ) {
|
||||
$return .= $statement_list;
|
||||
if ($block_items) {
|
||||
$return .= $block_items;
|
||||
} else {
|
||||
$return .= "Do nothing.\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user