mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-19 10:29:30 +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
|
# These are set automatically by the build/commit script
|
||||||
use constant {
|
use constant {
|
||||||
BUILD_NAME => "PBot",
|
BUILD_NAME => "PBot",
|
||||||
BUILD_REVISION => 694,
|
BUILD_REVISION => 695,
|
||||||
BUILD_DATE => "2014-07-02",
|
BUILD_DATE => "2014-07-02",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -162,20 +162,23 @@ function_definition:
|
|||||||
$return .= join('', @{$item{'compound_statement(?)'}});
|
$return .= join('', @{$item{'compound_statement(?)'}});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
block_item_list:
|
||||||
|
block_item(s)
|
||||||
|
{ $return = join('', @{$item{'block_item(s)'}}); }
|
||||||
|
|
||||||
|
block_item:
|
||||||
|
declaration
|
||||||
|
| statement
|
||||||
|
|
||||||
compound_statement:
|
compound_statement:
|
||||||
'{' declaration_list(?) statement_list(?) '}'
|
'{' block_item_list(s?) '}'
|
||||||
{
|
{
|
||||||
my $declaration_list = join('',@{$item{'declaration_list(?)'}});
|
my $block_items = join('', @{$item{'block_item_list(s?)'}});
|
||||||
my $statement_list = join('',@{$item{'statement_list(?)'}});
|
|
||||||
|
|
||||||
$return = "Begin new block.\n" if not $arg{context};
|
$return = "Begin new block.\n" if not $arg{context};
|
||||||
|
|
||||||
if ($declaration_list) {
|
if ($block_items) {
|
||||||
$return .= $declaration_list;
|
$return .= $block_items;
|
||||||
}
|
|
||||||
|
|
||||||
if ($statement_list ) {
|
|
||||||
$return .= $statement_list;
|
|
||||||
} else {
|
} else {
|
||||||
$return .= "Do nothing.\n";
|
$return .= "Do nothing.\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user