projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
!quote, !unquote
[pspp]
/
src
/
language
/
lexer
/
format-parser.c
diff --git
a/src/language/lexer/format-parser.c
b/src/language/lexer/format-parser.c
index 45a0b4b1e32d1c4cb473cfcdc810d3add3c52361..906d0f327168c5508f16859f46c52c3684987334 100644
(file)
--- a/
src/language/lexer/format-parser.c
+++ b/
src/language/lexer/format-parser.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2010, 2011
, 2012
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-16,13
+16,14
@@
#include <config.h>
#include <config.h>
+#include "language/lexer/format-parser.h"
+
#include <ctype.h>
#include <stdint.h>
#include <stdlib.h>
#include "data/format.h"
#include "data/variable.h"
#include <ctype.h>
#include <stdint.h>
#include <stdlib.h>
#include "data/format.h"
#include "data/variable.h"
-#include "language/lexer/format-parser.h"
#include "language/lexer/lexer.h"
#include "libpspp/message.h"
#include "libpspp/misc.h"
#include "language/lexer/lexer.h"
#include "libpspp/message.h"
#include "libpspp/misc.h"
@@
-34,13
+35,13
@@
static bool
parse_abstract_format_specifier__ (struct lexer *lexer,
char type[FMT_TYPE_LEN_MAX + 1],
static bool
parse_abstract_format_specifier__ (struct lexer *lexer,
char type[FMT_TYPE_LEN_MAX + 1],
-
int *width, in
t *decimals)
+
uint16_t *width, uint8_
t *decimals)
{
struct substring s;
struct substring type_ss, width_ss, decimals_ss;
bool has_decimals;
{
struct substring s;
struct substring type_ss, width_ss, decimals_ss;
bool has_decimals;
- if (lex_token (lexer) != T_ID)
+ if (lex_token (lexer) != T_ID
&& lex_token (lexer) != T_STRING
)
goto error;
/* Extract pieces. */
goto error;
/* Extract pieces. */
@@
-90,7
+91,7
@@
error:
bool
parse_abstract_format_specifier (struct lexer *lexer,
char type[FMT_TYPE_LEN_MAX + 1],
bool
parse_abstract_format_specifier (struct lexer *lexer,
char type[FMT_TYPE_LEN_MAX + 1],
-
int *width, in
t *decimals)
+
uint16_t *width, uint8_
t *decimals)
{
bool ok = parse_abstract_format_specifier__ (lexer, type, width, decimals);
if (ok)
{
bool ok = parse_abstract_format_specifier__ (lexer, type, width, decimals);
if (ok)
@@
-117,6
+118,13
@@
parse_format_specifier (struct lexer *lexer, struct fmt_spec *format)
return false;
}
return false;
}
+ if (format->w == 0 && !strchr (lex_tokcstr (lexer), '0'))
+ {
+ msg (SE, _("Format specifier `%s' lacks required width."),
+ lex_tokcstr (lexer));
+ return false;
+ }
+
lex_get (lexer);
return true;
}
lex_get (lexer);
return true;
}