texinfo-commits
[Top][All Lists]
Advanced

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

[7171] parsetexi verbatim


From: gavinsmith0123
Subject: [7171] parsetexi verbatim
Date: Sat, 14 May 2016 21:14:00 +0000 (UTC)

Revision: 7171
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7171
Author:   gavin
Date:     2016-05-14 21:13:59 +0000 (Sat, 14 May 2016)
Log Message:
-----------
parsetexi verbatim

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

Modified: trunk/tp/parsetexi/api.c
===================================================================
--- trunk/tp/parsetexi/api.c    2016-05-14 20:20:21 UTC (rev 7170)
+++ trunk/tp/parsetexi/api.c    2016-05-14 21:13:59 UTC (rev 7171)
@@ -208,22 +208,21 @@
   /* FIXME: Sometimes extra values have parent set - try to remove this
      in the Perl code as well. */
 
-  if (e->type)
+  sv = 0;
+  if (e->cmd == CM_verb)
     {
-      if (e->cmd != CM_verb)
-        {
-          sv = newSVpv (element_type_names[e->type], 0);
-        }
+      char c = (char) e->type;
+      if (c)
+        sv = newSVpv (&c, 1);
       else
-        {
-          char c = (char) e->type;
-          sv = newSVpv (&c, 1);
-        }
-      hv_store (e->hv, "type", strlen ("type"), sv, 0);
-
-      /* TODO: Could precompute hash of "type", and also reuse
-         the same SV for a single type? */
+        sv = newSVpv ("", 0);
     }
+  else if (e->type)
+    {
+      sv = newSVpv (element_type_names[e->type], 0);
+    }
+  if (sv)
+    hv_store (e->hv, "type", strlen ("type"), sv, 0);
 
   if (e->cmd)
     {

Modified: trunk/tp/parsetexi/close.c
===================================================================
--- trunk/tp/parsetexi/close.c  2016-05-14 20:20:21 UTC (rev 7170)
+++ trunk/tp/parsetexi/close.c  2016-05-14 21:13:59 UTC (rev 7171)
@@ -45,10 +45,18 @@
     }
   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),
-                      element_type_names[current->type]);
+                      "@%s missing closing delimiter sequence: %s}",
+                      command_name(current->cmd), s);
     }
   current = current->parent;
   return current;

Modified: trunk/tp/parsetexi/handle_commands.c
===================================================================
--- trunk/tp/parsetexi/handle_commands.c        2016-05-14 20:20:21 UTC (rev 
7170)
+++ trunk/tp/parsetexi/handle_commands.c        2016-05-14 21:13:59 UTC (rev 
7171)
@@ -1034,7 +1034,7 @@
     {
       add_extra_string (e, "clickstyle", global_clickstyle);
     }
-  if (command_data(cmd).flags & CF_INFOENCLOSE)
+  else if (command_data(cmd).flags & CF_INFOENCLOSE)
     {
       INFO_ENCLOSE *ie = lookup_infoenclose (cmd);
       if (ie)

Modified: trunk/tp/parsetexi/parser.c
===================================================================
--- trunk/tp/parsetexi/parser.c 2016-05-14 20:20:21 UTC (rev 7170)
+++ trunk/tp/parsetexi/parser.c 2016-05-14 21:13:59 UTC (rev 7171)
@@ -845,35 +845,25 @@
       char c;
       char *q;
 
-      /* Save the deliminating character in 'type', if not already done.
-         This is a reuse of 'type' for a different purpose.
-         If we use 'text' instead, we can get extra text stuck on the end of 
it 
-         for some reason (probably from "merging text"). */
-      if (!current->parent->type)
+      c = (char) current->parent->type;
+      if (c)
         {
-          if (!*line)
+          /* Look forward for the delimiter character followed by a close
+             brace. */
+          q = line;
+          while (1)
             {
-              line_error ("@verb without associated character");
-              // TODO: How should we recover from this?
-              retval = GET_A_NEW_LINE; goto funexit;
+              q = strchr (q, c);
+              if (!q || q[1] == '}')
+                break;
+              q++;
             }
-          else
-            current->parent->type = (enum element_type) *line++;
         }
-
-      c = (char) current->parent->type;
-
-      /* Look forward for the delimiter character followed by a close
-         brace. */
-      q = line;
-      do
+      else
         {
-          q = strchr (q, c);
-          if (!q || q[1] == '}')
-            break;
-          q++;
+          /* Look forward for a close brace. */
+          q = strchr (line, '}');
         }
-      while (1);
 
       if (q)
         {
@@ -884,8 +874,11 @@
               text_append_n (&e->text, line, q - line);
               add_to_element_contents (current, e);
             }
-          line = q + 1;
           debug ("END VERB");
+          if (c)
+            line = q + 1;
+          else
+            line = q;
           /* The '}' will close the @verb command in handle_separator below. */
         }
       else

Modified: trunk/tp/parsetexi/separator.c
===================================================================
--- trunk/tp/parsetexi/separator.c      2016-05-14 20:20:21 UTC (rev 7170)
+++ trunk/tp/parsetexi/separator.c      2016-05-14 21:13:59 UTC (rev 7171)
@@ -87,9 +87,22 @@
       add_to_element_args (current, arg);
       current = arg;
 
-      /* 4903 */
-      if (command_data(command).data == BRACE_context)
+      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. */
+          if (!*line || *line == '\n')
+            {
+              line_error ("@verb without associated character");
+              current->parent->type = 0;
+            }
+          else
+            current->parent->type = (enum element_type) *line++;
+        }
+        /* 4903 */
+      else if (command_data(command).data == BRACE_context)
+        {
           if (command == CM_caption || command == CM_shortcaption)
             {
 #define float floatxx




reply via email to

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