texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/ParserNonXS.pm


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm, tp/Texinfo/ParserNonXS.pm, tp/maintain/regenerate_commands_perl_info.pl: generate %commands_args_number in regenerate_commands_perl_info.pl, remove from Texinfo::Common.
Date: Sun, 02 Oct 2022 16:25:25 -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 541af513eb * tp/Texinfo/Common.pm, tp/Texinfo/ParserNonXS.pm, 
tp/maintain/regenerate_commands_perl_info.pl: generate %commands_args_number in 
regenerate_commands_perl_info.pl, remove from Texinfo::Common.
541af513eb is described below

commit 541af513eb2c251b8ac6c3e8ceefe7873c281e9e
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sun Oct 2 22:25:14 2022 +0200

    * tp/Texinfo/Common.pm, tp/Texinfo/ParserNonXS.pm,
    tp/maintain/regenerate_commands_perl_info.pl: generate
    %commands_args_number in regenerate_commands_perl_info.pl, remove
    from Texinfo::Common.
---
 ChangeLog                                    |  7 ++++
 tp/Texinfo/Common.pm                         | 49 ----------------------------
 tp/Texinfo/ParserNonXS.pm                    | 10 +++---
 tp/maintain/regenerate_commands_perl_info.pl | 21 ++++++++++++
 4 files changed, 33 insertions(+), 54 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3bd89d9c08..024edaffe5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-10-02  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm, tp/Texinfo/ParserNonXS.pm,
