texinfo-commits
[Top][All Lists]
Advanced

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

[7453] parsetexi update


From: gavinsmith0123
Subject: [7453] parsetexi update
Date: Sat, 15 Oct 2016 14:26:04 +0000 (UTC)

Revision: 7453
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7453
Author:   gavin
Date:     2016-10-15 14:26:04 +0000 (Sat, 15 Oct 2016)
Log Message:
-----------
parsetexi update

Modified Paths:
--------------
    trunk/tp/parsetexi/def.c
    trunk/tp/parsetexi/dump_perl.c
    trunk/tp/parsetexi/end_line.c
    trunk/tp/parsetexi/main.c

Modified: trunk/tp/parsetexi/def.c
===================================================================
--- trunk/tp/parsetexi/def.c    2016-10-15 10:40:37 UTC (rev 7452)
+++ trunk/tp/parsetexi/def.c    2016-10-15 14:26:04 UTC (rev 7453)
@@ -238,7 +238,7 @@
 {
   /* The return value - suitable for "def_args" extra value. */
   DEF_ARGS_EXTRA *def_args;
-  int i, args_start;
+  int i, args_start = 0;
 
   ELEMENT *arg_line; /* Copy of argument line. */
   ELEMENT *arg, *spaces; /* Arguments and spaces extracted from line. */
@@ -344,7 +344,8 @@
 
   /* CATEGORY */
   arg = next_bracketed_or_word (arg_line, &spaces, 1);
-
+  if (!arg)
+    goto finished;
   if (spaces)
     add_to_def_args_extra (def_args, "spaces", spaces);
   add_to_def_args_extra (def_args, "category", arg);
@@ -356,6 +357,8 @@
       || command == CM_defop)
     {
       arg = next_bracketed_or_word (arg_line, &spaces, 1);
+      if (!arg)
+        goto finished;
       if (spaces)
         add_to_def_args_extra (def_args, "spaces", spaces);
       add_to_def_args_extra (def_args, "class", arg);
@@ -368,6 +371,8 @@
       || command == CM_deftypecv)
     {
       arg = next_bracketed_or_word (arg_line, &spaces, 1);
+      if (!arg)
+        goto finished;
       if (spaces)
         add_to_def_args_extra (def_args, "spaces", spaces);
       add_to_def_args_extra (def_args, "type", arg);
@@ -376,6 +381,8 @@
   /* NAME */
   /* All command types get a name. */
   arg = next_bracketed_or_word (arg_line, &spaces, 1);
+  if (!arg)
+    goto finished;
   if (spaces)
     add_to_def_args_extra (def_args, "spaces", spaces);
   add_to_def_args_extra (def_args, "name", arg);
@@ -390,7 +397,7 @@
       if (spaces)
         add_to_def_args_extra (def_args, "spaces", spaces);
       if (!arg)
-        break;
+        goto finished;
       if (arg->text.end > 0) // 2445
         {
           ELEMENT *e;
@@ -431,12 +438,14 @@
         }
     }
 
+finished:
 
   // 2460 - argtype
   /* Change some of the left sides to 'typearg'.  This matters for
      the DocBook output. */
-  if (command == CM_deftypefn || command == CM_deftypeop
-      || command == CM_deftp)
+  if (args_start > 0
+      && (command == CM_deftypefn || command == CM_deftypeop
+          || command == CM_deftp))
     {
       int i, next_is_type = 1;
       for (i = args_start; i < def_args->nelements; i++)
@@ -464,17 +473,5 @@
     }
 
   destroy_element (arg_line);
-  add_to_def_args_extra (def_args, 0, 0);
   return def_args;
-
-#if 0
-  // In calling code at 2788, this array is saved in the extra key.
-
-  // 2853 an index entry is also entered
-  enter_index_entry (command, original_command, name
-                     /* , index_entry_normalized */ );
-  
-  /* Notes: See 2812 for value of 'name'. */
-#endif
-
 }

Modified: trunk/tp/parsetexi/dump_perl.c
===================================================================
--- trunk/tp/parsetexi/dump_perl.c      2016-10-15 10:40:37 UTC (rev 7452)
+++ trunk/tp/parsetexi/dump_perl.c      2016-10-15 14:26:04 UTC (rev 7453)
@@ -321,8 +321,9 @@
               text_append (text, e->extra[i].key);
               text_append (text, "' => [\n");
 
-              for (j = 0; (label = value->labels[j]); j++)
+              for (j = 0; j < value->nelements; j++)
                 {
+                  label = value->labels[j];
                   dump_indent (text);
                   text_append_n (text, "['", 2);
                   text_append (text, label);

Modified: trunk/tp/parsetexi/end_line.c
===================================================================
--- trunk/tp/parsetexi/end_line.c       2016-10-15 10:40:37 UTC (rev 7452)
+++ trunk/tp/parsetexi/end_line.c       2016-10-15 14:26:04 UTC (rev 7453)
@@ -2082,7 +2082,7 @@
       arguments = parse_def (def_command, current->contents);
 
       /* Now record the index entry. */
-      if (arguments)
+      if (arguments && arguments->nelements > 0)
         {
           ELEMENT *name = 0, *class = 0; /* From arguments. */
           ELEMENT *index_entry = 0; /* Index entry text. */

Modified: trunk/tp/parsetexi/main.c
===================================================================
--- trunk/tp/parsetexi/main.c   2016-10-15 10:40:37 UTC (rev 7452)
+++ trunk/tp/parsetexi/main.c   2016-10-15 14:26:04 UTC (rev 7453)
@@ -33,6 +33,7 @@
       fprintf (stderr, "Please give the name of a file to process.\n");
       exit (1);
     }
+  reset_parser ();
   parse_texi_file (argv[1]);
   dump_tree_to_perl (Root);
   //build_texinfo_tree ();




reply via email to

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