[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_starting_b
From: |
Patrice Dumas |
Subject: |
branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block) (_process_remaining_on_line): check if a command name is defined instead of testing if it is true, to catche the case of a command name or alias being '0'. |
Date: |
Sun, 01 Dec 2024 12:57:12 -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 46af704b4c * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block)
(_process_remaining_on_line): check if a command name is defined instead of
testing if it is true, to catche the case of a command name or alias being '0'.
46af704b4c is described below
commit 46af704b4cf65868792c07d450563dd3ba1ab7b2
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Dec 1 18:56:38 2024 +0100
* tp/Texinfo/ParserNonXS.pm (_end_line_starting_block)
(_process_remaining_on_line): check if a command name is defined
instead of testing if it is true, to catche the case of a command name
or alias being '0'.
* tp/Makefile.tres, tp/t/02coverage.t (command_zero), tp/t/58alias.t
(alias_zero), tp/t/60macro.t (macro_name_zero): test unknown command,
alias and macro name be '0'.
---
ChangeLog | 11 +++
tp/Makefile.tres | 3 +
tp/Texinfo/ParserNonXS.pm | 8 +--
tp/t/02coverage.t | 3 +
tp/t/58alias.t | 4 ++
tp/t/60macro.t | 7 ++
tp/t/results/alias/alias_zero.pl | 94 ++++++++++++++++++++++++++
tp/t/results/coverage/command_zero.pl | 69 +++++++++++++++++++
tp/t/results/macro/macro_name_zero.pl | 123 ++++++++++++++++++++++++++++++++++
9 files changed, 318 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f56f236405..9190518f9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-12-01 Patrice Dumas <pertusus@free.fr>
+
+ * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block)
+ (_process_remaining_on_line): check if a command name is defined
+ instead of testing if it is true, to catche the case of a command name
+ or alias being '0'.
+
+ * tp/Makefile.tres, tp/t/02coverage.t (command_zero), tp/t/58alias.t
+ (alias_zero), tp/t/60macro.t (macro_name_zero): test unknown command,
+ alias and macro name be '0'.
+
2024-12-01 Patrice Dumas <pertusus@free.fr>
* tp/Texinfo/XS/configure.ac: add a comment explaining that the issue
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 4961762ee3..6df54c8c00 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -78,6 +78,7 @@ test_files_generated_list = $(test_tap_files_generated_list) \
t/results/alias/alias_of_macro.pl \
t/results/alias/alias_of_macro_before_macro.pl \
t/results/alias/alias_table_command.pl \
+ t/results/alias/alias_zero.pl \
t/results/alias/bad_line.pl \
t/results/alias/block_command_alias.pl \
t/results/alias/recursive_alias.pl \
@@ -329,6 +330,7 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/coverage/command_in_end_ignored_raw_one_char_not_in_command.pl \
t/results/coverage/command_in_end_ignored_raw_two_char_before_command.pl \
t/results/coverage/command_in_end_ignored_raw_two_char_not_in_command.pl \
+ t/results/coverage/command_zero.pl \
t/results/coverage/commands.pl \
t/results/coverage/commands_in_math.pl \
t/results/coverage/comment_on_cartouche_line.pl \
@@ -1520,6 +1522,7 @@ test_files_generated_list =
$(test_tap_files_generated_list) \
t/results/macro/macro_inlineifcond_end_in_empty_set.pl \
t/results/macro/macro_name_with_digit.pl \
t/results/macro/macro_name_with_hyphen.pl \
+ t/results/macro/macro_name_zero.pl \
t/results/macro/macro_no_arg_bad_expansion.pl \
t/results/macro/macro_no_arg_expansion.pl \
t/results/macro/macro_no_argument.pl \
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 252a4a43ae..2d88322efc 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -4429,7 +4429,7 @@ sub _end_line_starting_block($$$)
exists($all_commands{$name})
or $self->{'macros'}->{$name}
or $self->{'definfoenclose'}->{$name}
- or $self->{'aliases'}->{$name}
+ or exists($self->{'aliases'}->{$name})
or $self->{'index_entry_commands'}->{$name}
);
if (($command_is_defined
@@ -7246,7 +7246,7 @@ sub _process_remaining_on_line($$$$)
}
# handle unknown @-command
- if ($command and !$all_commands{$command}
+ if (defined($command) and !$all_commands{$command}
and !$self->{'definfoenclose'}->{$command}
and !$self->{'index_entry_commands'}->{$command}
# @txiinternalvalue is invalid unless accept_internalvalue is set
@@ -7394,7 +7394,7 @@ sub _process_remaining_on_line($$$$)
$menu_separator)) {
$current = $current_array_for_ref[0];
# Any other @-command.
- } elsif ($command) {
+ } elsif (defined($command)) {
substr($line, 0, $command_length) = '';
print STDERR "COMMAND \@".Texinfo::Common::debug_command_name($command)
@@ -7560,7 +7560,7 @@ sub _process_remaining_on_line($$$$)
= _handle_brace_command($self, $current, $command, $source_info);
}
- if ($from_alias and $command_element) {
+ if (defined($from_alias) and $command_element) {
$command_element->{'info'} = {} if (!$command_element->{'info'});
$command_element->{'info'}->{'alias_of'} = $from_alias;
}
diff --git a/tp/t/02coverage.t b/tp/t/02coverage.t
index ea5cfc48e1..f78bf101ac 100644
--- a/tp/t/02coverage.t
+++ b/tp/t/02coverage.t
@@ -630,6 +630,9 @@ In float with caption.
@errormsg{Text @~e @code{code}}
@errormsg{ with surrounding spaces }
'],
+['command_zero',
+'@0:
+'],
['unknown_accents',
'@"X @"x @"Q @"Y
diff --git a/tp/t/58alias.t b/tp/t/58alias.t
index 0a2a0c59c8..601f0fc577 100644
--- a/tp/t/58alias.t
+++ b/tp/t/58alias.t
@@ -171,6 +171,10 @@ in lang
@new{bb}
'],
+['alias_zero',
+'@alias 0 = strong
+@0{g}.
+']
);
run_all('alias', \@test_cases);
diff --git a/tp/t/60macro.t b/tp/t/60macro.t
index 36fe0ff050..cefa9c7cb7 100644
--- a/tp/t/60macro.t
+++ b/tp/t/60macro.t
@@ -104,6 +104,13 @@ expand \arg\
@macro11 some thing @macro1{}
'],
+['macro_name_zero',
+'@macro 0
+in macro
+@end macro
+
+@0:
+'],
['unpaired_backslash_in_macro_body',
'@macro mymacro {arg}
In macro \not arg
diff --git a/tp/t/results/alias/alias_zero.pl b/tp/t/results/alias/alias_zero.pl
new file mode 100644
index 0000000000..af12f63cbe
--- /dev/null
+++ b/tp/t/results/alias/alias_zero.pl
@@ -0,0 +1,94 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'alias_zero'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => '0 = strong'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'alias',
+ 'extra' => {
+ 'misc_args' => [
+ '0',
+ 'strong'
+ ]
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ },
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'g'
+ }
+ ],
+ 'type' => 'brace_container'
+ }
+ ],
+ 'cmdname' => 'strong',
+ 'info' => {
+ 'alias_of' => '0'
+ },
+ 'source_info' => {
+ 'line_nr' => 2
+ }
+ },
+ {
+ 'text' => '.
+'
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'alias_zero'} = '@alias 0 = strong
+@strong{g}.
+';
+
+
+$result_texts{'alias_zero'} = 'g.
+';
+
+$result_errors{'alias_zero'} = [];
+
+
+$result_floats{'alias_zero'} = {};
+
+
+1;
diff --git a/tp/t/results/coverage/command_zero.pl
b/tp/t/results/coverage/command_zero.pl
new file mode 100644
index 0000000000..d2cf861a5b
--- /dev/null
+++ b/tp/t/results/coverage/command_zero.pl
@@ -0,0 +1,69 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'command_zero'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'text' => ':
+'
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'command_zero'} = ':
+';
+
+
+$result_texts{'command_zero'} = ':
+';
+
+$result_errors{'command_zero'} = [
+ {
+ 'error_line' => 'unknown command `0\'
+',
+ 'line_nr' => 1,
+ 'text' => 'unknown command `0\'',
+ 'type' => 'error'
+ }
+];
+
+
+$result_floats{'command_zero'} = {};
+
+
+
+$result_converted{'plaintext'}->{'command_zero'} = ':
+';
+
+
+$result_converted{'html_text'}->{'command_zero'} = '<p>:
+</p>';
+
+
+$result_converted{'xml'}->{'command_zero'} = '<para>:
+</para>';
+
+
+$result_converted{'latex_text'}->{'command_zero'} = ':
+';
+
+
+$result_converted{'docbook'}->{'command_zero'} = '<para>:
+</para>';
+
+1;
diff --git a/tp/t/results/macro/macro_name_zero.pl
b/tp/t/results/macro/macro_name_zero.pl
new file mode 100644
index 0000000000..ca4735d680
--- /dev/null
+++ b/tp/t/results/macro/macro_name_zero.pl
@@ -0,0 +1,123 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors
+ %result_indices %result_sectioning %result_nodes %result_menus
+ %result_floats %result_converted %result_converted_errors
+ %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'macro_name_zero'} = {
+ 'contents' => [
+ {
+ 'contents' => [
+ {
+ 'args' => [
+ {
+ 'text' => '0',
+ 'type' => 'macro_name'
+ }
+ ],
+ 'cmdname' => 'macro',
+ 'contents' => [
+ {
+ 'text' => 'in macro
+',
+ 'type' => 'raw'
+ },
+ {
+ 'args' => [
+ {
+ 'contents' => [
+ {
+ 'text' => 'macro'
+ }
+ ],
+ 'info' => {
+ 'spaces_after_argument' => {
+ 'text' => '
+'
+ }
+ },
+ 'type' => 'line_arg'
+ }
+ ],
+ 'cmdname' => 'end',
+ 'extra' => {
+ 'text_arg' => 'macro'
+ },
+ 'info' => {
+ 'spaces_before_argument' => {
+ 'text' => ' '
+ }
+ },
+ 'source_info' => {
+ 'line_nr' => 3
+ }
+ }
+ ],
+ 'info' => {
+ 'arg_line' => ' 0
+'
+ },
+ 'source_info' => {
+ 'line_nr' => 1
+ }
+ },
+ {
+ 'text' => '
+',
+ 'type' => 'empty_line'
+ },
+ {
+ 'contents' => [
+ {
+ 'source_marks' => [
+ {
+ 'counter' => 1,
+ 'element' => {
+ 'info' => {
+ 'command_name' => '0'
+ },
+ 'type' => 'macro_call'
+ },
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'start'
+ },
+ {
+ 'counter' => 1,
+ 'position' => 8,
+ 'sourcemark_type' => 'macro_expansion',
+ 'status' => 'end'
+ }
+ ],
+ 'text' => 'in macro:
+'
+ }
+ ],
+ 'type' => 'paragraph'
+ }
+ ],
+ 'type' => 'before_node_section'
+ }
+ ],
+ 'type' => 'document_root'
+};
+
+$result_texis{'macro_name_zero'} = '@macro 0
+in macro
+@end macro
+
+in macro:
+';
+
+
+$result_texts{'macro_name_zero'} = '
+in macro:
+';
+
+$result_errors{'macro_name_zero'} = [];
+
+
+$result_floats{'macro_name_zero'} = {};
+
+
+1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- branch master updated: * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block) (_process_remaining_on_line): check if a command name is defined instead of testing if it is true, to catche the case of a command name or alias being '0'.,
Patrice Dumas <=