if (!lex_force_id (lexer))
goto done;
+ int name_ofs = lex_ofs (lexer);
name = xstrdup (lex_tokcstr (lexer));
lex_get (lexer);
}
else
{
- lex_error (lexer, _("expecting number or string"));
+ lex_error (lexer, _("Syntax error expecting number or string."));
goto done;
}
v = dict_create_var (d, name, width);
if (v == NULL)
{
- msg (SE, _("Duplicate variable name %s."), name);
+ lex_ofs_error (lexer, name_ofs, name_ofs,
+ _("Duplicate variable name %s."), name);
value_destroy (&value, width);
goto done;
}
else if (lex_match_id (lexer, "FORMAT"))
{
lex_match (lexer, T_EQUALS);
- if (!parse_format_specifier (lexer, &format)
- || !fmt_check_output (&format)
- || !fmt_check_type_compat (&format, VAL_NUMERIC))
+ if (!parse_format_specifier (lexer, &format))
goto done;
+ char *error = fmt_check_output__ (format);
+ if (!error)
+ error = fmt_check_type_compat__ (format, NULL, VAL_NUMERIC);
+ if (error)
+ {
+ lex_next_error (lexer, -1, -1, "%s", error);
+ free (error);
+ goto done;
+ }
has_format = true;
}
else
if (has_format)
{
char *output = data_out (&(const union value) { .f = d },
- NULL, &format,
+ NULL, format,
settings_get_fmt_settings ());
output_log ("%s => %s", title, output);
free (output);