}
else
{
- char *s = xasprintf ("`%s'", token_type_to_string (type));
- lex_error_expecting (lexer, s, NULL_SENTINEL);
- free (s);
+ const char *type_string = token_type_to_string (type);
+ if (type_string)
+ {
+ char *s = xasprintf ("`%s'", type_string);
+ lex_error_expecting (lexer, s, NULL_SENTINEL);
+ free (s);
+ }
+ else
+ lex_error_expecting (lexer, token_type_to_name (type), NULL_SENTINEL);
+
return false;
}
}
lex_match (lexer, T_EQUALS);
str = lex_tokcstr (lexer);
- fn = strdup (str);
+ if (str)
+ fn = strdup (str);
- if (!lex_force_match (lexer, T_STRING))
+ if (!lex_force_match (lexer, T_STRING) || str == NULL)
goto error;
lex_match (lexer, T_SLASH);
AT_CHECK([sed 's/^\(..........\).*/\1/' stdout], [0], [-rw-r--r--
])
AT_CLEANUP
+
+
+
+AT_SETUP([PERMISSIONS - bad syntax])
+AT_DATA([pe.sps], [[PERMI|SIONS /FILE='foobar' PERMISSIONS=WRITEABLE.
+]])
+
+AT_CHECK([pspp -O format=csv pe.sps], [1], [dnl
+pe.sps:1.6: error: PERMISSIONS: Syntax error at `|': expecting STRING.
+])
+AT_CLEANUP