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 (%heading_spec_commands),


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Common.pm (%heading_spec_commands), tp/Texinfo/ParserNonXS.pm, tp/Texinfo/XS/parsetexi/command_data.txt, tp/Texinfo/XS/parsetexi/commands.h, tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command), tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting): rename %headings_specification_commands as %heading_spec_commands to match XS Parser. Replace LINE_heading_spec data in XS parser to heading_spec flag, and and add math flag, to match with perl Parser.
Date: Tue, 27 Sep 2022 05:00:02 -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 a33504f934 * tp/Texinfo/Common.pm (%heading_spec_commands), 
tp/Texinfo/ParserNonXS.pm, tp/Texinfo/XS/parsetexi/command_data.txt, 
tp/Texinfo/XS/parsetexi/commands.h, tp/Texinfo/XS/parsetexi/handle_commands.c 
(handle_other_command), tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting): 
rename %headings_specification_commands as %heading_spec_commands to match XS 
Parser.  Replace LINE_heading_spec data in XS parser to heading_spec flag, and 
and add math flag, to match with perl Parser.
a33504f934 is described below

commit a33504f934368c13efd403d4aa380c00730ae9eb
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Sep 27 10:59:52 2022 +0200

    * tp/Texinfo/Common.pm (%heading_spec_commands),
    tp/Texinfo/ParserNonXS.pm, tp/Texinfo/XS/parsetexi/command_data.txt,
    tp/Texinfo/XS/parsetexi/commands.h,
    tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command),
    tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting): rename
    %headings_specification_commands as %heading_spec_commands to match XS
    Parser.  Replace LINE_heading_spec data in XS parser to heading_spec
    flag, and and add math flag, to match with perl Parser.
---
 ChangeLog                                 | 11 +++++++++++
 tp/Texinfo/Common.pm                      | 10 +++++-----
 tp/Texinfo/Convert/LaTeX.pm               |  4 ++--
 tp/Texinfo/ParserNonXS.pm                 |  8 ++++----
 tp/Texinfo/XS/parsetexi/command_data.txt  | 16 ++++++++--------
 tp/Texinfo/XS/parsetexi/commands.h        | 24 ++++++++----------------
 tp/Texinfo/XS/parsetexi/handle_commands.c |  2 +-
 tp/Texinfo/XS/parsetexi/parser.c          | 12 ++++++------
 8 files changed, 45 insertions(+), 42 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f132290d01..6a69447d78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2022-09-27  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Common.pm (%heading_spec_commands),
+       tp/Texinfo/ParserNonXS.pm, tp/Texinfo/XS/parsetexi/command_data.txt,
+       tp/Texinfo/XS/parsetexi/commands.h,
+       tp/Texinfo/XS/parsetexi/handle_commands.c (handle_other_command),
+       tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting): rename
+       %headings_specification_commands as %heading_spec_commands to match XS
+       Parser.  Replace LINE_heading_spec data in XS parser to heading_spec
+       flag, and and add math flag, to match with perl Parser.
+
 2022-09-26  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Common.pm, tp/Texinfo/Convert/DocBook.pm
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index cab0e1f471..f92f40b086 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -636,10 +636,10 @@ foreach my $in_heading_command ('thischapter', 
'thischaptername',
 }
 
 # %in_heading_commands and @| are only valid in the following @-commands
-our %headings_specification_commands;
+our %heading_spec_commands;
 foreach my $headings_specification_command ('everyheading', 'everyfooting',
   'evenheading', 'evenfooting', 'oddheading', 'oddfooting') {
-  $headings_specification_commands{$headings_specification_command} = 1;
+  $heading_spec_commands{$headings_specification_command} = 1;
 
   $line_commands{$headings_specification_command} = 'line';
 }
@@ -3040,8 +3040,8 @@ X<C<%explained_commands>>
 @-commands whose second argument explain first argument and further
 @-command call without first argument, as C<@abbr> and C<@acronym>.
 
-=item %headings_specification_commands
-X<C<%headings_specification_commands>>
+=item %heading_spec_commands
+X<C<%heading_spec_commands>>
 
 @-commands used to specify custom headings, like C<@everyheading>.
 
@@ -3339,7 +3339,7 @@ X<C<split_custom_heading_command_contents>>
 Split the I<$contents> array reference at C<@|> in at max three parts.
 Return an array reference containing the split parts.  The I<$contents>
 array reference is supposed to be C<< $element->{'args'}->[0]->{'contents'} >>
-of C<%headings_specification_commands> commands such as C<@everyheading>.
+of C<%heading_spec_commands> commands such as C<@everyheading>.
 
 =item trim_spaces_comment_from_content($contents)
 X<C<trim_spaces_comment_from_content>>
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index ded0ac7609..eb5cfdd21a 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -233,7 +233,7 @@ my %brace_code_commands       = 
%Texinfo::Common::brace_code_commands;
 my %preformatted_code_commands = %Texinfo::Common::preformatted_code_commands;
 my %default_index_commands = %Texinfo::Common::default_index_commands;
 my %letter_no_arg_commands = %Texinfo::Common::letter_no_arg_commands;
