texinfo-commits
[Top][All Lists]
Advanced

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

[6813] parsetexi update


From: Gavin D. Smith
Subject: [6813] parsetexi update
Date: Sun, 29 Nov 2015 18:40:08 +0000

Revision: 6813
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6813
Author:   gavin
Date:     2015-11-29 18:40:06 +0000 (Sun, 29 Nov 2015)
Log Message:
-----------
parsetexi update

Modified Paths:
--------------
    trunk/parsetexi/Parsetexi/lib/Parsetexi.pm
    trunk/parsetexi/convert.c
    trunk/parsetexi/end_line.c
    trunk/parsetexi/errors.c
    trunk/parsetexi/separator.c

Modified: trunk/parsetexi/Parsetexi/lib/Parsetexi.pm
===================================================================
--- trunk/parsetexi/Parsetexi/lib/Parsetexi.pm  2015-11-29 17:20:07 UTC (rev 
6812)
+++ trunk/parsetexi/Parsetexi/lib/Parsetexi.pm  2015-11-29 18:40:06 UTC (rev 
6813)
@@ -121,9 +121,9 @@
   if (defined($conf)) {
     foreach my $key (keys (%$conf)) {
       if ($key eq 'include_directories') {
-        warn "Passed include_directories\n";
+        #warn "Passed include_directories\n";
         foreach my $d (@{$conf->{'include_directories'}}) {
-          warn "got dir $d\n";
+          #warn "got dir $d\n";
           add_include_directory ($d);
         }
       } elsif ($key eq 'values') {

Modified: trunk/parsetexi/convert.c
===================================================================
--- trunk/parsetexi/convert.c   2015-11-29 17:20:07 UTC (rev 6812)
+++ trunk/parsetexi/convert.c   2015-11-29 18:40:06 UTC (rev 6813)
@@ -32,10 +32,10 @@
       if (e->contents.list[which]->type == ET_spaces_at_end)
         which--;
 
-      if (which > 0)
+      if (which > 0 && e->contents.list[which]->text.text)
         return e->contents.list[which]->text.text;
     }
-  return "bar";
+  return "AAAAAAAAA";
 }
 
 /* IN_UC is non-zero if we are converting to upper case. */

Modified: trunk/parsetexi/end_line.c
===================================================================
--- trunk/parsetexi/end_line.c  2015-11-29 17:20:07 UTC (rev 6812)
+++ trunk/parsetexi/end_line.c  2015-11-29 18:40:06 UTC (rev 6813)
@@ -163,6 +163,13 @@
 
   line_args = new_element (ET_NONE);
 
+  if (arg->contents.number == 0)
+    {
+      /*command_errorf ("@%s missing argument",
+                      command_name (line_command->cmd));*/
+      return 0;
+    }
+
   i = 0;
   while (i < arg->contents.number)
     {
@@ -185,7 +192,8 @@
       else
         {
           /* Error - too many arguments. */
-          abort ();
+          line_errorf ("superfluous argument to @%s",
+                       command_name (line_command->cmd));
         }
     }
   if (!argarg)
@@ -194,7 +202,7 @@
     }
 
   if (argarg->text.end == 0)
-    abort ();
+     return 0; // 5519
 
   cmd = line_command->cmd;
   line = argarg->text.text;
@@ -945,36 +953,42 @@
 
               /* Set end_command - used below. */
               end_command = read_command_name (&line);
-
-              /* Check if argument is a block Texinfo command. */
-              end_id = lookup_command (end_command);
-              if (end_id == 0 || !(command_data(end_id).flags & CF_block))
+              if (end_command)
                 {
-                  command_warnf ("unknown @end %s", end_command);
-                  free (end_command); end_command = 0;
-                }
-              else
-                {
-                  debug ("END BLOCK %s", end_command);
-                  /* 3140 Handle conditional block commands (e.g.  
-                     @ifinfo) */
+                  /* Check if argument is a block Texinfo command. */
+                  end_id = lookup_command (end_command);
+                  if (end_id == 0 || !(command_data(end_id).flags & CF_block))
+                    {
+                      command_warnf ("unknown @end %s", end_command);
+                      free (end_command); end_command = 0;
+                    }
+                  else
+                    {
+                      debug ("END BLOCK %s", end_command);
+                      /* 3140 Handle conditional block commands (e.g.  
+                         @ifinfo) */
 
-                  /* If we are in a non-ignored conditional, there is not
-                     an element for the block in the tree; it is recorded 
-                     in the conditional stack.  Pop it and check it is the 
-                     same as the one given in the @end line. */
+                      /* If we are in a non-ignored conditional, there is not
+                         an element for the block in the tree; it is recorded 
+                         in the conditional stack.  Pop it and check it is the 
+                         same as the one given in the @end line. */
 
-                  if (command_data(end_id).data == BLOCK_conditional)
-                    {
-                      if (conditional_number > 0)
+                      if (command_data(end_id).data == BLOCK_conditional)
                         {
-                          enum command_id popped;
-                          popped = pop_conditional_stack ();
-                          if (popped != end_id)
-                            abort ();
+                          if (conditional_number > 0)
+                            {
+                              enum command_id popped;
+                              popped = pop_conditional_stack ();
+                              if (popped != end_id)
+                                abort ();
+                            }
                         }
                     }
                 }
+              else
+                {
+                  command_errorf ("bad argument to @end: %s", line);
+                }
             }
           else if (current->cmd == CM_include) // 3166
             {

Modified: trunk/parsetexi/errors.c
===================================================================
--- trunk/parsetexi/errors.c    2015-11-29 17:20:07 UTC (rev 6812)
+++ trunk/parsetexi/errors.c    2015-11-29 18:40:06 UTC (rev 6813)
@@ -40,6 +40,7 @@
 void
 line_error (char *message)
 {
+  if (!message) abort ();
   if (error_number == error_space)
     {
       error_list = realloc (error_list,
@@ -64,6 +65,7 @@
 void
 line_warn (char *message)
 {
+  if (!message) abort ();
   if (error_number == error_space)
     {
       error_list = realloc (error_list,

Modified: trunk/parsetexi/separator.c
===================================================================
--- trunk/parsetexi/separator.c 2015-11-29 17:20:07 UTC (rev 6812)
+++ trunk/parsetexi/separator.c 2015-11-29 18:40:06 UTC (rev 6813)
@@ -239,12 +239,10 @@
       else if (command_data(closed_command).flags & (CF_explained | CF_inline))
         { // 5129
         }
-      else if (closed_command == CM_errormsg)
+      else if (closed_command == CM_errormsg) // 5173
         {
-          // XXXXX !!!!!!
-          // Texinfo::Convert::Text::convert (...)
-          // XXXXX !!!!!!
-          abort ();
+          // if (!ignore_global_commands)
+          line_error (text_convert (current));
         }
       else if (command_with_command_as_argument (current->parent->parent)
                && current->contents.number == 0)




reply via email to

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