texinfo-commits
[Top][All Lists]
Advanced

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

[6852] parsetexi update


From: Gavin D. Smith
Subject: [6852] parsetexi update
Date: Sat, 12 Dec 2015 13:45:15 +0000

Revision: 6852
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6852
Author:   gavin
Date:     2015-12-12 13:45:13 +0000 (Sat, 12 Dec 2015)
Log Message:
-----------
parsetexi update

Modified Paths:
--------------
    trunk/parsetexi/close.c
    trunk/parsetexi/end_line.c
    trunk/parsetexi/errors.c
    trunk/parsetexi/errors.h
    trunk/parsetexi/handle_commands.c
    trunk/parsetexi/macro.c
    trunk/parsetexi/multitable.c
    trunk/parsetexi/parser.c
    trunk/parsetexi/separator.c

Modified: trunk/parsetexi/close.c
===================================================================
--- trunk/parsetexi/close.c     2015-12-12 11:16:16 UTC (rev 6851)
+++ trunk/parsetexi/close.c     2015-12-12 13:45:13 UTC (rev 6852)
@@ -29,23 +29,23 @@
   if (current->cmd != CM_verb || current->type == ET_NONE)
     {
       if (closed_command)
-        command_errorf (current,
+        command_error (current,
                         "@end %s seen before @%s closing brace",
                         command_name(closed_command),
                         command_name(current->cmd));
       else if (interrupting_command)
-        command_errorf (current,
+        command_error (current,
                         "%s seen before @%s closing brace",
                         command_name(interrupting_command),
                         command_name(current->cmd));
       else
-        command_errorf (current,
+        command_error (current,
                         "@%s missing close brace",
                         command_name(current->cmd));
     }
   else
     {
-      command_errorf (current,
+      command_error (current,
                       "@%s missing closing delimiter sequence: %s",
                       command_name(current->cmd),
                       element_type_names[current->type]);
@@ -227,8 +227,8 @@
                 }
 
               if (empty_format)
-                line_warnf ("@%s has text but no @item",
-                            command_name(current->cmd));
+                line_warn ("@%s has text but no @item",
+                           command_name(current->cmd));
             }
         }
 
@@ -255,20 +255,20 @@
         {
           if (closed_command)
             {
-              line_errorf ("address@hidden' expected `%s', but saw `%s'",
-                           command_name(current->cmd),
-                           command_name(closed_command));
+              line_error ("address@hidden' expected `%s', but saw `%s'",
+                          command_name(current->cmd),
+                          command_name(closed_command));
             }
           else if (interrupting_command)
             {
-              line_errorf ("`%s' seen before @end %s",
-                           command_name(interrupting_command),
-                           command_name(current->cmd));
+              line_error ("`%s' seen before @end %s",
+                          command_name(interrupting_command),
+                          command_name(current->cmd));
             }
           else
             {
-              line_errorf ("no matching address@hidden %s'",
-                           command_name(current->cmd));
+              line_error ("no matching address@hidden %s'",
+                          command_name(current->cmd));
               // TODO: ignored conditional
             }
           current = current->parent;
@@ -381,7 +381,7 @@
     }
   else if (closed_command)
     {
-      line_errorf ("unmatched @end %s", command_name(closed_command));
+      line_error ("unmatched @end %s", command_name(closed_command));
     }
 
   return current;

Modified: trunk/parsetexi/end_line.c
===================================================================
--- trunk/parsetexi/end_line.c  2015-12-12 11:16:16 UTC (rev 6851)
+++ trunk/parsetexi/end_line.c  2015-12-12 13:45:13 UTC (rev 6852)
@@ -169,7 +169,7 @@
       /* TODO: check comment */
       break;
 clickstyle_invalid:
-      line_errorf ("@clickstyle should only accept an @-command as argument, "
+      line_error ("@clickstyle should only accept an @-command as argument, "
                    "not `%s'", line);
       break;
     default:
@@ -206,7 +206,7 @@
   cmd = line_command->cmd;
   if (arg->contents.number == 0)
     {
-      /*command_errorf (line_command, "@%s missing argument",
+      /*command_error (line_command, "@%s missing argument",
                       command_name (cmd));*/
       return 0;
     }
@@ -233,7 +233,7 @@
       else
         {
           /* Error - too many arguments. */
-          line_errorf ("superfluous argument to @%s",
+          line_error ("superfluous argument to @%s",
                        command_name (cmd));
           break;
         }
@@ -241,7 +241,7 @@
 
   if (!argarg)
     {
-      command_errorf (line_command, "@%s missing argument", command_name(cmd));
+      command_error (line_command, "@%s missing argument", command_name(cmd));
       add_extra_string (line_command, "missing_argument", "1");
       return 0;
     }
@@ -355,7 +355,7 @@
             /* Check argument is valid. */
             if (!is_decimal_number (arg))
               {
-                line_errorf ("column fraction not a number: %s", arg);
+                line_error ("column fraction not a number: %s", arg);
 
                 /* FIXME: Possible bug in the Perl version - it accepts
                    2x.2, 2.23x */
@@ -380,7 +380,7 @@
             ADD_ARG(line);
           }
         else
-          line_errorf ("@sp arg must be numeric, not `%s'", line);
+          line_error ("@sp arg must be numeric, not `%s'", line);
         break;
       }
     case CM_defindex:
@@ -415,11 +415,11 @@
 
         break;
       defindex_invalid:
-        line_errorf ("bad argument to @%s: %s",
+        line_error ("bad argument to @%s: %s",
                      command_name(cmd), line);
         break;
       defindex_reserved:
-        line_errorf ("reserved index name %s", name);
+        line_error ("reserved index name %s", name);
         break;
       }
     case CM_synindex:
@@ -450,10 +450,10 @@
         from_index = index_by_name (from);
         to_index = index_by_name (to);
         if (!from_index)
-          line_errorf ("unknown source index in @%s: %s", command_name(cmd),
+          line_error ("unknown source index in @%s: %s", command_name(cmd),
                        from);
         if (!to_index)
-          line_errorf ("unknown source index in @%s: %s", command_name(cmd),
+          line_error ("unknown source index in @%s: %s", command_name(cmd),
                        to);
 
         if (from_index && to_index) // 5606
@@ -468,7 +468,7 @@
                 from_index->merged_in = current_to;
               }
             else
-              line_warnf ("@%s leads to a merging of %s in itself, ignoring",
+              line_warn ("@%s leads to a merging of %s in itself, ignoring",
                           command_name(cmd), from);
           }
 
@@ -477,7 +477,7 @@
 
         break;
       synindex_invalid: // 5638
-        line_errorf ("bad argument to @%s: %s",
+        line_error ("bad argument to @%s: %s",
                      command_name(cmd), line);
         free (from); free (to);
         break;
@@ -488,23 +488,23 @@
         char *p = line;
         arg = read_command_name (&p);
         if (!arg || *p)
-          line_errorf ("bad argument to @printindex: %s", line);
+          line_error ("bad argument to @printindex: %s", line);
         else
           {
             INDEX *idx = index_by_name (arg);
             if (!idx)
-              line_errorf ("unknown index `%s' in @printindex", arg);
+              line_error ("unknown index `%s' in @printindex", arg);
             else
               {
                 // 5650
                 if (idx->merged_in)
-                  line_warnf
+                  line_warn
                     ("printing an index `%s' merged in another one, `%s'",
                      arg, idx->merged_in->name);
                 if (!current_node && !current_section)
                   // TODO && nothing on regions stack?
                   {
-                    line_warnf ("printindex before document beginning: "
+                    line_warn ("printindex before document beginning: "
                                 "@printindex %s", arg);
                   }
                 ADD_ARG (arg);
@@ -525,7 +525,7 @@
             ADD_ARG (line);
           }
         else
-          line_errorf ("@%s argument must be `top' or `bottom', not `%s'",
+          line_error ("@%s argument must be `top' or `bottom', not `%s'",
                        command_name(cmd), line);
 
         break;
@@ -537,7 +537,7 @@
             ADD_ARG (line);
           }
         else
-          line_errorf ("Only @fonttextsize 10 or 11 is supported, not "
+          line_error ("Only @fonttextsize 10 or 11 is supported, not "
                        "`%s'", line);
         break;
       }
@@ -548,7 +548,7 @@
             ADD_ARG(line);
           }
         else
-          line_errorf ("@footnotestyle arg must be "
+          line_error ("@footnotestyle arg must be "
                        "`separate' or `end', not `%s'", line);
         break;
       }
@@ -560,7 +560,7 @@
             ADD_ARG(line);
           }
         else
-          line_errorf ("@setchapternewpage argument must be "
+          line_error ("@setchapternewpage argument must be "
                        "`on', `off' or `odd', not `%s'", line);
         break;
       }
@@ -571,7 +571,7 @@
         if (is_decimal_number (line))
           ADD_ARG(line);
         else
-          line_errorf ("bad argument to @need: %s", line);
+          line_error ("bad argument to @need: %s", line);
 
         break;
       }
@@ -588,7 +588,7 @@
             ADD_ARG(line);
           }
         else
-          line_errorf ("@firstparagraph argument must be "
+          line_error ("@firstparagraph argument must be "
                        "`none' or `insert', not `%s'", line);
 
         break;
@@ -610,7 +610,7 @@
             ADD_ARG(line);
           }
         else
-          line_errorf ("expected @%s on or off, not `%s'", line);
+          line_error ("expected @%s on or off, not `%s'", line);
 
         break;
       }
@@ -622,7 +622,7 @@
             ADD_ARG(line);
           }
         else
-          line_errorf ("@kbdinputstyle arg must be "
+          line_error ("@kbdinputstyle arg must be "
                        "`code'/`example'/`distinct', not `%s'", line);
         break;
       }
@@ -633,7 +633,7 @@
             ADD_ARG(line);
           }
         else
