texinfo-commits
[Top][All Lists]
Advanced

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

[8149] parsetexi update


From: gavinsmith0123
Subject: [8149] parsetexi update
Date: Sun, 2 Sep 2018 04:41:46 -0400 (EDT)

Revision: 8149
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8149
Author:   gavin
Date:     2018-09-02 04:41:46 -0400 (Sun, 02 Sep 2018)
Log Message:
-----------
parsetexi update

Modified Paths:
--------------
    trunk/tp/Texinfo/XS/parsetexi/def.c
    trunk/tp/Texinfo/XS/parsetexi/end_line.c

Modified: trunk/tp/Texinfo/XS/parsetexi/def.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/def.c 2018-09-02 08:20:39 UTC (rev 8148)
+++ trunk/tp/Texinfo/XS/parsetexi/def.c 2018-09-02 08:41:46 UTC (rev 8149)
@@ -215,10 +215,10 @@
    and non-whitespace.  Change ET_bracketed elements to 
    ET_bracketed_def_content. */
 static void
-split_def_args (ELEMENT *current)
+split_def_args (ELEMENT *current, int starting_idx)
 {
   int i;
-  for (i = 0; i < current->contents.number; i++)
+  for (i = starting_idx; i < current->contents.number; i++)
     {
       ELEMENT *e = current->contents.list[i];
       int j;
@@ -233,8 +233,6 @@
         }
       if (e->text.end == 0)
         continue;
-      if (e->type == ET_empty_spaces_after_command)
-        continue;
       p = e->text.text;
 
       while (1)
@@ -248,7 +246,8 @@
               add_extra_string_dup (new, "def_role", "spaces");
               if (!*(p += len))
                 {
-                  if (p[-1] == '\n')
+                  if (new->text.end > 0
+                      && new->text.text[new->text.end - 1] == '\n')
                     new->type = ET_spaces_at_end;
                   break;
                 }
@@ -270,7 +269,7 @@
 parse_def (enum command_id command, ELEMENT *current)
 {
   DEF_INFO *ret;
-  int contents_idx;
+  int contents_idx = 0;
   int type, next_type;
   int i;
   ELEMENT *e, *e1;
@@ -279,8 +278,13 @@
   ret = malloc (sizeof (DEF_INFO));
   memset (ret, 0, sizeof (DEF_INFO));
 
-  split_def_args (current);
+  if (current->contents.number > 0
+      && (current->contents.list[0]->type == ET_empty_spaces_after_command
+          || current->contents.list[0]->type == ET_empty_line_after_command))
+    contents_idx++;
 
+  split_def_args (current, contents_idx);
+
   /* Check for "def alias" - for example @defun for @deffn. */
   if (command_data(command).flags & CF_def_alias) // 2387
     {
@@ -301,14 +305,9 @@
       original_command = command;
       command = def_aliases[i].command;
 
-      contents_idx = 0;
-      if (current->contents.number > 0
-          && current->contents.list[0]->type == ET_empty_spaces_after_command)
-        contents_idx++;
-
       /* Used when category text has a space in it. */
       e = new_element (ET_bracketed_inserted);
-      insert_into_contents (current, e, contents_idx++);
+      insert_into_contents (current, e, contents_idx);
       e1 = new_element (ET_NONE);
       text_append_n (&e1->text, category, strlen (category));
       add_to_element_contents (e, e1);
@@ -322,10 +321,9 @@
       e = new_element (ET_spaces_inserted);
       text_append_n (&e->text, " ", 1);
       add_extra_string_dup (e, "def_role", "spaces");
-      insert_into_contents (current, e, contents_idx);
+      insert_into_contents (current, e, contents_idx + 1);
     }
 
-
   /* Read arguments as CATEGORY [CLASS] [TYPE] NAME [ARGUMENTS].
   
      Meaning of these:
@@ -335,7 +333,6 @@
      NAME - name of entity being documented
      ARGUMENTS - arguments to a function or macro                  */
 
-  contents_idx = 0;
   /* CATEGORY */
   ret->category = next_bracketed_or_word_agg (current, &contents_idx);
 
@@ -394,8 +391,7 @@
       e = contents_child_by_index (current, i);
       if (e->type == ET_spaces
           || e->type == ET_spaces_inserted
-          || e->type == ET_spaces_at_end
-          || e->type == ET_empty_spaces_after_command)
+          || e->type == ET_spaces_at_end)
         {
           continue;
         }

Modified: trunk/tp/Texinfo/XS/parsetexi/end_line.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/end_line.c    2018-09-02 08:20:39 UTC (rev 
8148)
+++ trunk/tp/Texinfo/XS/parsetexi/end_line.c    2018-09-02 08:41:46 UTC (rev 
8149)
@@ -2331,7 +2331,6 @@
   /* after an "@end verbatim" 3090 */
   else if (current->contents.number
            && last_contents_child(current)->type == ET_empty_line_after_command
-    /* The Perl version gets the command with the 'command' key in 'extra'. */
            && contents_child_by_index(current, -2)
            && contents_child_by_index(current, -2)->cmd == CM_verbatim)
     {




reply via email to

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