[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/ParserNonXS.pm (%parser_state_config
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/ParserNonXS.pm (%parser_state_configuration) (_set_global_informations, parse_texi_file, _register_global_command), tp/Texinfo/XS/parsetexi/Parsetexi.pm (get_parser_info) (_maybe_ignore_before_setfilename, global_commands_information): use commands_info instead of extra as key for parser global commands informations. Synchronize code used to set preamble_before_setfilename. |
Date: |
Fri, 31 Dec 2021 09:48:44 -0500 |
This is an automated email from the git hooks/post-receive script.
pertusus pushed a commit to branch master
in repository texinfo.
The following commit(s) were added to refs/heads/master by this push:
new bcba0992d9 * tp/Texinfo/ParserNonXS.pm (%parser_state_configuration)
(_set_global_informations, parse_texi_file, _register_global_command),
tp/Texinfo/XS/parsetexi/Parsetexi.pm (get_parser_info)
(_maybe_ignore_before_setfilename, global_commands_information): use
commands_info instead of extra as key for parser global commands informations.
Synchronize code used to set preamble_before_setfilename.
bcba0992d9 is described below
commit bcba0992d9d03ec8dcfa822a8b713cb32270058f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Fri Dec 31 15:48:30 2021 +0100
* tp/Texinfo/ParserNonXS.pm (%parser_state_configuration)
(_set_global_informations, parse_texi_file, _register_global_command),
tp/Texinfo/XS/parsetexi/Parsetexi.pm (get_parser_info)
(_maybe_ignore_before_setfilename, global_commands_information):
use commands_info instead of extra as key for parser global
commands informations.
Synchronize code used to set preamble_before_setfilename.
---
ChangeLog | 10 ++++++++++
tp/Texinfo/ParserNonXS.pm | 23 +++++++++++++++--------
tp/Texinfo/XS/parsetexi/Parsetexi.pm | 26 +++++++++++---------------
3 files changed, 36 insertions(+), 23 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4c84e5b814..4edf8d9eab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2021-12-30 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm (%parser_state_configuration)
+ (_set_global_informations, parse_texi_file, _register_global_command),
+ tp/Texinfo/XS/parsetexi/Parsetexi.pm (get_parser_info)
+ (_maybe_ignore_before_setfilename, global_commands_information):
+ use commands_info instead of extra as key for parser global
+ commands informations.
+ Synchronize code used to set preamble_before_setfilename.
+
2021-12-30 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/ParserNonXS.pm (_expand_macro_body): ignore arg value
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 7a174f01d4..37c0ba840b 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -140,6 +140,9 @@ my %parser_state_configuration = (
# this is not really needed, as it would be autogenerated,
# but this allows to have an output more similar to the XS parser output.
'floats' => {},
+ 'commands_info' => {}, # keys are @-commands names (without @) and
+ # values are arrays for global multiple
@-commands
+ # and a value for non multiple global
@-commands.
);
my %parser_default_configuration = (
@@ -910,7 +913,8 @@ sub _set_global_informations($)
{
my $self = shift;
- if ($self->get_conf('novalidate') or $self->{'extra'}->{'novalidate'}) {
+ if ($self->get_conf('novalidate')
+ or $self->global_commands_information()->{'novalidate'}) {
$self->{'info'}->{'novalidate'} = 1;
}
}
@@ -978,12 +982,15 @@ sub parse_texi_file($$)
# Put everything before @setfilename in a special type. This allows to
# ignore everything before @setfilename.
if ($self->{'IGNORE_BEFORE_SETFILENAME'}
- and $self->{'extra'}->{'setfilename'}
- and $self->{'extra'}->{'setfilename'}->{'parent'} eq
$before_node_section) {
+ and $self->global_commands_information()->{'setfilename'}
+ and $self->global_commands_information()->{'setfilename'}->{'parent'}
+ eq $before_node_section) {
my $before_setfilename = {'type' => 'preamble_before_setfilename',
'parent' => $before_node_section,
'contents' => []};
- while ($before_node_section->{'contents'}->[0] ne
$self->{'extra'}->{'setfilename'}) {
+ while (@{$before_node_section->{'contents'}}
+ and (!$before_node_section->{'contents'}->[0]->{'cmdname'}
+ or $before_node_section->{'contents'}->[0]->{'cmdname'} ne
'setfilename')) {
my $content = shift @{$before_node_section->{'contents'}};
$content->{'parent'} = $before_setfilename;
push @{$before_setfilename->{'contents'}}, $content;
@@ -1042,7 +1049,7 @@ sub internal_references_information($)
sub global_commands_information($)
{
my $self = shift;
- return $self->{'extra'};
+ return $self->{'commands_info'};
}
# @ dircategory_direntry
@@ -1122,7 +1129,7 @@ sub _register_global_command {
$command = 'shortcontents';
}
if ($self->{'global_commands'}->{$command}) {
- push @{$self->{'extra'}->{$command}}, $current;
+ push @{$self->{'commands_info'}->{$command}}, $current;
$current->{'line_nr'} = $line_nr if (!$current->{'line_nr'});
return 1;
} elsif ($global_unique_commands{$command}) {
@@ -1130,11 +1137,11 @@ sub _register_global_command {
$current->{'line_nr'} = $line_nr if (!$current->{'line_nr'});
if ($command eq 'setfilename'
and scalar(@{$self->{'input'}}) > 1) {
- } elsif (exists ($self->{'extra'}->{$current->{'cmdname'}})) {
+ } elsif (exists ($self->{'commands_info'}->{$current->{'cmdname'}})) {
$self->_line_warn(sprintf(__('multiple @%s'),
$current->{'cmdname'}), $line_nr);
} else {
- $self->{'extra'}->{$current->{'cmdname'}} = $current;
+ $self->{'commands_info'}->{$current->{'cmdname'}} = $current;
}
return 1;
}
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index 448145a5f7..5b6d8d9969 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -195,9 +195,10 @@ sub get_parser_info {
$self->{'internal_references'} = $INTL_XREFS;
$self->{'floats'} = $FLOATS;
$self->{'info'} = $GLOBAL_INFO;
- $self->{'extra'} = $GLOBAL_INFO2;
+ $self->{'commands_info'} = $GLOBAL_INFO2;
- if ($self->get_conf('novalidate') or $self->{'extra'}->{'novalidate'}) {
+ if ($self->get_conf('novalidate')
+ or $self->global_commands_information()->{'novalidate'}) {
$self->{'info'}->{'novalidate'} = 1;
}
@@ -213,11 +214,12 @@ sub _maybe_ignore_before_setfilename {
my ($self, $before_node_section) = @_;
if ($self->{'IGNORE_BEFORE_SETFILENAME'}
- and $self->{'extra'}->{'setfilename'}
- and $self->{'extra'}->{'setfilename'}->{'parent'} eq
$before_node_section) {
+ and $self->global_commands_information()->{'setfilename'}
+ and $self->global_commands_information()->{'setfilename'}->{'parent'}
+ eq $before_node_section) {
my $before_setfilename = {'type' => 'preamble_before_setfilename',
- 'parent' => $before_node_section,
- 'contents' => []};
+ 'parent' => $before_node_section,
+ 'contents' => []};
while (@{$before_node_section->{'contents'}}
and (!$before_node_section->{'contents'}->[0]->{'cmdname'}
or $before_node_section->{'contents'}->[0]->{'cmdname'} ne
'setfilename')) {
@@ -225,14 +227,8 @@ sub _maybe_ignore_before_setfilename {
$content->{'parent'} = $before_setfilename;
push @{$before_setfilename->{'contents'}}, $content;
}
- if (!@{$before_node_section->{'contents'}}) {
- # not found
- #splice @{$before_node_section->{'contents'}}, 0, 0,
@$before_setfilename;
- $before_node_section->{'contents'} = $before_setfilename->{'contents'};
- } else {
- unshift (@{$before_node_section->{'contents'}}, $before_setfilename)
- if (@{$before_setfilename->{'contents'}});
- }
+ unshift (@{$before_node_section->{'contents'}}, $before_setfilename)
+ if (@{$before_setfilename->{'contents'}});
}
}
@@ -366,7 +362,7 @@ sub internal_references_information($)
sub global_commands_information($)
{
my $self = shift;
- return $self->{'extra'};
+ return $self->{'commands_info'};
}
sub global_informations($)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/ParserNonXS.pm (%parser_state_configuration) (_set_global_informations, parse_texi_file, _register_global_command), tp/Texinfo/XS/parsetexi/Parsetexi.pm (get_parser_info) (_maybe_ignore_before_setfilename, global_commands_information): use commands_info instead of extra as key for parser global commands informations. Synchronize code used to set preamble_before_setfilename.,
Patrice Dumas <=