texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c (end_line_de


From: Gavin D. Smith
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line): Match pure Perl code better by looking up "def_command" extra value.
Date: Sat, 18 Feb 2023 06:13:53 -0500

This is an automated email from the git hooks/post-receive script.

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new f31e714d2c * tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line): 
Match pure Perl code better by looking up "def_command" extra value.
f31e714d2c is described below

commit f31e714d2c55a4c3a60786dd165a81c17fb98651
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sat Feb 18 11:13:44 2023 +0000

    * tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line):
    Match pure Perl code better by looking up "def_command" extra
    value.
---
 ChangeLog                          |  8 +++++++-
 tp/Texinfo/XS/parsetexi/end_line.c | 32 ++++++++------------------------
 2 files changed, 15 insertions(+), 25 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 55aa7522a0..d57c538c8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2023-02-18  Gavin Smith <gavinsmith0123@gmail.com>
+
+       * tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line):
+       Match pure Perl code better by looking up "def_command" extra
+       value.
+
 2023-02-18  Gavin Smith <gavinsmith0123@gmail.com>
 
        @defblock, @defline in XS parser
@@ -6,7 +12,7 @@
        Call gather_def_item for @defblock.
        * tp/Texinfo/XS/parsetexi/handle_commands.c (handle_line_command):
        Handle @defline.  Allow @defline and @deflinex in @defblock.
-       * tp/Texinfo/XS/parsetexi/end_line.c (_end_line_def_line):
+       * tp/Texinfo/XS/parsetexi/end_line.c (end_line_def_line):
        No index entry for @defline.
 
 2023-02-18  Gavin Smith <gavinsmith0123@gmail.com>
diff --git a/tp/Texinfo/XS/parsetexi/end_line.c 
b/tp/Texinfo/XS/parsetexi/end_line.c
index 377159d5b2..c99e6c09c1 100644
--- a/tp/Texinfo/XS/parsetexi/end_line.c
+++ b/tp/Texinfo/XS/parsetexi/end_line.c
@@ -2090,7 +2090,7 @@ end_line_misc_line (ELEMENT *current)
 ELEMENT *
 end_line_def_line (ELEMENT *current)
 {
-  enum command_id def_command, original_def_command;
+  enum command_id def_command;
   DEF_INFO *def_info = 0;
   static DEF_INFO zero_def_info; /* always stays zeroed */
   KEY_PAIR *k;
@@ -2098,22 +2098,8 @@ end_line_def_line (ELEMENT *current)
   if (pop_context () != ct_def)
     fatal ("def context expected");
 
-  k = lookup_extra (current->parent, "original_def_cmdname");
-  if (k)
-    original_def_command = lookup_command ((char *) k->value);
-  else
-    original_def_command = current->parent->parent->cmd;
-
-  def_command = original_def_command;
-  /* Strip an trailing x from the command, e.g. @deffnx -> @deffn */
-  if (command_data(def_command).flags & CF_line
-      && def_command != CM_defline)
-    {
-      char *stripped = strdup (command_name(def_command));
-      stripped[strlen (stripped) - 1] = '\0';
-      def_command = lookup_command (stripped);
-      free (stripped);
-    }
+  k = lookup_extra (current->parent, "def_command");
+  def_command = lookup_command ((char *) k->value);
 
   def_info = parse_def (def_command, current);
 
@@ -2123,8 +2109,8 @@ end_line_def_line (ELEMENT *current)
   if (!memcmp(def_info, &zero_def_info, sizeof (DEF_INFO)))
     {
       free (def_info);
-      command_warn (current, "missing category for @%s",
-                    command_name (original_def_command));
+      k = lookup_extra (current, "original_def_cmdname");
+      command_warn (current, "missing category for @%s", (char *) k->value);
     }
   else
     {
@@ -2171,15 +2157,13 @@ end_line_def_line (ELEMENT *current)
                                  index_entry);
             }
 
-          if (def_command != CM_defline && def_command != CM_defblock)
+          if (def_command != CM_defline)
             enter_index_entry (def_command, current);
-          /* TODO: match Perl parser closer where def_command is set
-             differently.  */
         }
       else
         {
-          command_warn (current, "missing name for @%s",
-                        command_name (original_def_command));
+          k = lookup_extra (current, "original_def_cmdname");
+          command_warn (current, "missing name for @%s", (char *) k->value);
         }
     }
 



reply via email to

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