texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/ParserNonXS.pm: do not reset simple_


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm: do not reset simple_text_commands and plain_text_commands to full_text_commands.
Date: Mon, 14 Nov 2022 05:45:51 -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 3a78fa07a5 * tp/Texinfo/ParserNonXS.pm: do not reset 
simple_text_commands and plain_text_commands to full_text_commands.
3a78fa07a5 is described below

commit 3a78fa07a5376f96b270b3009d560f02f23b920e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Mon Nov 14 11:45:43 2022 +0100

    * tp/Texinfo/ParserNonXS.pm: do not reset simple_text_commands and
    plain_text_commands to full_text_commands.
    
    Add a check (not enabled) that all the commands that should have
    nesting checks do.
---
 ChangeLog                   |  8 ++++++++
 tp/Texinfo/ParserNonXS.pm   | 48 +++++++++++++++++++++++++++++++++++++++++++++
 tp/Texinfo/command_data.txt |  2 +-
 3 files changed, 57 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 94295a8c06..7ce6d37329 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2022-11-14  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm: do not reset simple_text_commands and
+       plain_text_commands to full_text_commands.
+
+       Add a check (not enabled) that all the commands that should have
+       nesting checks do.
+
 2022-11-14  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Commands.pod, tp/Texinfo/Common.pm,
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 2c04504881..055c0c6094 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -468,6 +468,8 @@ my %simple_text_with_refs_commands = 
(%sectioning_heading_commands,
 # commands that accept full text, but no block or top-level commands
 my %full_text_commands;
 foreach my $brace_command (keys (%brace_commands)) {
+  next if (exists($simple_text_commands{$brace_command})
+           or exists($plain_text_commands{$brace_command}));
   if ($brace_commands{$brace_command} eq 'style_code'
       or $brace_commands{$brace_command} eq 'style_other'
       or $brace_commands{$brace_command} eq 'style_no_code') {
@@ -542,6 +544,52 @@ foreach my $index (keys(%index_names)) {
   }
 }
 
+if (0) {
+  # check that all the commands either are in %default_valid_nestings,
+  # do not have arguments at all, have special parsing of their arguments
+  # or accept any command
+  my %all_commands_nesting_check = %Texinfo::Common::all_commands;
+  foreach my $command (keys(%default_valid_nestings)) {
+    if (not exists($all_commands_nesting_check{$command})) {
+      die "In \%default_valid_nestings: Not a command $command\n";
+    }
+    delete $all_commands_nesting_check{$command};
+  }
+  # no argument
+  foreach my $command (keys(%Texinfo::Commands::nobrace_commands)) {
+    delete $all_commands_nesting_check{$command};
+  }
+  foreach my $command (keys(%Texinfo::Commands::block_commands)) {
+    # remove block commands without argument, they should have
+    # an error message for any content
+    delete $all_commands_nesting_check{$command}
+      if (not $commands_args_number{$command}
+          and not $variadic_commands{$command});
+  }
+  foreach my $brace_command(keys(%brace_commands)) {
+    delete $all_commands_nesting_check{$brace_command}
+           # no argument
+       if ($brace_commands{$brace_command} eq 'noarg'
+           # @inline* can contain anything in their second argument
+           or $inline_format_commands{$brace_command}
+           or $Texinfo::Commands::inline_conditional_commands{$brace_command});
+  }
+  foreach my $command (keys(%line_commands)) {
+    delete $all_commands_nesting_check{$command}
+       # special formatting, commands on line are not parsed as usual
+       if ($line_commands{$command} eq 'skipline'
+           or $line_commands{$command} eq 'special'
+           or $line_commands{$command} eq 'lineraw');
+  }
+  # U, value and verb have special checks of argument.
+  # caption and footnotes can contain any command.
+  foreach my $command ('U', 'value', 'verb', 'caption', 'footnote') {
+    delete $all_commands_nesting_check{$command};
+  }
+
+  print STDERR "".join('|', sort(keys(%all_commands_nesting_check)))."\n";
+}
+
 foreach my $other_forbidden_index_name ('info','ps','pdf','htm',
    'html', 'log','aux','dvi','texi','txi','texinfo','tex','bib') {
   $forbidden_index_name{$other_forbidden_index_name} = 1;
diff --git a/tp/Texinfo/command_data.txt b/tp/Texinfo/command_data.txt
index 43ea81f3eb..9cd5d0c0d0 100644
--- a/tp/Texinfo/command_data.txt
+++ b/tp/Texinfo/command_data.txt
@@ -256,7 +256,7 @@ item_LINE               
line,formatted_line,close_paragraph,contain_simple_text
 itemx                   
line,formatted_line,close_paragraph,contain_simple_text    LINE_line
 # in index entries
 subentry                line,in_index,contain_simple_text           LINE_line
-# not valid for info (should be in @iftex)
+# for printed output.  @vskip 0pt plus 1filll
 vskip                   line,formattable_line                       
LINE_lineraw
 # one numerical/real arg
 need                    
line,formattable_line,close_paragraph,contain_plain_text   LINE_specific  1



reply via email to

[Prev in Thread] Current Thread [Next in Thread]