Make the expression code a little nicer and fix bugs found
[pspp] / src / vars-prs.c
index 8b15fd7bc91a8a1f44156788554028452ee58320..21340ef031d1dddcb2503355b41b5bb475473acc 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <config.h>
 #include "var.h"
-#include <assert.h>
 #include <ctype.h>
 #include <stdlib.h>
 #include "alloc.h"
@@ -105,12 +104,14 @@ dict_class_to_name (enum dict_class dict_class)
       return _("scratch");
     default:
       assert (0);
+      abort ();
     }
 }
 
 /* Parses a set of variables from dictionary D given options
    OPTS.  Resulting list of variables stored in *VAR and the
-   number of variables into *CNT. */
+   number of variables into *CNT.  Returns nonzero only if
+   successful. */
 int
 parse_variables (struct dictionary *d, struct variable ***var, int *cnt,
                  int opts) 
@@ -392,7 +393,8 @@ parse_DATA_LIST_vars (char ***names, int *nnames, int pv_opts)
          lex_error ("expecting variable name");
          goto fail;
        }
-      if (tokid[0] == '#' && (pv_opts & PV_NO_SCRATCH))
+      if (dict_class_from_id (tokid) == DC_SCRATCH
+          && (pv_opts & PV_NO_SCRATCH))
        {
          msg (SE, _("Scratch variables not allowed here."));
          goto fail;