texinfo-commits
[Top][All Lists]
Advanced

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

[8183] parsetexi update


From: gavinsmith0123
Subject: [8183] parsetexi update
Date: Fri, 21 Sep 2018 06:20:52 -0400 (EDT)

Revision: 8183
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=8183
Author:   gavin
Date:     2018-09-21 06:20:52 -0400 (Fri, 21 Sep 2018)
Log Message:
-----------
parsetexi update

Modified Paths:
--------------
    trunk/tp/Texinfo/XS/parsetexi/element_types.c
    trunk/tp/Texinfo/XS/parsetexi/element_types.h
    trunk/tp/Texinfo/XS/parsetexi/element_types.txt
    trunk/tp/Texinfo/XS/parsetexi/end_line.c
    trunk/tp/Texinfo/XS/parsetexi/separator.c

Modified: trunk/tp/Texinfo/XS/parsetexi/element_types.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/element_types.c       2018-09-21 09:58:58 UTC 
(rev 8182)
+++ trunk/tp/Texinfo/XS/parsetexi/element_types.c       2018-09-21 10:20:52 UTC 
(rev 8183)
@@ -1,6 +1,7 @@
 char *element_type_names[] = {
 0,
 "command_as_argument",
+"command_as_argument_inserted",
 "index_entry_command",
 "following_arg",
 "space_command_arg",

Modified: trunk/tp/Texinfo/XS/parsetexi/element_types.h
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/element_types.h       2018-09-21 09:58:58 UTC 
(rev 8182)
+++ trunk/tp/Texinfo/XS/parsetexi/element_types.h       2018-09-21 10:20:52 UTC 
(rev 8183)
@@ -2,6 +2,7 @@
 enum element_type {
 ET_NONE,
 ET_command_as_argument,
+ET_command_as_argument_inserted,
 ET_index_entry_command,
 ET_following_arg,
 ET_space_command_arg,

Modified: trunk/tp/Texinfo/XS/parsetexi/element_types.txt
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/element_types.txt     2018-09-21 09:58:58 UTC 
(rev 8182)
+++ trunk/tp/Texinfo/XS/parsetexi/element_types.txt     2018-09-21 10:20:52 UTC 
(rev 8183)
@@ -18,6 +18,7 @@
 
 # Types for @-commands
 command_as_argument
+command_as_argument_inserted
 index_entry_command
 following_arg
 space_command_arg

Modified: trunk/tp/Texinfo/XS/parsetexi/end_line.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/end_line.c    2018-09-21 09:58:58 UTC (rev 
8182)
+++ trunk/tp/Texinfo/XS/parsetexi/end_line.c    2018-09-21 10:20:52 UTC (rev 
8183)
@@ -1194,33 +1194,26 @@
       if (current->cmd == CM_enumerate)
         {
           char *spec = "1";
-          KEY_PAIR *k;
 
-          k = lookup_extra (current, "block_command_line_contents");
-          if (k)
+          if (current->args.number > 0
+              && current->args.list[0]->contents.number > 0)
             {
-              ELEMENT *e = k->value;
-              if (e->contents.number >= 1)
+              if (current->args.list[0]->contents.number > 1)
+                command_error (current, "superfluous argument to @%s",
+                               command_name(current->cmd));
+              ELEMENT *g = current->args.list[0]->contents.list[0];
+              /* Check if @enumerate specification is either a single
+                 letter or a string of digits. */
+              if (g->text.end == 1 && isalpha (g->text.text[0])
+                  || (g->text.end > 0
+                      && !*(g->text.text
+                            + strspn (g->text.text, "0123456789"))))
                 {
-                  ELEMENT *f, *g;
-                  f = contents_child_by_index (e, 0);
-                  if (f->contents.number > 1)
-                    command_error (current, "superfluous argument to @%s",
-                                   command_name(current->cmd));
-                  g = contents_child_by_index (f, 0);
-                  /* Check if @enumerate specification is either a single
-                     letter or a string of digits. */
-                  if (g->text.end == 1 && isalpha (g->text.text[0])
-                      || (g->text.end > 0
-                          && !*(g->text.text
-                                + strspn (g->text.text, "0123456789"))))
-                    {
-                      spec = g->text.text;
-                    }
-                  else
-                    command_error (current, "bad argument to @%s",
-                                   command_name(current->cmd));
+                  spec = g->text.text;
                 }
+              else
+                command_error (current, "bad argument to @%s",
+                               command_name(current->cmd));
             }
           add_extra_string_dup (current, "enumerate_specification", spec);
         }
@@ -1304,12 +1297,6 @@
                   k->key = "";
                   k->value = 0;
                   k->type = extra_deleted;
-                  k = lookup_extra (current,
-                                        "block_command_line_contents");
-                  if (k)
-                    {
-                      k->key = ""; k->type = extra_deleted;
-                    }
                 }
             }
         }