-          line_errorf ("@allowcodebreaks arg must be "
+          line_error ("@allowcodebreaks arg must be "
                        "`true' or `false', not `%s'", line);
         break;
       }
@@ -645,7 +645,7 @@
             ADD_ARG(line);
           }
         else
-          line_errorf ("@urefbreakstyle arg must be "
+          line_error ("@urefbreakstyle arg must be "
                        "`after'/`before'/`none', not `%s'", line);
         break;
       }
@@ -658,7 +658,7 @@
             ADD_ARG(line);
           }
         else
-          line_errorf ("bad argument to @headings: %s", line);
+          line_error ("bad argument to @headings: %s", line);
         break;
       }
     default:
@@ -892,8 +892,8 @@
               // but we got here from t/21multitable.t on 2015.11.30.
               if (!e->cmd)
                 {
-                  command_warnf (current, "unexpected argument on @%s line:",
-                                 command_name(current->cmd));
+                  command_warn (current, "unexpected argument on @%s line:",
+                                command_name(current->cmd));
                   // TODO: Convert argument to Texinfo
                 }
               else if (e->cmd != CM_c && e->cmd != CM_comment)
@@ -1095,7 +1095,7 @@
 
       if (!text || !strcmp (text, ""))
         {
-          line_warnf ("@%s missing argument", command_name(cmd)); // 3123
+          line_warn ("@%s missing argument", command_name(cmd)); // 3123
         }
       else
         {
@@ -1112,7 +1112,7 @@
                   end_id = lookup_command (end_command);
                   if (end_id == 0 || !(command_data(end_id).flags & CF_block))
                     {
-                      command_warnf (current, "unknown @end %s", end_command);
+                      command_warn (current, "unknown @end %s", end_command);
                       free (end_command); end_command = 0;
                     }
                   else
@@ -1147,15 +1147,15 @@
                                         strdup (end_command));
                       if (line[strspn (line, whitespace_chars)] != '\0')
                         {
-                          command_errorf (current,
-                                          "superfluous argument to @end %s: "
-                                          "%s", end_command, line);
+                          command_error (current,
+                                         "superfluous argument to @end %s: "
+                                         "%s", end_command, line);
                         }
                     }
                 }
               else
                 {
-                  command_errorf (current, "bad argument to @end: %s", line);
+                  command_error (current, "bad argument to @end: %s", line);
                 }
             }
           else if (current->cmd == CM_include) // 3166