+       tp/maintain/regenerate_commands_perl_info.pl: generate
+       %commands_args_number in regenerate_commands_perl_info.pl, remove
+       from Texinfo::Common.
+
 2022-10-02  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Common.pm, tp/Texinfo/Convert/*.pm,
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 630bce6c25..213c8f0bf1 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -497,15 +497,6 @@ our %nobrace_symbol_text;
            '\\', '\\',  # should only appear in math
 );
 
-# @-commands max number of arguments.  Not set for all commands,
-# in general it only matters if > 1, as commands with 0 args
-# are in specific categories, and default handling of commands
-# ignore commas as argument delimiter, which corresponds to commands
-# with 1 argument.  Only used in Parser.
-our %commands_args_number;
-
-$commands_args_number{'node'} = 4;
-
 # only valid in index entries
 our %in_index_commands;
 foreach my $in_index_command ('sortas', 'seeentry', 'seealso', 'subentry') {
@@ -529,11 +520,6 @@ foreach my $command ('code', 'command', 'env', 'file', 
'indicateurl', 'kbd',
 # brace style command that are not style code commands
 $brace_code_commands{'verb'} = 1;
 
-foreach my $one_arg_command ('U', 'hyphenation',
-    'anchor', 'errormsg', 'sortas', 'seeentry', 'seealso') {
-  $commands_args_number{$one_arg_command} = 1;
-}
-
 # Commands that enclose full texts not in the main document context.
 # They can contain multiple paragraphs.
 our %context_brace_commands;
@@ -551,42 +537,21 @@ foreach my $math_brace_command ('math') {
 our %explained_commands;
 foreach my $explained_command ('abbr', 'acronym') {
   $explained_commands{$explained_command} = 1;
-  $commands_args_number{$explained_command} = 2;
 }
 
 our %inline_format_commands;
 foreach my $inline_format_command ('inlineraw', 'inlinefmt',
         'inlinefmtifelse') {
   $inline_format_commands{$inline_format_command} = 1;
-  $commands_args_number{$inline_format_command} = 2;
 }
 
-$commands_args_number{'inlinefmtifelse'} = 3;
-
 our %inline_conditional_commands;
 foreach my $inline_conditional_command ('inlineifclear', 'inlineifset') {
   $inline_conditional_commands{$inline_conditional_command} = 1;
-  $commands_args_number{$inline_conditional_command} = 2;
-}
-
-foreach my $two_arg_command('email') {
-  $commands_args_number{$two_arg_command} = 2;
-}
-
-foreach my $three_arg_command('uref','url','inforef') {
-  $commands_args_number{$three_arg_command} = 3;
-}
-
-foreach my $five_arg_command('xref','ref','pxref','image') {
-  $commands_args_number{$five_arg_command} = 5;
 }
 
 
 # some classification to help converters
-our %ref_commands;
-foreach my $ref_command ('xref','ref','pxref','inforef') {
-  $ref_commands{$ref_command} = 1;
-}
 
 # brace command that is not replaced with text.
 my %unformatted_brace_commands;
@@ -650,20 +615,6 @@ foreach my $output_format_command ('info', 'plaintext') {
   $texinfo_output_formats{$output_format_command} = $output_format_command;
 }
 
-foreach my $item_container_command ('itemize', 'enumerate') {
-  $commands_args_number{$item_container_command} = 1;
-}
-
-foreach my $item_line_command ('table', 'ftable', 'vtable') {
-  $commands_args_number{$item_line_command} = 1;
-}
-
-foreach my $block_command_one_arg('quotation', 'smallquotation') {
-  $commands_args_number{$block_command_one_arg} = 1;
-}
-
-$commands_args_number{'float'} = 2;
-
 # commands that forces closing an opened paragraph.
 our %close_paragraph_commands;
 
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index f1ca5c25b9..06d1104a4c 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -266,7 +266,7 @@ my %initialization_overrides = (
 my %nobrace_commands          = %Texinfo::Commands::nobrace_commands;
 my %line_commands             = %Texinfo::Commands::line_commands;
 my %brace_commands            = %Texinfo::Commands::brace_commands;
-my %commands_args_number      = %Texinfo::Common::commands_args_number;
+my %commands_args_number      = %Texinfo::Commands::commands_args_number;
 my %accent_commands           = %Texinfo::Commands::accent_commands;
 my %context_brace_commands    = %Texinfo::Common::context_brace_commands;
 my %contain_plain_text_commands = 
%Texinfo::Commands::contain_plain_text_commands;
@@ -275,8 +275,6 @@ my %block_commands            = 
%Texinfo::Commands::block_commands;
 my %blockitem_commands        = %Texinfo::Commands::blockitem_commands;
 my %close_paragraph_commands  = %Texinfo::Common::close_paragraph_commands;
 my %def_commands              = %Texinfo::Commands::def_commands;
-my %def_map                   = %Texinfo::Common::def_map;
-my %def_aliases               = %Texinfo::Common::def_aliases;
 my %def_alias_commands        = %Texinfo::Commands::def_alias_commands;
 my %preformatted_commands     = %Texinfo::Commands::preformatted_commands;
 my %math_commands             = %Texinfo::Commands::math_commands;
@@ -286,12 +284,14 @@ my %sectioning_heading_commands     = 
%Texinfo::Commands::sectioning_heading_com
 my %ref_commands              = %Texinfo::Commands::ref_commands;
 my %heading_spec_commands     = %Texinfo::Commands::heading_spec_commands;
 my %in_heading_spec_commands  = %Texinfo::Commands::in_heading_spec_commands;
+my %variadic_commands         = %Texinfo::Commands::variadic_commands;
+my %default_index_commands    = %Texinfo::Commands::default_index_commands;
+my %def_map                   = %Texinfo::Common::def_map;
+my %def_aliases               = %Texinfo::Common::def_aliases;
 my %in_index_commands         = %Texinfo::Common::in_index_commands;
 my %explained_commands        = %Texinfo::Common::explained_commands;
 my %inline_format_commands    = %Texinfo::Common::inline_format_commands;
-my %variadic_commands         = %Texinfo::Commands::variadic_commands;
 my %all_commands              = %Texinfo::Common::all_commands;
-my %default_index_commands    = %Texinfo::Commands::default_index_commands;
 
 
 # Keys are commmands, values are names of indices.  User-defined
diff --git a/tp/maintain/regenerate_commands_perl_info.pl 
b/tp/maintain/regenerate_commands_perl_info.pl
index fc0e696bc2..daf2286ddd 100755
--- a/tp/maintain/regenerate_commands_perl_info.pl
+++ b/tp/maintain/regenerate_commands_perl_info.pl
@@ -38,6 +38,7 @@ my %index_in_code = (
 
 my %command_categories;
 my %flags_hashes;
+my %command_args_nr;
 
 while (<>) {
   if (not (/^#/ or /^ *$/)) {
@@ -73,9 +74,15 @@ while (<>) {
     # remove _LINE in item_LINE
     my $uc_category = uc($category);
     $command =~ s/_$uc_category$//;
+
+    if (defined($args_nr) and $args_nr ne '') {
+      $command_args_nr{$command} = $args_nr;
+    }
+
     $command_categories{$category}->{$type} = []
         if not ($command_categories{$category}->{$type});
     push @{$command_categories{$category}->{$type}}, $command;
+
     # gives the same result as {$_ ne $category} as the
     # command with multiple categories, txiinternalvalue appears
     # at the very beginning of the file
@@ -115,6 +122,20 @@ foreach my $hash_flag (sort(keys(%flags_hashes))) {
   print OUT ");\n\n";
 }
 
+print OUT "\n";
+print OUT '# @-commands max number of arguments.  Not set for all commands,
+# in general it only matters if > 1, as commands with 0 args
+# are in specific categories, and default handling of commands
+# ignore commas as argument delimiter, which corresponds to commands
+# with 1 argument.  Only used in Parser.
+our %commands_args_number = (
+';
+foreach my $args_command (sort(keys(%command_args_nr))) {
+  my $args_nr = $command_args_nr{$args_command};
+  print OUT '  '.sprintf('%-25s', '"'.$args_command.'"')." => $args_nr,\n";
+}
+print OUT ");\n\n";
+
 print OUT "\n";
 print OUT "# indices\n";
 print OUT "our %index_names = (\n";



reply via email to

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