-my %headings_specification_commands = 
%Texinfo::Common::headings_specification_commands;
+my %heading_spec_commands = %Texinfo::Common::heading_spec_commands;
 my %in_heading_commands = %Texinfo::Common::in_heading_commands;
 my %unformatted_brace_command = %Texinfo::Common::unformatted_brace_command;
 
@@ -3447,7 +3447,7 @@ sub _convert($$)
         $result .= '';
       }
       return $result;
-    } elsif ($headings_specification_commands{$cmdname}) {
+    } elsif ($heading_spec_commands{$cmdname}) {
       if ($element->{'args'} and $element->{'args'}->[0]
           and $element->{'args'}->[0]->{'contents'}) {
         my $custom_headings_specification
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 2ebb368398..451e8ee705 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -279,7 +279,7 @@ my %sectioning_heading_commands     = 
%Texinfo::Common::sectioning_heading_comma
 my %command_index             = %Texinfo::Common::command_index;
 my %ref_commands              = %Texinfo::Common::ref_commands;
 my %region_commands           = %Texinfo::Common::region_commands;
-my %headings_specification_commands = 
%Texinfo::Common::headings_specification_commands;
+my %heading_spec_commands     = %Texinfo::Common::heading_spec_commands;
 my %in_heading_commands       = %Texinfo::Common::in_heading_commands;
 my %in_index_commands         = %Texinfo::Common::in_index_commands;
 my %explained_commands        = %Texinfo::Common::explained_commands;
@@ -440,13 +440,13 @@ foreach my $line_command(keys(%line_commands)) {
       or ($line_commands{$line_command} eq 'line'
           and !($sectioning_heading_commands{$line_command}
                 or $def_commands{$line_command}
-                or $headings_specification_commands{$line_command}))
+                or $heading_spec_commands{$line_command}))
       or $line_commands{$line_command} eq 'text') {
     $simple_text_commands{$line_command} = 1;
   }
 }
 
-my %simple_text_headings_commands = (%headings_specification_commands);
+my %simple_text_headings_commands = (%heading_spec_commands);
 
 my %full_line_commands_no_refs = (%sectioning_heading_commands,
                                   %def_commands);