@@ -1236,8 +1236,8 @@
 
       if (current->cmd != CM_top && misc_content->contents.number == 0)
         {
-          command_warnf (current, "@%s missing argument", 
-                         command_name(current->cmd));
+          command_warn (current, "@%s missing argument", 
+                        command_name(current->cmd));
           add_extra_string (current, "missing_argument", "1");
         }
       else
@@ -1682,14 +1682,14 @@
             }
           else
             {
-              command_warnf (current->parent, "missing name for @%s",
-                             command_name (original_def_command));
+              command_warn (current->parent, "missing name for @%s",
+                            command_name (original_def_command));
             }
         }
       else
         {
-          command_warnf (current->parent, "missing category for @%s",
-                         command_name (original_def_command));
+          command_warn (current->parent, "missing category for @%s",
+                        command_name (original_def_command));
         }
 
       current = current->parent->parent; // 2868

Modified: trunk/parsetexi/errors.c
===================================================================
--- trunk/parsetexi/errors.c    2015-12-12 11:16:16 UTC (rev 6851)
+++ trunk/parsetexi/errors.c    2015-12-12 13:45:13 UTC (rev 6852)
@@ -64,22 +64,8 @@
 }
 
 void
-line_error (char *message)
+line_error (char *format, ...)
 {
-  if (!message) abort ();
-  if (error_number == error_space)
-    {
-      error_list = realloc (error_list,
-                            (error_space += 10) * sizeof (ERROR_MESSAGE));
-    }
-  error_list[error_number].message = message;
-  error_list[error_number].type = error;
-  error_list[error_number++].line_nr = line_nr; /* Field-by-field copy. */
-}
-
-void
-line_errorf (char *format, ...)
-{
   va_list v;
 
   va_start (v, format);
@@ -87,22 +73,8 @@
 }
 
 void
