X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Flexer%2Fvalue-parser.c;h=74478cfa60ac7bce5249792e38fc6f77a0504062;hb=038deb761907154dd916c6625aa20600f823a84c;hp=649bbf2498c248c57afc17a55edda014ab296e8f;hpb=bc19562deb692e6db3271eb0402e9f9c99e4cbcb;p=pspp-builds.git diff --git a/src/language/lexer/value-parser.c b/src/language/lexer/value-parser.c index 649bbf24..74478cfa 100644 --- a/src/language/lexer/value-parser.c +++ b/src/language/lexer/value-parser.c @@ -107,7 +107,7 @@ parse_number (struct lexer *lexer, double *x, const enum fmt_type *format) assert (fmt_get_category (*format) != FMT_CAT_STRING); - if (!data_in_msg (lex_tokss (lexer), C_ENCODING, *format, &v, 0, NULL)) + if (!data_in_msg (lex_tokss (lexer), "UTF-8", *format, &v, 0, NULL)) return false; lex_get (lexer); @@ -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);