texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/ParserNonXS.pm (_top_context_command


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_top_context_command) (_parse_texi), tp/Texinfo/Common.pm (%headings_specification_commands): use a list of headings specification @-commands and a new function, _top_context_command() to determine if rightly in a headings specification @-commands when seeing an @-command in %in_heading_commands.
Date: Fri, 20 Aug 2021 18:53:57 -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 d1c6474  * tp/Texinfo/ParserNonXS.pm (_top_context_command) 
(_parse_texi), tp/Texinfo/Common.pm (%headings_specification_commands): use a 
list of headings specification @-commands and a new function, 
_top_context_command() to determine if rightly in a headings specification 
@-commands when seeing an @-command in %in_heading_commands.
d1c6474 is described below

commit d1c6474590e65592924758b4418cc64898471ef7
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Aug 21 00:53:47 2021 +0200

    * tp/Texinfo/ParserNonXS.pm (_top_context_command)
    (_parse_texi),
    tp/Texinfo/Common.pm (%headings_specification_commands):
    use a list of headings specification @-commands and
    a new function, _top_context_command() to determine if
    rightly in a headings specification @-commands when seeing an
    @-command in %in_heading_commands.
---
 ChangeLog                 | 10 ++++++++++
 tp/Texinfo/Common.pm      |  5 +++++
 tp/Texinfo/ParserNonXS.pm | 15 +++++++++++++--
 3 files changed, 28 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 19f2c00..f99e744 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2021-08-21  Patrice Dumas  <pertusus@free.fr>
 
+       * tp/Texinfo/ParserNonXS.pm (_top_context_command)
+       (_parse_texi),
+       tp/Texinfo/Common.pm (%headings_specification_commands):
+       use a list of headings specification @-commands and
+       a new function, _top_context_command() to determine if
+       rightly in a headings specification @-commands when seeing an
+       @-command in %in_heading_commands.
+
+2021-08-21  Patrice Dumas  <pertusus@free.fr>
+
        * tp/Texinfo/ParserNonXS.pm (_init_context_stack)
        (_push_context, _pop_context, _get_context_stack)
        (_top_context): use functions to encapsulate
diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 1bf93a5..73d3911 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -584,6 +584,11 @@ foreach my $in_heading_command ('thischapter', 
'thischaptername',
   $other_commands{$in_heading_command} = 'noarg';
 }
 
+our %headings_specification_commands;
+foreach my $headings_specification_command ('everyheading', 'everyfooting',
+  'evenheading', 'evenfooting', 'oddheading', 'oddfooting') {
+  $headings_specification_commands{$headings_specification_command} = 1;
+}
 
 # only valid in index entries
 our %in_index_commands;
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 95da9f9..7b93a23 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -212,6 +212,7 @@ my %command_index             = 
%Texinfo::Common::command_index;
 my %ref_commands              = %Texinfo::Common::ref_commands;
 my %region_commands           = %Texinfo::Common::region_commands;
 my %code_style_commands       = %Texinfo::Common::code_style_commands;
+my %headings_specification_commands = 
%Texinfo::Common::headings_specification_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;
@@ -521,6 +522,12 @@ sub _top_context($)
   return $self->{'context_stack'}->[-1];
 }
 
+sub _top_context_command($)
+{
+  my $self = shift;
+  return $self->{'context_command_stack'}->[-1];
+}
+
 
 # Format a bug message
 sub _bug_message($$;$$)
@@ -4145,9 +4152,13 @@ sub _parse_texi($;$)
 
           if ($arg_spec eq 'noarg') {
             if ($in_heading_commands{$command}) {
-              $self->line_error(
-                sprintf(__("\@%s should only appear in heading or footing"),
+              # TODO use a more generic system for check of @-command nesting
+              # in command on context stack
+              if (not 
$headings_specification_commands{$self->_top_context_command}) {
+                $self->line_error(
+                  sprintf(__("\@%s should only appear in heading or footing"),
                         $command), $line_nr);
+              }
             }
             $misc = {'cmdname' => $command, 'parent' => $current};
             push @{$current->{'contents'}}, $misc;



reply via email to

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