-line_warn (char *message)
+line_warn (char *format, ...)
 {
-  if (!message) abort ();
-  if (error_number == error_space)
-    {
-      error_list = realloc (error_list,
-                            (error_space += 10) * sizeof (ERROR_MESSAGE));
-    }
-  error_list[error_number].message = message;
-  error_list[error_number].type = warning;
-  error_list[error_number++].line_nr = line_nr; /* Field-by-field copy. */
-}
-
-void
-line_warnf (char *format, ...)
-{
   va_list v;
 
   va_start (v, format);
@@ -110,7 +82,7 @@
 }
 
 void
-command_warnf (ELEMENT *e, char *format, ...)
+command_warn (ELEMENT *e, char *format, ...)
 {
   va_list v;
 
@@ -119,7 +91,7 @@
 }
 
 void
-command_errorf (ELEMENT *e, char *format, ...)
+command_error (ELEMENT *e, char *format, ...)
 {
   va_list v;
 

Modified: trunk/parsetexi/errors.h
===================================================================
--- trunk/parsetexi/errors.h    2015-12-12 11:16:16 UTC (rev 6851)
+++ trunk/parsetexi/errors.h    2015-12-12 13:45:13 UTC (rev 6852)
@@ -1,13 +1,8 @@
-void line_error (char *message);
-void line_errorf (char *format, ...);
-void line_warn (char *message);
-void line_warnf (char *format, ...);
-void command_errorf (ELEMENT *e, char *format, ...);
-void command_warnf (ELEMENT *e, char *format, ...);
+
+void line_error (char *format, ...);
+void line_warn (char *format, ...);
+void command_error (ELEMENT *e, char *format, ...);
+void command_warn (ELEMENT *e, char *format, ...);
 void wipe_errors (void);
 
-/* TODO: remove */
-#define command_error command_errorf
-#define command_warn command_warnf
-
 char *dump_errors (void);

Modified: trunk/parsetexi/handle_commands.c
===================================================================
--- trunk/parsetexi/handle_commands.c   2015-12-12 11:16:16 UTC (rev 6851)
+++ trunk/parsetexi/handle_commands.c   2015-12-12 13:45:13 UTC (rev 6852)
@@ -246,7 +246,7 @@
                 }
               else
                 {
-                  line_errorf ("@%s not meaningful within address@hidden' 
block");
+                  line_error ("@%s not meaningful within address@hidden' 
block");
                 }
               current = begin_preformatted (current);
             }
@@ -265,7 +265,7 @@
                 }
               else
                 {
-                  line_errorf ("@%s not meaningful within address@hidden' 
block");
+                  line_error ("@%s not meaningful within address@hidden' 
block");
                   current = begin_preformatted (current);
                 }
             }
@@ -275,7 +275,7 @@
               if (cmd != CM_item && cmd != CM_headitem
                   && cmd != CM_tab)
                 {
-                  line_errorf ("@%s not meaningful inside @%s block",
+                  line_error ("@%s not meaningful inside @%s block",
                               command_name(cmd),
                               command_name(parent->cmd)); // 4521
                 }
@@ -290,8 +290,8 @@
 
                   if (max_columns == 0)
                     {
-                      line_warnf ("@%s in empty multitable",
-                                  command_name(cmd));
+                      line_warn ("@%s in empty multitable",
+                                 command_name(cmd));
                     }
                   else if (cmd == CM_tab)
                     { // 4484
@@ -303,8 +303,8 @@
                       else if (counter_value (&count_cells, row)
                                >= max_columns)
                         {
-                          line_errorf ("too many columns in multitable item"
-                                       " (max %d)", max_columns);
+                          line_error ("too many columns in multitable item"
+                                      " (max %d)", max_columns);
                         }
                       else // 4493
                         {
@@ -356,7 +356,7 @@
             }
           else
             {
-              line_errorf ("@%s outside of table or list",
+              line_error ("@%s outside of table or list",
                           command_name(cmd));
               current = begin_preformatted (current);
             }
@@ -417,7 +417,7 @@
               else
                 {
                   // error - deffnx not after deffn
-                  line_errorf ("must be after @%s to use @%s",
+                  line_error ("must be after @%s to use @%s",
                                command_name(base_command),
                                command_name(cmd));
                 }
@@ -635,10 +635,10 @@
                 }
               else if (cmd != CM_direntry)
                 {
-                  line_errorf ("@%s seen before first @node",
-                               command_name(cmd));
-                  line_errorf ("perhaps your @top node should be "
-                               "wrapped in @ifnottex rather than @ifinfo?");
+                  line_error ("@%s seen before first @node",
+                              command_name(cmd));
+                  line_error ("perhaps your @top node should be "
+                              "wrapped in @ifnottex rather than @ifinfo?");
                   // 4810 unassociated menus
                 }
             }

Modified: trunk/parsetexi/macro.c
===================================================================
--- trunk/parsetexi/macro.c     2015-12-12 11:16:16 UTC (rev 6851)
+++ trunk/parsetexi/macro.c     2015-12-12 13:45:13 UTC (rev 6852)
@@ -80,7 +80,7 @@
   name = read_command_name (&line);
   if (!name)
     {
-      line_errorf ("@%s requires a name", command_name (cmd));
+      line_error ("@%s requires a name", command_name (cmd));
       add_extra_string (macro, "invalid_syntax", "1");
       return macro;
     }
@@ -216,7 +216,7 @@
           line = new_line ();
           if (!line)
             {
-              line_errorf ("@%s missing close brace", command_name(cmd));
+              line_error ("@%s missing close brace", command_name(cmd));
               line = "\n";
               goto funexit;
             }

Modified: trunk/parsetexi/multitable.c
===================================================================
--- trunk/parsetexi/multitable.c        2015-12-12 11:16:16 UTC (rev 6851)
+++ trunk/parsetexi/multitable.c        2015-12-12 13:45:13 UTC (rev 6852)
@@ -74,7 +74,7 @@
       && last_contents_child(current)->type == ET_before_item)
     {
       if (next_command == CM_itemx)
-        line_warnf ("@itemx should not begin @%s", command_name(current->cmd));
+        line_warn ("@itemx should not begin @%s", command_name(current->cmd));
       return;
     }
 

Modified: trunk/parsetexi/parser.c
===================================================================
--- trunk/parsetexi/parser.c    2015-12-12 11:16:16 UTC (rev 6851)
+++ trunk/parsetexi/parser.c    2015-12-12 13:45:13 UTC (rev 6852)
@@ -831,7 +831,7 @@
             {
               cmd = lookup_command (command);
               if (!cmd)
-                line_errorf ("unknown command `%s'", command); // 4877
+                line_error ("unknown command `%s'", command); // 4877
             }
           free (command);
         }
@@ -917,7 +917,7 @@
                 }
               else if (*line == '@')
                 {
-                  line_errorf ("use braces to give a command as an argument "
+                  line_error ("use braces to give a command as an argument "
                                "to @%s", command_name(current->cmd));
                   current = current->parent;
                 }
@@ -931,7 +931,7 @@
                   if (current->cmd == CM_dotless
                       && *line != 'i' && *line != 'j')
                     {
-                      line_errorf ("@%s expects `i' or `j' as argument, "
+                      line_error ("@%s expects `i' or `j' as argument, "
                                    "not `%c'", *line++);
                     }
                   if (isalpha (command_name(current->cmd)[0]))
@@ -943,8 +943,8 @@
               else // 4032
                 {
                   debug ("STRANGE ACC");
-                  line_warnf ("accent command address@hidden' must not be 
followed by "
-                              "a new line", command_name(current->cmd));
+                  line_warn ("accent command address@hidden' must not be 
followed by "
+                             "a new line", command_name(current->cmd));
                 }
             }
           current = current->parent;
@@ -954,7 +954,7 @@
         {
           /* TODO: Check 'IGNORE_SPACES_AFTER_BRACED_COMMAND_NAME' config
              variable. */
-          line_errorf ("@%s expected braces",
+          line_error ("@%s expected braces",
                        command_name(current->cmd));
           current = current->parent;
         }
@@ -1004,7 +1004,7 @@
                      Texinfo::Report::gdt we deliberately pass
                      in undefined values. */
                   ELEMENT *value_elt;
-                  line_errorf ("undefined flag: %.*s", line - arg_start, 
+                  line_error ("undefined flag: %.*s", line - arg_start, 
                                arg_start);
                   value_elt = new_element (ET_NONE);
                   value_elt->cmd = CM_value;
@@ -1068,8 +1068,8 @@
                   && cmd != CM_vskip)
               || (command_data(cmd).flags & CF_in_heading)))
         {
-          line_warnf ("@%s should only appear at a line beginning",
-                      command_name(cmd));
+          line_warn ("@%s should only appear at a line beginning",
+                     command_name(cmd));
         }
 
 #if 0
