texinfo-commits
[Top][All Lists]
Advanced

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

[8314] definfoenclose commands add to %brace_commands


From: gavinsmith0123
Subject: [8314] definfoenclose commands add to %brace_commands
Date: Wed, 17 Oct 2018 10:22:35 -0400 (EDT)

Revision: 8314
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8314
Author:   gavin
Date:     2018-10-17 10:22:34 -0400 (Wed, 17 Oct 2018)
Log Message:
-----------
definfoenclose commands add to %brace_commands

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tp/Texinfo/Parser.pm

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2018-10-17 13:11:07 UTC (rev 8313)
+++ trunk/ChangeLog     2018-10-17 14:22:34 UTC (rev 8314)
@@ -1,5 +1,12 @@
 2018-10-17  Gavin Smith  <address@hidden>
 
+       * tp/Texinfo/Parser.pm (_parse_line_command_args) <@definfoenclose>:
+       Add new command to %brace_commands.  This avoids having to check
+       whether a command has been added with @definfoenclose in several 
+       places.
+
+2018-10-17  Gavin Smith  <address@hidden>
+
        * tp/t/09indices.t (def_existing_index): New test.
 
 2018-10-17  Gavin Smith  <address@hidden>

Modified: trunk/tp/Texinfo/Parser.pm
===================================================================
--- trunk/tp/Texinfo/Parser.pm  2018-10-17 13:11:07 UTC (rev 8313)
+++ trunk/tp/Texinfo/Parser.pm  2018-10-17 14:22:34 UTC (rev 8314)
@@ -2823,8 +2823,7 @@
           $self->_command_error($current, $line_nr, 
               __("%s requires an argument: the formatter for %citem"),
               $current->{'cmdname'}, ord('@'));
-        } elsif 
(!$brace_commands{$current->{'extra'}->{'command_as_argument'}->{'cmdname'}}
-            and 
!$self->{'definfoenclose'}->{$current->{'extra'}->{'command_as_argument'}->{'cmdname'}})
 {
+        } elsif 
(!$brace_commands{$current->{'extra'}->{'command_as_argument'}->{'cmdname'}}) {
           $self->_command_error($current, $line_nr, 
               __("command address@hidden not accepting argument in brace 
should not be on address@hidden line"),
               $current->{'extra'}->{'command_as_argument'}->{'cmdname'},
@@ -3798,10 +3797,9 @@
 
       # The condition below is only caught right after command opening,
       # otherwise we are in the 'args' and not right in the command container.
-      } elsif ($current->{'cmdname'} and 
-          (defined($brace_commands{$current->{'cmdname'}}) or 
-            $self->{'definfoenclose'}->{$current->{'cmdname'}})
-          and !$open_brace) {
+      } elsif ($current->{'cmdname'}
+            and defined($brace_commands{$current->{'cmdname'}})
+            and !$open_brace) {
         # special case for @-command as argument of @itemize or @*table.
         if (_command_with_command_as_argument($current->{'parent'})) {
           print STDERR "FOR PARENT 
address@hidden>{'parent'}->{'parent'}->{'cmdname'} command_as_argument 
$current->{'cmdname'}\n" if ($self->{'DEBUG'});
@@ -4686,8 +4684,7 @@
 
             $line = _start_empty_line_after_command($line, $current, $block);
           }
-        } elsif (defined($brace_commands{$command})
-               or defined($self->{'definfoenclose'}->{$command})) {
+        } elsif (defined($brace_commands{$command})) {
           
           push @{$current->{'contents'}}, { 'cmdname' => $command, 
                                             'parent' => $current,
@@ -4744,16 +4741,12 @@
         } elsif ($separator eq '{') {
           _abort_empty_line($self, $current);
           if ($current->{'cmdname'} 
-               and (defined($brace_commands{$current->{'cmdname'}})
-                     or $self->{'definfoenclose'}->{$current->{'cmdname'}})) {
+               and defined($brace_commands{$current->{'cmdname'}})) {
             my $command = $current->{'cmdname'};
             $current->{'args'} = [ { 'parent' => $current,
                                    'contents' => [] } ];
             $current->{'remaining_args'} = $brace_commands{$command} -1
                   if ($brace_commands{$command} and $brace_commands{$command} 
-1);
-            if ($self->{'definfoenclose'}->{$command}) {
-              $current->{'remaining_args'} = 0;
-            }
             $current = $current->{'args'}->[-1];
             if ($context_brace_commands{$command}) {
               if ($command eq 'caption' or $command eq 'shortcaption') {
@@ -4865,9 +4858,8 @@
            # the following will not happen for footnote if there is 
            # a paragraph withing the footnote
           } elsif ($current->{'parent'}
-                   and $current->{'parent'}->{'cmdname'}
-                   and (exists 
$brace_commands{$current->{'parent'}->{'cmdname'}}
-                         or 
$self->{'definfoenclose'}->{$current->{'parent'}->{'cmdname'}})) {
+              and $current->{'parent'}->{'cmdname'}
+              and exists $brace_commands{$current->{'parent'}->{'cmdname'}}) {
             # for math and footnote out of paragraph
             if ($context_brace_commands{$current->{'parent'}->{'cmdname'}}) {
               my $context_command = pop @{$self->{'context_stack'}};
@@ -5452,6 +5444,8 @@
       $self->{'definfoenclose'}->{$1} = [ $2, $3 ];
       print STDERR "DEFINFOENCLOSE address@hidden: $2, $3\n" if 
($self->{'DEBUG'});
 
+      $brace_commands{$1} = 1;
+
       # Warning: there is a risk of mixing of data between a built-in 
       # command and a user command defined with @definfoenclose.
       # %keep_line_nr_brace_commands is one example of this.




reply via email to

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