Merge 'master' into 'gtk3'.
[pspp] / src / language / lexer / value-parser.c
index ff2701e8dadfb586b64a791367de731177b00563..9d3d77f91656efee82cb8eac2d8b14b298a97ef1 100644 (file)
@@ -62,9 +62,9 @@ parse_num_range (struct lexer *lexer,
       if (*y < *x)
         {
           double t;
-          msg (SW, _("Low end of range (%g) is below high end (%g).  "
-                     "The range will be treated as reversed."),
-               *x, *y);
+          msg (SW, _("The high end of the range (%g) is below the low end (%g).  "
+                     "The range will be treated as if reversed."),
+               *y, *x);
           t = *x;
           *x = *y;
           *y = t;
@@ -129,18 +129,15 @@ parse_number (struct lexer *lexer, double *x, const enum fmt_type *format)
     }
 }
 
-/* Parses the current token from LEXER into value V, which must
-   already have been initialized with the specified WIDTH.
-   Returns true if successful, false otherwise. */
+/* Parses the current token from LEXER into value V, which must already have
+   been initialized with the specified VAR's WIDTH.  Returns true if
+   successful, false otherwise. */
 bool
-parse_value (struct lexer *lexer, union value *v, int width)
+parse_value (struct lexer *lexer, union value *v, const struct variable *var)
 {
+  int width = var_get_width (var);
   if (width == 0)
-    {
-      if (!lex_force_num (lexer))
-       return false;
-      v->f = lex_tokval (lexer);
-    }
+    return parse_number (lexer, &v->f, &var_get_print_format (var)->type);
   else if (lex_force_string (lexer))
     {
       const char *s = lex_tokcstr (lexer);