@@ -1116,7 +1116,7 @@
       if (cmd == 0)
         {
           // 4287 Unknown command
-          //line_errorf ("unknown command address@hidden'",);
+          //line_error ("unknown command address@hidden'",);
           retval = 1;
           goto funexit;
         }
@@ -1164,8 +1164,16 @@
           add_to_element_contents (current, nobrace);
 
           // @\
-          // @NEWLINE
-
+          if (cmd == CM_BACKSLASH && current_context () != ct_math)
+            {
+              line_warn ("@\\ should only appear in math context");
+            }
+          if (cmd == CM_NEWLINE)
+            {
+              current = end_line (current);
+              retval = GET_A_NEW_LINE;
+              goto funexit;
+            }
         }
 #if 0
       else
@@ -1180,7 +1188,7 @@
       char separator = *line++;
       debug ("SEPARATOR: %c", separator);
       if (separator == '@')
-        /* error */;
+        line_error ("unexpected @");
       else
         current = handle_separator (current, separator, &line);
     } /* 5326 */

Modified: trunk/parsetexi/separator.c
===================================================================
--- trunk/parsetexi/separator.c 2015-12-12 11:16:16 UTC (rev 6851)
+++ trunk/parsetexi/separator.c 2015-12-12 13:45:13 UTC (rev 6852)
@@ -99,22 +99,22 @@
                     float = float->parent;
                   if (float->cmd != CM_float)
                     {
-                      line_errorf ("@%s is not meaningful outside "
-                                   "address@hidden' environment",
-                                   command_name(command));
+                      line_error ("@%s is not meaningful outside "
+                                  "address@hidden' environment",
+                                  command_name(command));
                       float = 0;
                     }
                   else
-                    line_warnf ("@%s should be right below address@hidden'", 
-                                command_name(command));
+                    line_warn ("@%s should be right below address@hidden'", 
+                               command_name(command));
                 }
               else
                 float = current->parent->parent;
               if (float)
                 {
                   if (lookup_extra_key (float, command_name(command)))
-                    line_warnf ("ignoring multiple @%s",
-                                command_name(command));
+                    line_warn ("ignoring multiple @%s",
+                               command_name(command));
                   else
                     {
                       add_extra_key_element (current->parent, "float", float);




reply via email to

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