texinfo-commits
[Top][All Lists]
Advanced

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

[8420] valid nesting for @sortas


From: gavinsmith0123
Subject: [8420] valid nesting for @sortas
Date: Sat, 27 Oct 2018 05:59:18 -0400 (EDT)

Revision: 8420
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8420
Author:   gavin
Date:     2018-10-27 05:59:18 -0400 (Sat, 27 Oct 2018)
Log Message:
-----------
valid nesting for @sortas

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Common.pm
    trunk/tp/Texinfo/Parser.pm
    trunk/tp/t/results/indices/explicit_sort_key.pl

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2018-10-27 09:05:35 UTC (rev 8419)
+++ trunk/ChangeLog     2018-10-27 09:59:18 UTC (rev 8420)
@@ -1,5 +1,17 @@
 2018-10-27  Gavin Smith  <address@hidden>
 
+       * tp/Texinfo/Common.pm (%in_index_commands): New hash, 
+       containing only 'sortas'.
+       * tp/Texinfo/Parser.pm (%in_full_text_commands): Do not 
+       specially remove 'sortas'.
+       (_setup_parser, _parse_command_line_args): Use 
+       %in_simple_text_commands for the commands that may appear in 
+       index commands.  This was done until 2017-04-01.
+       (_parse_texi) <brace commands>: Move check for valid nesting of 
+       @sortas here.  Change error message to mention index entry.
+
+2018-10-27  Gavin Smith  <address@hidden>
+
        * tp/Texinfo/Parser.pm (_parse_texi) <in heading commands>:
        Do not set an 'invalid_nesting' value.
 

Modified: trunk/tp/Texinfo/Common.pm
===================================================================
--- trunk/tp/Texinfo/Common.pm  2018-10-27 09:05:35 UTC (rev 8419)
+++ trunk/tp/Texinfo/Common.pm  2018-10-27 09:59:18 UTC (rev 8420)
@@ -526,6 +526,14 @@
   $other_commands{$in_heading_command} = 'noarg';
 }
 
+
+# only valid in index entries
+our %in_index_commands;
+foreach my $in_index_command ('sortas') {
+  $in_index_commands{$in_index_command} = 1;
+}
+
+
 our %index_names = (
  'cp' => {'in_code' => 0},
  'fn' => {'in_code' => 1},

Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm  2018-10-27 09:05:35 UTC (rev 8419)
+++ trunk/tp/Texinfo/Parser.pm  2018-10-27 09:59:18 UTC (rev 8420)
@@ -237,6 +237,7 @@
 my %region_commands           = %Texinfo::Common::region_commands;
 my %code_style_commands       = %Texinfo::Common::code_style_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;
 my %inline_format_commands    = %Texinfo::Common::inline_format_commands;
 my %inline_commands           = %Texinfo::Common::inline_commands;
@@ -380,7 +381,6 @@
 }
 delete $in_full_text_commands{'caption'};
 delete $in_full_text_commands{'shortcaption'};
-delete $in_full_text_commands{'sortas'};
 foreach my $block_command (keys(%block_commands)) {
   $in_full_text_commands{$block_command} = 1 
     if ($block_commands{$block_command} eq 'conditional');
@@ -400,12 +400,6 @@
   delete $in_simple_text_commands{$not_in_simple_text_command};
 }
 
-# commands that may occur in index entries
-my %in_index_commands = %in_simple_text_commands;
-foreach my $in_index_command ('sortas') {
-  $in_index_commands{$in_index_command} = 1;
-}
-
 # commands that only accept simple text as argument in any context.
 my %simple_text_commands;
 foreach my $line_command(keys(%line_commands)) {
@@ -458,7 +452,7 @@
 # There are additional context tests, to make sure, for instance that we are 
 # testing @-commands on the block, line or node @-command line and not
 # in the content.
-# Index entry commands are dynamically set as %in_index_commands
+# Index entry commands are dynamically set as %in_simple_text_commands
 my %default_valid_nestings;
 
 foreach my $command (keys(%accent_commands)) {
@@ -633,7 +627,7 @@
     foreach my $prefix ($index, substr($index, 0, 1)) {
       $parser->{'line_commands'}->{$prefix.'index'} = 'line';
       $parser->{'no_paragraph_commands'}->{$prefix.'index'} = 1;
-      $parser->{'valid_nestings'}->{$prefix.'index'} = \%in_index_commands;
+      $parser->{'valid_nestings'}->{$prefix.'index'} = 
\%in_simple_text_commands;
       $parser->{'command_index'}->{$prefix.'index'} = $index;
     }
   }
@@ -4682,7 +4676,6 @@
             $line = _start_empty_line_after_command($line, $current, $block);
           }
         } elsif (defined($brace_commands{$command})) {
-          
           push @{$current->{'contents'}}, { 'cmdname' => $command, 
                                             'parent' => $current,
                                             'contents' => [] };
@@ -4689,6 +4682,16 @@
           $current->{'contents'}->[-1]->{'line_nr'} = $line_nr
             if ($keep_line_nr_brace_commands{$command}
                 and !$self->{'definfoenclose'}->{$command});
+
+          if ($in_index_commands{$command}
+              and $current->{'parent'}->{'cmdname'}
+              and !$self->{'command_index'}
+                        ->{$current->{'parent'}->{'cmdname'}}) {
+            $self->line_warn(
+              sprintf(__("address@hidden should only appear in an index 
entry"),
+                      $command), $line_nr);
+          }
+          
           $current = $current->{'contents'}->[-1];
           if ($command eq 'click') {
             $current->{'extra'}->{'clickstyle'} = $self->{'clickstyle'};
@@ -5491,7 +5494,7 @@
         }
         $self->{'line_commands'}->{$name.'index'} = 'line';
         $self->{'no_paragraph_commands'}->{$name.'index'} = 1;
-        $self->{'valid_nestings'}->{$name.'index'} = \%in_index_commands;
+        $self->{'valid_nestings'}->{$name.'index'} = \%in_simple_text_commands;
         $self->{'command_index'}->{$name.'index'} = $name;
       }
     } else {

Modified: trunk/tp/t/results/indices/explicit_sort_key.pl
===================================================================
(Binary files differ)




reply via email to

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