#include <unistd.h>
#include "data/dataset.h"
-#include "data/file-name.h"
#include "data/session.h"
#include "language/command.h"
#include "language/lexer/include-path.h"
if (lex_match_id (lexer, "FILE"))
lex_match (lexer, T_EQUALS);
- /* File name can be identifier or string. */
- if (lex_token (lexer) != T_ID && !lex_is_string (lexer))
- {
- lex_error (lexer, _("expecting file name"));
- return CMD_FAILURE;
- }
+ if (!lex_force_string_or_id (lexer))
+ return CMD_FAILURE;
+
+ relative_name = utf8_to_filename (lex_tokcstr (lexer));
+ if (NULL == relative_name)
+ return CMD_FAILURE;
- relative_name = utf8_to_filename (lex_tokcstr (lexer));
filename = include_path_search (relative_name);
free (relative_name);
free (encoding);
encoding = xstrdup (lex_tokcstr (lexer));
+ lex_get (lexer);
}
else if (variant == INSERT && lex_match_id (lexer, "SYNTAX"))
{
syntax_mode = LEX_SYNTAX_AUTO;
else
{
- lex_error_expecting (lexer, "BATCH", "INTERACTIVE", "AUTO",
- NULL_SENTINEL);
+ lex_error_expecting (lexer, "BATCH", "INTERACTIVE", "AUTO");
goto exit;
}
}
}
else
{
- lex_error_expecting (lexer, "YES", "NO", NULL_SENTINEL);
+ lex_error_expecting (lexer, "YES", "NO");
goto exit;
}
}
}
else
{
- lex_error_expecting (lexer, "CONTINUE", "STOP", NULL_SENTINEL);
+ lex_error_expecting (lexer, "CONTINUE", "STOP");
goto exit;
}
}