3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-11-05 19:49:32 +01:00

applets/c2english: fix issue parsing int *(foo)[5]

This commit is contained in:
Pragmatic Software 2023-01-23 12:46:15 -08:00
parent 7a6a150067
commit de7db72c04
3 changed files with 18 additions and 11 deletions

View File

@ -1,7 +1,7 @@
# C-to-English Grammar
# Pragmatic Software
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-FileCopyrightText: 2023 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT
{
@ -1367,6 +1367,10 @@ direct_declarator:
}
| '(' declarator ')' array_declarator(s)
{
if (ref $item{declarator} ne 'ARRAY') {
$item{declarator} = [$item{declarator}];
}
push @{$item{declarator}}, join(' ', @{$item{'array_declarator(s)'}});
$item{declarator}
}

View File

@ -1,6 +1,6 @@
#!/usr/bin/env perl
# SPDX-FileCopyrightText: 2021 Pragmatic Software <pragma78@gmail.com>
# SPDX-FileCopyrightText: 2023 Pragmatic Software <pragma78@gmail.com>
# SPDX-License-Identifier: MIT
use strict;
@ -47,11 +47,14 @@ sub istrue {
}
sub main {
my ($opt_T, $opt_t, $opt_o, $opt_P);
getopts('TPto:');
my %opts;
if ($opt_T ) {
$::RD_TRACE = 1;
getopts('TPo:', \%opts);
if ($opts{T}) {
print STDERR "Tracing enabled.\n";
$::RD_TRACE = 1;
}
$::RD_HINT = 1;
@ -59,15 +62,15 @@ sub main {
my $parser;
if ($opt_P or !eval { require PCGrammar }) {
if ($opts{P} or !eval { require PCGrammar }) {
precompile_grammar();
require PCGrammar;
}
$parser = PCGrammar->new or die "Bad grammar!\n";
if ($opt_o) {
open(OUTFILE, ">>$opt_o");
if ($opts{o}) {
open(OUTFILE, ">>$opts{o}");
*STDOUT = *OUTFILE{IO};
}

View File

@ -25,8 +25,8 @@ use PBot::Imports;
# These are set by the /misc/update_version script
use constant {
BUILD_NAME => "PBot",
BUILD_REVISION => 4603,
BUILD_DATE => "2023-01-22",
BUILD_REVISION => 4604,
BUILD_DATE => "2023-01-23",
};
sub initialize {}