Replace syntactical keywords in error/warning messages by printf directives
[pspp] / src / language / dictionary / rename-variables.c
index 90117ff69ede1ea6a33b1cb7a4aa65761dbe0ba3..f7cd9c1a613ad3f7a4ccc1078dea9a37ff034ee7 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2010, 2011 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 
 #include <stdlib.h>
 
-#include <data/dictionary.h>
-#include <data/procedure.h>
-#include <data/variable.h>
-#include <language/command.h>
-#include <language/lexer/lexer.h>
-#include <language/lexer/variable-parser.h>
-#include <libpspp/hash.h>
-#include <libpspp/message.h>
-#include <libpspp/str.h>
+#include "data/dataset.h"
+#include "data/dictionary.h"
+#include "data/variable.h"
+#include "language/command.h"
+#include "language/lexer/lexer.h"
+#include "language/lexer/variable-parser.h"
+#include "libpspp/message.h"
+#include "libpspp/str.h"
 
-#include "xalloc.h"
+#include "gl/xalloc.h"
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -46,28 +45,24 @@ cmd_rename_variables (struct lexer *lexer, struct dataset *ds)
   int status = CMD_CASCADING_FAILURE;
 
   if (proc_make_temporary_transformations_permanent (ds))
-    msg (SE, _("RENAME VARS may not be used after TEMPORARY.  "
-               "Temporary transformations will be made permanent."));
+    msg (SE, _("%s may not be used after %s.  "
+               "Temporary transformations will be made permanent."), "RENAME VARS", "TEMPORARY");
 
   do
     {
       size_t prev_nv_1 = rename_cnt;
       size_t prev_nv_2 = rename_cnt;
 
-      if (!lex_match (lexer, '('))
-       {
-         msg (SE, _("`(' expected."));
-         goto lossage;
-       }
+      if (!lex_force_match (lexer, T_LPAREN))
+        goto lossage;
       if (!parse_variables (lexer, dataset_dict (ds), &rename_vars, &rename_cnt,
                            PV_APPEND | PV_NO_DUPLICATE))
        goto lossage;
-      if (!lex_match (lexer, '='))
-       {
-         msg (SE, _("`=' expected between lists of new and old variable names."));
-         goto lossage;
-       }
-      if (!parse_DATA_LIST_vars (lexer, &rename_new_names, &prev_nv_1, PV_APPEND))
+      if (!lex_force_match (lexer, T_EQUALS))
+        goto lossage;
+      if (!parse_DATA_LIST_vars (lexer, dataset_dict (ds),
+                                 &rename_new_names, &prev_nv_1,
+                                 PV_APPEND | PV_NO_DUPLICATE))
        goto lossage;
       if (prev_nv_1 != rename_cnt)
        {
@@ -82,13 +77,10 @@ cmd_rename_variables (struct lexer *lexer, struct dataset *ds)
          rename_new_names = NULL;
          goto lossage;
        }
-      if (!lex_match (lexer, ')'))
-       {
-         msg (SE, _("`)' expected after variable names."));
-         goto lossage;
-       }
+      if (!lex_force_match (lexer, T_RPAREN))
+        goto lossage;
     }
-  while (lex_token (lexer) != '.');
+  while (lex_token (lexer) != T_ENDCMD);
 
   if (!dict_rename_vars (dataset_dict (ds),
                          rename_vars, rename_new_names, rename_cnt,