[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: Put non expanded @value flag name in extra flag
From: |
Patrice Dumas |
Subject: |
branch master updated: Put non expanded @value flag name in extra flag |
Date: |
Sun, 11 Sep 2022 07:00:00 -0400 |
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 d8cf5ca64f Put non expanded @value flag name in extra flag
d8cf5ca64f is described below
commit d8cf5ca64fd2d58113dfd78d2444bda8c3cfbe73
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Sep 11 12:59:50 2022 +0200
Put non expanded @value flag name in extra flag
* tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
tp/Texinfo/XS/parsetexi/api.c (element_to_perl_hash),
tp/Texinfo/XS/parsetexi/parser.c (merge_text)
(process_remaining_on_line), tp/Texinfo/Convert/HTML.pm,
tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
tp/Texinfo/Convert/Texinfo.pm: use an extra flag for non
expandeed @value flag name.
---
ChangeLog | 12 +++++++
tp/Texinfo/Convert/HTML.pm | 2 +-
tp/Texinfo/Convert/LaTeX.pm | 2 +-
tp/Texinfo/Convert/Plaintext.pm | 2 +-
tp/Texinfo/Convert/Texinfo.pm | 2 +-
tp/Texinfo/ParserNonXS.pm | 42 ++++++++++++----------
tp/Texinfo/XS/parsetexi/api.c | 5 +--
tp/Texinfo/XS/parsetexi/parser.c | 16 ++-------
.../results/converters_tests/at_commands_in_raw.pl | 6 ++--
tp/t/results/converters_tests/unknown_value.pl | 6 ++--
.../manual_simple_latin1_with_error.pl | 6 ++--
.../manual_simple_utf8_with_error.pl | 6 ++--
tp/t/results/value/bad_syntax.pl | 6 ++--
13 files changed, 63 insertions(+), 50 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 91726b8d2e..8141bf4f92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-09-11 Patrice Dumas <pertusus@free.fr>
+
+ Put non expanded @value flag name in extra flag
+
+ * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
+ tp/Texinfo/XS/parsetexi/api.c (element_to_perl_hash),
+ tp/Texinfo/XS/parsetexi/parser.c (merge_text)
+ (process_remaining_on_line), tp/Texinfo/Convert/HTML.pm,
+ tp/Texinfo/Convert/LaTeX.pm, tp/Texinfo/Convert/Plaintext.pm,
+ tp/Texinfo/Convert/Texinfo.pm: use an extra flag for non
+ expandeed @value flag name.
+
2022-09-11 Patrice Dumas <pertusus@free.fr>
Prepend internal_ to internal text containers names used only for
parsing
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index f39ac341d1..588e015b78 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -2643,7 +2643,7 @@ sub _convert_value_command($$$$)
my $args = shift;
return $self->convert_tree($self->gdt('@{No value for `{value}\'@}',
- {'value' => $command->{'type'}}));
+ {'value' => $command->{'extra'}->{'flag'}}));
}
$default_commands_conversion{'value'} = \&_convert_value_command;
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index e3f20ae91b..9ab58b7ffc 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -3045,7 +3045,7 @@ sub _convert($$)
return $result;
} elsif ($cmdname eq 'value') {
my $expansion = $self->gdt('@{No value for `{value}\'@}',
- {'value' => $element->{'type'}});
+ {'value' => $element->{'extra'}->{'flag'}});
$expansion = {'type' => 'paragraph',
'contents' => [$expansion]};
$result .= _convert($self, $expansion);
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index f14c4430b8..fb1710aa09 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -2378,7 +2378,7 @@ sub _convert($$)
} elsif ($command eq 'value') {
my $expansion = $self->gdt('@{No value for `{value}\'@}',
- {'value' => $element->{'type'}});
+ {'value' => $element->{'extra'}->{'flag'}});
if ($formatter->{'_top_formatter'}) {
$expansion = {'type' => 'paragraph',
'contents' => [$expansion]};
diff --git a/tp/Texinfo/Convert/Texinfo.pm b/tp/Texinfo/Convert/Texinfo.pm
index d3f48a4e3c..e4cff61eb9 100644
--- a/tp/Texinfo/Convert/Texinfo.pm
+++ b/tp/Texinfo/Convert/Texinfo.pm
@@ -226,7 +226,7 @@ sub _expand_cmd_args_to_texi($;$) {
$result .= $cmd->{'extra'}->{'spaces_before_argument'}
if $cmd->{'extra'} and $cmd->{'extra'}->{'spaces_before_argument'};
}
- $result .= '{'.$cmd->{'type'}.'}' if ($cmdname eq 'value');
+ $result .= '{'.$cmd->{'extra'}->{'flag'}.'}' if ($cmdname eq 'value');
return $result;
}
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 1415dbf3a7..52715be0a6 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -2288,7 +2288,7 @@ sub _set_non_ignored_space_in_index_before_command($)
my $pending_spaces_element = 0;
foreach my $content (@$contents) {
if ($content->{'type'}
- and $content->{'type'} eq 'spaces_before_brace_in_index') {
+ and $content->{'type'} eq 'internal_spaces_before_brace_in_index') {
# set to "spaces_at_end" in case there are only spaces after
$content->{'type'} = 'spaces_at_end';
$pending_spaces_element = $content;
@@ -3436,7 +3436,7 @@ sub _end_line($$$)
$current->{'type'} = 'index_entry_command';
}
# if there is a brace command interrupting an index or subentry
- # command, replace the internal spaces_before_brace_in_index
+ # command, replace the internal internal_spaces_before_brace_in_index
# text type with its final type depending on whether there is
# text after the brace command.
if (_is_index_element($self, $current)) {
@@ -4434,9 +4434,9 @@ sub _process_remaining_on_line($$$$)
if (not exists($self->{'values'}->{$value})) {
_abort_empty_line($self, $current);
# caller should expand something along
- # gdt('@{No value for `{value}\'@}', {'value' => $value},
{'keep_texi'=> 1});
+ # gdt('@{No value for `{value}\'@}', {'value' => $value});
push @{$current->{'contents'}}, { 'cmdname' => $command,
- 'type' => $value,
+ 'extra' => {'flag' => $value},
'contents' => [],
'parent' => $current };
$self->_line_warn(
@@ -4519,7 +4519,7 @@ sub _process_remaining_on_line($$$$)
# a normal space without type if followed by text or a
# "spaces_at_end" if followed by spaces only when the
# index or subentry command is done.
- my $space_type = 'spaces_before_brace_in_index';
+ my $space_type = 'internal_spaces_before_brace_in_index';
if ($command eq 'subentry') {
$space_type = 'spaces_at_end';
}
@@ -6896,10 +6896,7 @@ See L</Information available in the extra key>.
Some types can be associated with @-commands (in addition to the element
being described by C<cmdname>), although usually there will be no type
-at all. For a C<@value> command that is not expanded because there is
-no corresponding value set, the type is the value argument string.
-
-The following are the other possible values of C<type> for tree elements
+at all. The following are the possible values of C<type> for tree elements
for @-commands.
=over
@@ -7004,13 +7001,13 @@ the I<text> key.
=item raw
Text in an environment where it should be kept as is (in C<@verbatim>,
-C<@verb>, C<@html>, C<@macro> body).
+C<@verb>, C<@macro> body).
=item spaces_at_end
-Space at the end of an argument to a line command, within an index @-command
-before an @-command interrupting the index command, or at the end of
-bracketed content on a C<@multitable> line or definition line.
+Space within an index @-command before an @-command interrupting the
+index command, or at the end of line and end of bracketed content
+on a definition line.
=item text_before_beginning
@@ -7294,12 +7291,13 @@ with each argument element.
=item spaces_before_argument
-A reference to spaces following some @-commands and bracketed content type
-with opening brace, line commands and block command lines taking Texinfo
-as argument and comma delimited arguments. For context brace commands,
-line commands and block commands, I<spaces_before_argument> is associated with
-the @-command element, for other brace commands and for spaces after comma,
-it is associated with each argument element.
+A reference to spaces following the opening brace of some @-commands with
braces
+and bracketed content type, spaces following @-commands for line commands and
+block command taking Texinfo as argument, and spaces following comma delimited
+arguments. For context brace commands, line commands and block commands,
+I<spaces_before_argument> is associated with the @-command element, for other
+brace commands and for spaces after comma, it is associated with each argument
+element.
=item text_arg
@@ -7525,6 +7523,12 @@ The part preceding the command is in I<associated_part>.
If the level of the document was modified by C<@raisections>
or C<@lowersections>, the differential level is in I<sections_level>.
+=item C<@value>
+
+The value argument string is in I<flag>. Only for a C<@value> command
+that is not expanded because there is no corresponding value set, as
+only those are present in the tree.
+
=item C<@verb>
The delimiter is in I<delimiter>.
diff --git a/tp/Texinfo/XS/parsetexi/api.c b/tp/Texinfo/XS/parsetexi/api.c
index be1c46284c..d3779ad86f 100644
--- a/tp/Texinfo/XS/parsetexi/api.c
+++ b/tp/Texinfo/XS/parsetexi/api.c
@@ -425,10 +425,7 @@ element_to_perl_hash (ELEMENT *e)
if (e->text.space > 0)
{
sv = newSVpv_utf8 (e->text.text, e->text.end);
- if (e->cmd != CM_value)
- hv_store (e->hv, "text", strlen ("text"), sv, 0);
- else
- hv_store (e->hv, "type", strlen ("type"), sv, 0);
+ hv_store (e->hv, "text", strlen ("text"), sv, 0);
}
if (e->extra_number > 0)
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index a26a01bcc6..a515c70ad2 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -571,14 +571,9 @@ merge_text (ELEMENT *current, char *text)
and not defined at all. The latter is true for 'brace_command_arg'
elements. We need either to make sure that we initialize all elements
with text_append (&e->text, "") where we want merging with following
- text, or treat as a special case here.
- Unfortunately we can't make a special case for
- ET_internal_spaces_before_argument, because abort_empty_line above
- produces such an element that shouldn't be merged with. */
+ text, or treat as a special case here. */
&& (last_child->text.space > 0
- && !strchr (last_child->text.text, '\n')
- ) /* || last_child->type == ET_internal_spaces_before_argument) */
- && last_child->cmd != CM_value
+ && !strchr (last_child->text.text, '\n'))
&& !no_merge_with_following_text)
{
/* Append text to contents */
@@ -1696,12 +1691,7 @@ value_valid:
abort_empty_line (¤t, NULL);
value_elt = new_element (ET_NONE);
value_elt->cmd = CM_value;
- text_append (&value_elt->text, flag);
-
- /* In the Perl code, the name of the flag is stored in
- the "type" field. We need to store in 'text' instead
- and then output it as the type in
- dump_perl.c / api.c. */
+ add_extra_string_dup (value_elt, "flag", flag);
add_to_element_contents (current, value_elt);
diff --git a/tp/t/results/converters_tests/at_commands_in_raw.pl
b/tp/t/results/converters_tests/at_commands_in_raw.pl
index 700840938c..fbed933f53 100644
--- a/tp/t/results/converters_tests/at_commands_in_raw.pl
+++ b/tp/t/results/converters_tests/at_commands_in_raw.pl
@@ -491,8 +491,10 @@ $result_trees{'at_commands_in_raw'} = {
{
'cmdname' => 'value',
'contents' => [],
- 'parent' => {},
- 'type' => 'flag'
+ 'extra' => {
+ 'flag' => 'flag'
+ },
+ 'parent' => {}
},
{
'contents' => [
diff --git a/tp/t/results/converters_tests/unknown_value.pl
b/tp/t/results/converters_tests/unknown_value.pl
index b634ac790a..6884517fd2 100644
--- a/tp/t/results/converters_tests/unknown_value.pl
+++ b/tp/t/results/converters_tests/unknown_value.pl
@@ -12,8 +12,10 @@ $result_trees{'unknown_value'} = {
{
'cmdname' => 'value',
'contents' => [],
- 'parent' => {},
- 'type' => 'unknown'
+ 'extra' => {
+ 'flag' => 'unknown'
+ },
+ 'parent' => {}
}
],
'parent' => {},
diff --git a/tp/t/results/formats_encodings/manual_simple_latin1_with_error.pl
b/tp/t/results/formats_encodings/manual_simple_latin1_with_error.pl
index 1e68a66ec2..0077f078cc 100644
--- a/tp/t/results/formats_encodings/manual_simple_latin1_with_error.pl
+++ b/tp/t/results/formats_encodings/manual_simple_latin1_with_error.pl
@@ -268,8 +268,10 @@ $result_trees{'manual_simple_latin1_with_error'} = {
{
'cmdname' => 'value',
'contents' => [],
- 'parent' => {},
- 'type' => "non_conn\x{f9}e"
+ 'extra' => {
+ 'flag' => "non_conn\x{f9}e"
+ },
+ 'parent' => {}
},
{
'parent' => {},
diff --git a/tp/t/results/formats_encodings/manual_simple_utf8_with_error.pl
b/tp/t/results/formats_encodings/manual_simple_utf8_with_error.pl
index ffe7420065..c7e821e8ab 100644
--- a/tp/t/results/formats_encodings/manual_simple_utf8_with_error.pl
+++ b/tp/t/results/formats_encodings/manual_simple_utf8_with_error.pl
@@ -230,8 +230,10 @@ $result_trees{'manual_simple_utf8_with_error'} = {
{
'cmdname' => 'value',
'contents' => [],
- 'parent' => {},
- 'type' => "non_conn\x{f9}e"
+ 'extra' => {
+ 'flag' => "non_conn\x{f9}e"
+ },
+ 'parent' => {}
},
{
'parent' => {},
diff --git a/tp/t/results/value/bad_syntax.pl b/tp/t/results/value/bad_syntax.pl
index 48d5f25812..f241f228c0 100644
--- a/tp/t/results/value/bad_syntax.pl
+++ b/tp/t/results/value/bad_syntax.pl
@@ -119,8 +119,10 @@ $result_trees{'bad_syntax'} = {
{
'cmdname' => 'value',
'contents' => [],
- 'parent' => {},
- 'type' => 'unknown'
+ 'extra' => {
+ 'flag' => 'unknown'
+ },
+ 'parent' => {}
},
{
'parent' => {},
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: Put non expanded @value flag name in extra flag,
Patrice Dumas <=