texinfo-commits
[Top][All Lists]
Advanced

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

[7217] parsetexi update


From: gavinsmith0123
Subject: [7217] parsetexi update
Date: Sun, 12 Jun 2016 12:56:54 +0000 (UTC)

Revision: 7217
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7217
Author:   gavin
Date:     2016-06-12 12:56:54 +0000 (Sun, 12 Jun 2016)
Log Message:
-----------
parsetexi update

Modified Paths:
--------------
    trunk/tp/parsetexi/api.c
    trunk/tp/parsetexi/parser.c

Modified: trunk/tp/parsetexi/api.c
===================================================================
--- trunk/tp/parsetexi/api.c    2016-06-12 11:48:41 UTC (rev 7216)
+++ trunk/tp/parsetexi/api.c    2016-06-12 12:56:54 UTC (rev 7217)
@@ -252,6 +252,8 @@
       || e->cmd == CM_multitable
       || e->type == ET_menu_entry_name
       || e->type == ET_brace_command_arg
+      || e->type == ET_before_item
+      || e->type == ET_inter_item
       || e->cmd == CM_TeX
       || (command_flags(e) & CF_root)
       || (command_data(e->cmd).flags & CF_brace

Modified: trunk/tp/parsetexi/parser.c
===================================================================
--- trunk/tp/parsetexi/parser.c 2016-06-12 11:48:41 UTC (rev 7216)
+++ trunk/tp/parsetexi/parser.c 2016-06-12 12:56:54 UTC (rev 7217)
@@ -561,7 +561,6 @@
 }
 
 // 5467, also in Common.pm 1334
-// TODO: Check the behaviour here is the same
 /* Return a new element whose contents are the same as those of ORIGINAL,
    but with some elements representing empty spaces removed.  Elements like 
    these are used to represent some of the "content" extra keys. */
@@ -569,31 +568,34 @@
 trim_spaces_comment_from_content (ELEMENT *original)
 {
   ELEMENT *trimmed;
-  int i;
+  int i, j, k;
+  enum element_type t;
 
   trimmed = new_element (ET_NONE);
   trimmed->parent_type = route_not_in_tree;
-  for (i = 0; i < original->contents.number; i++)
+
+  i = 1;
+  t = original->contents.list[0]->type;
+  if (t != ET_empty_line_after_command
+      && t != ET_empty_spaces_after_command
+      && t != ET_empty_spaces_before_argument
+      && t != ET_empty_space_at_end_def_bracketed
+      && t != ET_empty_spaces_after_close_brace)
+    i = 0;
+
+  for (j = original->contents.number - 1; j >= 0; j--)
     {
-      enum element_type t = original->contents.list[i]->type;
-      if (t != ET_empty_line_after_command
-          && t != ET_empty_spaces_after_command
-          && t != ET_empty_spaces_before_argument
-          && t != ET_empty_space_at_end_def_bracketed
-          && t != ET_empty_spaces_after_close_brace
+      enum element_type t = original->contents.list[j]->type;
+      if (original->contents.list[j]->cmd != CM_c
+          && original->contents.list[j]->cmd != CM_comment
           && t != ET_spaces_at_end
-          && t != ET_space_at_end_block_command
-          && original->contents.list[i]->cmd != CM_c
-          && original->contents.list[i]->cmd != CM_comment)
-        {
-          /* FIXME: Is this safe to serialize? */
-          /* For example, if there are extra keys in the elements under each 
-             argument?  They may not be set in a copy.
-             Hopefully there aren't many extra keys set on commands in 
-             node names. */
-          add_to_contents_as_array (trimmed, original->contents.list[i]);
-        }
+          && t != ET_space_at_end_block_command)
+        break;
     }
+  for (k = i; k <= j; k++)
+    {
+      add_to_contents_as_array (trimmed, original->contents.list[k]);
+    }
 
   return trimmed;
 }




reply via email to

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