texinfo-commits
[Top][All Lists]
Advanced

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

[8157] parsetexi update


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

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

Modified Paths:
--------------
    trunk/tp/Texinfo/XS/parsetexi/api.c
    trunk/tp/Texinfo/XS/parsetexi/close.c
    trunk/tp/Texinfo/XS/parsetexi/convert.c
    trunk/tp/Texinfo/XS/parsetexi/dump_perl.c
    trunk/tp/Texinfo/XS/parsetexi/parser.c
    trunk/tp/Texinfo/XS/parsetexi/separator.c

Modified: trunk/tp/Texinfo/XS/parsetexi/api.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/api.c 2018-09-02 12:06:22 UTC (rev 8156)
+++ trunk/tp/Texinfo/XS/parsetexi/api.c 2018-09-02 12:08:04 UTC (rev 8157)
@@ -217,21 +217,11 @@
   /* FIXME: Sometimes extra values have parent set - try to remove this
      in the Perl code as well. */
 
-  sv = 0;
-  if (e->cmd == CM_verb)
+  if (e->type)
     {
-      char c = (char) e->type;
-      if (c)
-        sv = newSVpv (&c, 1);
-      else
-        sv = newSVpv ("", 0);
-    }
-  else if (e->type)
-    {
       sv = newSVpv (element_type_names[e->type], 0);
+      hv_store (e->hv, "type", strlen ("type"), sv, 0);
     }
-  if (sv)
-    hv_store (e->hv, "type", strlen ("type"), sv, 0);
 
   if (e->cmd)
     {

Modified: trunk/tp/Texinfo/XS/parsetexi/close.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/close.c       2018-09-02 12:06:22 UTC (rev 
8156)
+++ trunk/tp/Texinfo/XS/parsetexi/close.c       2018-09-02 12:08:04 UTC (rev 
8157)
@@ -26,8 +26,17 @@
                      enum command_id closed_command,
                      enum command_id interrupting_command)
 {
-  if (current->cmd != CM_verb || current->type == ET_NONE)
+
+  KEY_PAIR *k;
+
+  if (current->cmd != CM_verb)
+    goto yes;
+  k = lookup_extra_key (current, "delimiter");
+  if (!k || !*(char *)k->value)
+    goto yes;
+  if (0)
     {
+yes:
       if (closed_command)
         command_error (current,
                         "@end %s seen before @%s closing brace",
@@ -45,18 +54,10 @@
     }
   else
     {
-      char s[2];
-      if ((char) current->type)
-        {
-          s[0] = (char) current->type;
-          s[1] = 0;
-        }
-      else
-        s[0] = 0;
-      
       command_error (current,
                       "@%s missing closing delimiter sequence: %s}",
-                      command_name(current->cmd), s);
+                      command_name(current->cmd),
+                      (char *)k->value);
     }
   current = current->parent;
   return current;

Modified: trunk/tp/Texinfo/XS/parsetexi/convert.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/convert.c     2018-09-02 12:06:22 UTC (rev 
8156)
+++ trunk/tp/Texinfo/XS/parsetexi/convert.c     2018-09-02 12:08:04 UTC (rev 
8157)
@@ -98,9 +98,8 @@
 
       if (e->cmd == CM_verb)
         {
-          s[0] = (char ) e->type;
-          s[1] = '\0';
-          ADD(s);
+          k = lookup_extra_key (e, "delimiter");
+          ADD((char *)k->value);
         }
 
       arg_nr = 0;
@@ -122,7 +121,10 @@
         }
 
       if (e->cmd == CM_verb)
-        ADD(s);
+        {
+          k = lookup_extra_key (e, "delimiter");
+          ADD((char *)k->value);
+        }
 
       if (braces)
         ADD("}");

Modified: trunk/tp/Texinfo/XS/parsetexi/dump_perl.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/dump_perl.c   2018-09-02 12:06:22 UTC (rev 
8156)
+++ trunk/tp/Texinfo/XS/parsetexi/dump_perl.c   2018-09-02 12:08:04 UTC (rev 
8157)
@@ -439,17 +439,7 @@
   if (e->type)
     {
       dump_indent (text);
-      if (e->cmd != CM_verb)
-        text_printf (text, "'type' => '%s',\n", element_type_name(e));
-      else
-        {
-          char c = (char) e->type;
-          text_printf (text, "'type' => '");
-          if (c == '\'' || c == '\\') /* Escaping for Perl. */
-            text_append_n (text, "\\", 1);
-          text_append_n (text, &c, 1);
-          text_printf (text, "',\n");
-        }
+      text_printf (text, "'type' => '%s',\n", element_type_name(e));
     }
 
   if (e->cmd)

Modified: trunk/tp/Texinfo/XS/parsetexi/parser.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/parser.c      2018-09-02 12:06:22 UTC (rev 
8156)
+++ trunk/tp/Texinfo/XS/parsetexi/parser.c      2018-09-02 12:08:04 UTC (rev 
8157)
@@ -1011,8 +1011,11 @@
     {
       char c;
       char *q;
+      KEY_PAIR *k;
 
-      c = (char) current->parent->type;
+      k = lookup_extra_key (current->parent, "delimiter");
+
+      c = *(char *)k->value;
       if (c)
         {
           /* Look forward for the delimiter character followed by a close

Modified: trunk/tp/Texinfo/XS/parsetexi/separator.c
===================================================================
--- trunk/tp/Texinfo/XS/parsetexi/separator.c   2018-09-02 12:06:22 UTC (rev 
8156)
+++ trunk/tp/Texinfo/XS/parsetexi/separator.c   2018-09-02 12:08:04 UTC (rev 
8157)
@@ -87,15 +87,19 @@
       if (command == CM_verb)
         {
           current->type = ET_brace_command_arg;
-          /* Save the deliminating character in 'type'.  This is a reuse of 
-             'type' for a different purpose. */
+          /* Save the deliminating character in 'type'. */
           if (!*line || *line == '\n')
             {
               line_error ("@verb without associated character");
+              add_extra_string_dup (current->parent, "delimiter", "");
               current->parent->type = 0;
             }
           else
-            current->parent->type = (enum element_type) *line++;
+            {
+              static char c[2];
+              c[0] = *line++;
+              add_extra_string_dup (current->parent, "delimiter", c);
+            }
         }
         /* 4903 */
       else if (command_data(command).data == BRACE_context)




reply via email to

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