X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Flexer%2Fvalue-parser.c;h=74478cfa60ac7bce5249792e38fc6f77a0504062;hb=a8b84a10b8749b3e2ecbfa0b73deb97e1b682d4e;hp=ff2701e8dadfb586b64a791367de731177b00563;hpb=9ade26c8349b4434008c46cf09bc7473ec743972;p=pspp diff --git a/src/language/lexer/value-parser.c b/src/language/lexer/value-parser.c index ff2701e8da..74478cfa60 100644 --- a/src/language/lexer/value-parser.c +++ b/src/language/lexer/value-parser.c @@ -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);