@@ -1317,11 +1304,12 @@
       /* 3052 - if no command_as_argument given, default to @bullet for
          @itemize, and @asis for @table. */
       if (current->cmd == CM_itemize
-        && !lookup_extra (current, "block_command_line_contents"))
+          && (current->args.number == 0
+              || current->args.list[0]->args.number == 0))
         {
           ELEMENT *e, *contents, *contents2;
 
-          e = new_element (ET_command_as_argument);
+          e = new_element (ET_command_as_argument_inserted);
           e->cmd = CM_bullet;
           e->parent_type = route_not_in_tree;
           e->parent = current;
@@ -1332,8 +1320,6 @@
           contents2->parent_type = route_not_in_tree;
           add_to_contents_as_array (contents2, e);
           add_to_element_contents (contents, contents2);
-          add_extra_contents_array (current, "block_command_line_contents",
-                                        contents);
         }
       else if (item_line_command (current->cmd)
           && !lookup_extra (current, "command_as_argument"))
@@ -1351,8 +1337,6 @@
           contents2->parent_type = route_not_in_tree;
           add_to_contents_as_array (contents2, e);
           add_to_element_contents (contents, contents2);
-          add_extra_contents_array (current, "block_command_line_contents",
-                                        contents);
           // FIXME: code duplication
         }
 

Modified: trunk/tp/Texinfo/XS/parsetexi/separator.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/separator.c   2018-09-21 09:58:58 UTC (rev 
8182)
+++ trunk/tp/Texinfo/XS/parsetexi/separator.c   2018-09-21 10:20:52 UTC (rev 
8183)
@@ -25,42 +25,6 @@
 #include "input.h"
 #include "labels.h"
 
-// 3600
-/* Add the contents of CURRENT as an element to the extra value with
-   key KEY, except that some "empty space" elements are removed.  Used for
-   'block_command_line_contents' for the arguments to a block line command.
-TODO: This function should go away once we make the same change for
-"block commands" as were made for "brace commands".
-   */
-void
-register_command_arg (ELEMENT *current, char *key)
-{
-  ELEMENT *value;
-  ELEMENT *new;
-  KEY_PAIR *k;
-
-  new = trim_spaces_comment_from_content (current);
-  if (new->contents.number == 0)
-    {
-      free (new);
-      new = 0;
-    }
-
-  /* FIXME: Could we add all the command args together, instead of one-by-one,
-     to avoid having to look for the extra value every time? */
-  k = lookup_extra (current->parent, key);
-  if (k)
-    value = k->value;
-  else
-    {
-      value = new_element (ET_NONE);
-      value->parent_type = route_not_in_tree;
-      add_extra_contents_array (current->parent, key, value);
-    }
-
-  add_to_contents_as_array (value, new);
-}
-
 /* 4888 */
 ELEMENT *
 handle_open_brace (ELEMENT *current, char **line_inout)




reply via email to

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