texinfo-commits
[Top][All Lists]
Advanced

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

[6057] parsetexi don't advance line pointer in big_loop too soon


From: Gavin D. Smith
Subject: [6057] parsetexi don't advance line pointer in big_loop too soon
Date: Thu, 22 Jan 2015 19:02:51 +0000

Revision: 6057
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6057
Author:   gavin
Date:     2015-01-22 19:02:49 +0000 (Thu, 22 Jan 2015)
Log Message:
-----------
parsetexi don't advance line pointer in big_loop too soon

Modified Paths:
--------------
    trunk/parsetexi/ChangeLog
    trunk/parsetexi/menus.c
    trunk/parsetexi/parser.c

Modified: trunk/parsetexi/ChangeLog
===================================================================
--- trunk/parsetexi/ChangeLog   2015-01-21 20:36:09 UTC (rev 6056)
+++ trunk/parsetexi/ChangeLog   2015-01-22 19:02:49 UTC (rev 6057)
@@ -1,3 +1,10 @@
+2015-01-22  Gavin Smith  <address@hidden>
+
+       * parser.c (big_loop) <reading @ command>: Don't advance the 
+       line pointer until we are sure we want to process the command
+       name that was just read (and not, for example, do stuff with
+       menus).
+
 2015-01-21  Gavin Smith  <address@hidden>
 
        * tree_types.h (enum extra_type): New values 'extra_node_spec',

Modified: trunk/parsetexi/menus.c
===================================================================
--- trunk/parsetexi/menus.c     2015-01-21 20:36:09 UTC (rev 6056)
+++ trunk/parsetexi/menus.c     2015-01-22 19:02:49 UTC (rev 6057)
@@ -171,7 +171,8 @@
       destroy_element (pop_element_from_contents (current));
     }
   // 4122
-  /* After a separator in a menu. */
+  /* After a separator in a menu (which would have been added in
+     handle_separator in separator.c). */
   else if (current->args.number > 0
            && last_args_child (current)->type == ET_menu_entry_separator)
     {

Modified: trunk/parsetexi/parser.c
===================================================================
--- trunk/parsetexi/parser.c    2015-01-21 20:36:09 UTC (rev 6056)
+++ trunk/parsetexi/parser.c    2015-01-22 19:02:49 UTC (rev 6057)
@@ -516,6 +516,7 @@
 {
   ELEMENT *current = *current_inout;
   char *line = *line_inout;
+  char *line_after_command;
   int retval = 1; /* Return value of function */
   enum command_id end_cmd;
 
@@ -632,7 +633,7 @@
           retval = 0; /* 3844 */
           goto funexit;
         }
-    } /* BLOCK_raw or (ignored) BLOCK_conditional 3897 */
+    } /********* BLOCK_raw or (ignored) BLOCK_conditional 3897 *************/
 
 #if 0
   /* Check if parent element is 'verb' */
@@ -645,12 +646,12 @@
      is an @include. */
 #endif
 
-  /* !!! In the Perl version the command name is read separately for macros.
-     Thus the !cmd_id conditions. */
   if (*line == '@')
     {
-      line++; /* FIXME: DO this in read_command_name instead? */
-      command = read_command_name (&line);
+      line_after_command = line;
+
+      line_after_command++;
+      command = read_command_name (&line_after_command);
       cmd_id = lookup_command (command);
       if (cmd_id == 0)
         {
@@ -663,6 +664,7 @@
      may lead to changes in the line. */
   if (cmd_id && (command_data(cmd_id).flags & CF_MACRO)) // 3894
     {
+      line = line_after_command;
       current = handle_macro (current, &line, cmd_id);
     }
 
@@ -696,24 +698,14 @@
     }
   else if (handle_menu (&current, &line))
     {
-      ; /* Nothing. */
+      ; /* Nothing - everything was done in handle_menu. */
     }
 
-#if 0
-
-  /* Menu entry "* ...". */
-  else if (!cmd_id && ...)
-    {
-    }
-
-  /* various parsing of menus. */
-
-#endif
-
   /* line 4161 */
   /* Any other @-command. */
   else if (cmd_id)
     {
+      line = line_after_command;
       debug ("COMMAND %s", command);
 
 #if 0




reply via email to

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