@@ -4546,7 +4546,7 @@ sub _process_remaining_on_line($$$$)
           # in command on context stack
           my $top_context_command = $self->_top_context_command();
           if (not defined($top_context_command)
-              or not $headings_specification_commands{$top_context_command}) {
+              or not $heading_spec_commands{$top_context_command}) {
             $self->_line_error(
               sprintf(__("\@%s should only appear in heading or footing"),
                     $command), $source_info);
diff --git a/tp/Texinfo/XS/parsetexi/command_data.txt 
b/tp/Texinfo/XS/parsetexi/command_data.txt
index f1a41d7503..31c01e2f9a 100644
--- a/tp/Texinfo/XS/parsetexi/command_data.txt
+++ b/tp/Texinfo/XS/parsetexi/command_data.txt
@@ -108,12 +108,12 @@ headings                line,global                     
LINE_specific  1
 setchapternewpage       line,global_unique              LINE_specific  1
 microtype               line,global                     LINE_specific  1
 
-everyheading            line,global                     LINE_heading_spec
-everyfooting            line,global                     LINE_heading_spec
-evenheading             line,global                     LINE_heading_spec
-evenfooting             line,global                     LINE_heading_spec
-oddheading              line,global                     LINE_heading_spec
-oddfooting              line,global                     LINE_heading_spec
+everyheading            line,global,heading_spec        LINE_line
+everyfooting            line,global,heading_spec        LINE_line
+evenheading             line,global,heading_spec        LINE_line
+evenfooting             line,global,heading_spec        LINE_line
+oddheading              line,global,heading_spec        LINE_line
+oddfooting              line,global,heading_spec        LINE_line
 
 syncodeindex            line                            LINE_specific  2
 synindex                line                            LINE_specific  2
@@ -319,7 +319,7 @@ w                       brace                           
BRACE_other
 footnote                brace,global                    BRACE_context
 caption                 brace                           BRACE_context
 shortcaption            brace                           BRACE_context
-math                    brace                           BRACE_context
+math                    brace,math                      BRACE_context
 
 # explained commands
 abbr                    brace                           BRACE_arguments     2
@@ -448,7 +448,7 @@ quotation               block                           
BLOCK_quotation       1
 smallquotation          block                           BLOCK_quotation       1
 
 float                   block                           BLOCK_float           2
-displaymath             block
+displaymath             block,math
 
 ##################################################################
 # Conditional commands
diff --git a/tp/Texinfo/XS/parsetexi/commands.h 
b/tp/Texinfo/XS/parsetexi/commands.h
index f265f2682e..657b26ecb8 100644
--- a/tp/Texinfo/XS/parsetexi/commands.h
+++ b/tp/Texinfo/XS/parsetexi/commands.h
@@ -51,29 +51,27 @@ void wipe_user_commands (void);
 #define CF_line                                0x0001
 #define CF_deprecated                  0x0002
 #define CF_root                                0x0004
-#define CF_sectioning_heading                  0x0008
+#define CF_sectioning_heading          0x0008
 #define CF_brace                       0x0010
-/* CF_letter_no_arg is not used */
+/* CF_letter_no_arg is not used, in Common */
 #define CF_letter_no_arg               0x0020
 #define CF_accent                      0x0040
-/* CF_style is not used */
-#define CF_style                       0x0080
+#define CF_math                                0x0080
 #define CF_variadic                    0x0100
 #define CF_INFOENCLOSE                 0x0200
 #define CF_in_heading                  0x0400
 #define CF_ref                         0x0800
 #define CF_ALIAS                        0x1000
 #define CF_block                       0x2000
-/* CF_raw is not used */
-#define CF_raw                         0x4000
+#define CF_heading_spec                        0x4000
 /* CF_format_raw is not used */
 #define CF_format_raw                  0x8000
-#define CF_global                      0x00010000
+#define CF_global                      0x00010000
 #define CF_def                         0x00020000
 #define CF_def_alias                   0x00040000
 /* CF_menu is not used */
 #define CF_menu                                0x00080000
-/* CF_align is not used */
+/* CF_align is not used, in Common */
 #define CF_align                       0x00100000
 #define CF_other                       0x00200000
 #define CF_preformatted                        0x00400000
@@ -89,15 +87,10 @@ void wipe_user_commands (void);
 #define CF_index_entry_command         0x40000000
 #define CF_global_unique               0x80000000
 
-/* NOTE: We've run out of spaces for flags, but some of these may not
-   be used, or may not be necessary.
-     CF_deprecated is hardly used.
+/* NOTE: We often run out of spaces for flags
 
    Candidates for flags:
-     CF_close_paragraph, CF_heading_spec
-
-   Instead of CF_heading_spec, LINE_heading_spec was used because there
-   are no flags available anymore
+     CF_close_paragraph
 
    Could combine CF_MACRO, CF_ALIAS, and CF_INFOENCLOSE into 2 bits.
  */
@@ -109,7 +102,6 @@ void wipe_user_commands (void);
 #define LINE_specific -4
 #define LINE_text -6
 #define LINE_line -7
-#define LINE_heading_spec -8
 
 /* Types of other command (has CF_other flag). */
 #define OTHER_skipspace -1
diff --git a/tp/Texinfo/XS/parsetexi/handle_commands.c 
b/tp/Texinfo/XS/parsetexi/handle_commands.c
index 803c67d467..ef844a44c7 100644
--- a/tp/Texinfo/XS/parsetexi/handle_commands.c
+++ b/tp/Texinfo/XS/parsetexi/handle_commands.c
@@ -92,7 +92,7 @@ handle_other_command (ELEMENT *current, char **line_inout,
   if (arg_spec == OTHER_noarg)
     {
       if (command_data(cmd).flags & CF_in_heading
-          && command_data(current_context_command()).data != LINE_heading_spec)
+          && !(command_data(current_context_command()).flags & 
CF_heading_spec))
         {
           line_error ("@%s should only appear in heading or footing",
                       command_name(cmd));
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 742e7eac1d..dfcbbea6c0 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -924,7 +924,7 @@ check_valid_nesting (ELEMENT *current, enum command_id cmd)
                 || (command_data(outer).data == LINE_line
                     && !(outer_flags & (CF_def | CF_sectioning_heading)))
                 || command_data(outer).data == LINE_text
-                || command_data(outer).data == LINE_heading_spec)
+                || outer_flags & CF_heading_spec)
             && outer != CM_center
             && outer != CM_exdent)
       || ((outer_flags & CF_brace)
@@ -1005,11 +1005,11 @@ check_valid_nesting (ELEMENT *current, enum command_id 
cmd)
         { /* in heading commands can only appear in headings and style
              brace commands */
           ok = 0;
-          if (command_data(outer).data == LINE_heading_spec
-              || (outer_flags & CF_brace)
-                 && (command_data(outer).data == BRACE_style_other
-                     || command_data(outer).data == BRACE_style_code
-                     || command_data(outer).data == BRACE_style_no_code))
+          if (outer_flags & CF_heading_spec
+              || (outer_flags & CF_brace
+                  && (command_data(outer).data == BRACE_style_other
+                      || command_data(outer).data == BRACE_style_code
+                      || command_data(outer).data == BRACE_style_no_code)))
               ok = 1;
         }
 



reply via email to

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