texinfo-commits
[Top][All Lists]
Advanced

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

[no subject]


From: Patrice Dumas
Date: Sat, 22 Oct 2022 11:03:14 -0400 (EDT)

branch: master
commit b99f8dddddb4b5077d6722037cbfaa02c68c9a6f
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Oct 22 12:45:29 2022 +0200

    * tp/Texinfo/ParserNonXS.pm, tp/Texinfo/XS/parsetexi/command_data.txt,
    tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting): set @*heading
    heading customization variables as contain_simple_text.  Modify perl
    Parser to handle in_heading_spec_commands similarly as XS parser.
---
 ChangeLog                                |  7 +++++++
 tp/Texinfo/ParserNonXS.pm                | 34 +++++++++++++++-----------------
 tp/Texinfo/XS/parsetexi/command_data.txt | 12 +++++------
 tp/Texinfo/XS/parsetexi/parser.c         |  6 +++---
 4 files changed, 32 insertions(+), 27 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0deaa62992..35faa36bfb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,13 @@
        (reset_parser, set_documentlanguage_override)
        (set_input_file_name_encoding, set_locale_encoding): Add dTHX.
 
+2022-10-22  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm, tp/Texinfo/XS/parsetexi/command_data.txt,
+       tp/Texinfo/XS/parsetexi/parser.c (check_valid_nesting): set @*heading
+       heading customization variables as contain_simple_text.  Modify perl
+       Parser to handle in_heading_spec_commands similarly as XS parser.
+
 2022-10-22  Patrice Dumas  <pertusus@free.fr>
 
        * ext/tex4ht.pm (tex4ht_process): sort formats for processing order
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 203ab6d63d..65383db694 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -455,19 +455,6 @@ foreach my $not_in_simple_text_command('xref', 'ref', 
'pxref', 'inforef') {
   delete $in_simple_text_commands{$not_in_simple_text_command};
 }
 
-my %in_heading_spec_simple_text_commands = (%in_simple_text_commands,
-                                            %in_heading_spec_commands);
-
-# @this* commands should not appear in any line command except for
-# page heading specification commands but can appear in brace @-commands,
-# on heading specification commands lines, such as indicatric @-commands.
-# Therefore they are set here, such that they do not end up in
-# %in_simple_text_with_refs_commands.  Alternatively they could have been
-# put in %in_full_text_commands and then removed as
-# $not_in_simple_text_with_refs_commands.
-foreach my $in_full_text_not_in_simple_text (keys(%in_heading_spec_commands)) {
-  $in_full_text_commands{$in_full_text_not_in_simple_text} = 1;
-}
 
 
 # commands that only accept plain text, ie only accent, symbol and glyph 
commands
@@ -476,8 +463,6 @@ my %plain_text_commands = %contain_plain_text_commands;
 # commands that only accept simple text as argument in any context.
 my %simple_text_commands = %contain_simple_text_commands;
 
-my %simple_text_heading_spec_commands = (%heading_spec_commands);
-
 my %simple_text_with_refs_commands = (%sectioning_heading_commands,
                                       %def_commands);
 
@@ -514,9 +499,6 @@ foreach my $command (keys(%plain_text_commands)) {
 foreach my $command (keys(%simple_text_commands)) {
   $default_valid_nestings{$command} = \%in_simple_text_commands;
 }
-foreach my $command (keys(%simple_text_heading_spec_commands)) {
-  $default_valid_nestings{$command} = \%in_heading_spec_simple_text_commands;
-}
 foreach my $command (keys(%full_text_commands), keys(%full_line_commands)) {
   $default_valid_nestings{$command} = \%in_full_text_commands;
 }
@@ -524,6 +506,22 @@ foreach my $command 
(keys(%simple_text_with_refs_commands)) {
   $default_valid_nestings{$command} = \%in_simple_text_with_refs_commands;
 }
 
+# @this* commands should not appear in any line command except for
+# page heading specification commands and can also appear in brace @-commands,
+# on heading specification commands lines, such as indicatric @-commands.
+foreach my $in_heading_spec (keys(%in_heading_spec_commands)) {
+  foreach my $command (keys(%heading_spec_commands)) {
+    $default_valid_nestings{$command}->{$in_heading_spec} = 1
+  }
+  foreach my $brace_command (keys (%brace_commands)) {
+    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') {
+      $default_valid_nestings{$brace_command}->{$in_heading_spec} = 1;
+    }
+  }
+}
+
 # default indices
 my %index_names = %Texinfo::Commands::index_names;
 
diff --git a/tp/Texinfo/XS/parsetexi/command_data.txt 
b/tp/Texinfo/XS/parsetexi/command_data.txt
index ddc82dbd2e..db884cb5fb 100644
--- a/tp/Texinfo/XS/parsetexi/command_data.txt
+++ b/tp/Texinfo/XS/parsetexi/command_data.txt
@@ -156,12 +156,12 @@ setchapternewpage       
line,global_unique,contain_plain_text    LINE_specific
 # arg on off
 microtype               line,global,contain_plain_text  LINE_specific  1
 
-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
+everyheading            line,global,heading_spec,contain_simple_text      
LINE_line
+everyfooting            line,global,heading_spec,contain_simple_text      
LINE_line
+evenheading             line,global,heading_spec,contain_simple_text      
LINE_line
+evenfooting             line,global,heading_spec,contain_simple_text      
LINE_line
+oddheading              line,global,heading_spec,contain_simple_text      
LINE_line
+oddfooting              line,global,heading_spec,contain_simple_text      
LINE_line
 
 # args are index identifiers
 syncodeindex            line,contain_plain_text         LINE_specific  2
diff --git a/tp/Texinfo/XS/parsetexi/parser.c b/tp/Texinfo/XS/parsetexi/parser.c
index 3f5f27d636..f0c1cf02c1 100644
--- a/tp/Texinfo/XS/parsetexi/parser.c
+++ b/tp/Texinfo/XS/parsetexi/parser.c
@@ -925,9 +925,9 @@ check_valid_nesting (ELEMENT *current, enum command_id cmd)
   // much TODO here.
 
   if (outer_flags & CF_contain_simple_text
-      || (outer_flags & CF_line
-            && outer_flags & CF_heading_spec)
-      || (outer_flags & CF_index_entry_command))
+      /* not in CF_contain_simple_text since index entry flags are not set
+         in command_data.txt, and also index commands are dynamically added */
+      || outer_flags & CF_index_entry_command)
     {
       simple_text_command = 1;
     }



reply via email to

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