/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2007 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2007, 2010 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
lex_get (lexer);
- while ( '.' != lex_token (lexer))
+ while ( T_ENDCMD != lex_token (lexer))
{
if (lex_match_id (lexer, "SYNTAX"))
{
- lex_match (lexer, '=');
+ lex_match (lexer, T_EQUALS);
if ( lex_match_id (lexer, "INTERACTIVE") )
syntax_mode = GETL_INTERACTIVE;
else if ( lex_match_id (lexer, "BATCH"))
syntax_mode = GETL_BATCH;
else
{
- lex_error(lexer,
- _("Expecting BATCH or INTERACTIVE after SYNTAX."));
+ lex_error (lexer, _("expecting %s or %s after %s"),
+ "BATCH", "INTERACTIVE", "SYNTAX");
return CMD_FAILURE;
}
}
else if (lex_match_id (lexer, "CD"))
{
- lex_match (lexer, '=');
+ lex_match (lexer, T_EQUALS);
if ( lex_match_id (lexer, "YES") )
{
cd = true;
}
else
{
- lex_error (lexer, _("Expecting YES or NO after CD."));
+ lex_error (lexer, _("expecting %s or %s after %s"),
+ "YES", "NO", "CD");
return CMD_FAILURE;
}
}
else if (lex_match_id (lexer, "ERROR"))
{
- lex_match (lexer, '=');
+ lex_match (lexer, T_EQUALS);
if ( lex_match_id (lexer, "CONTINUE") )
{
error_mode = ERRMODE_CONTINUE;
}
else
{
- lex_error (lexer, _("Expecting CONTINUE or STOP after ERROR."));
+ lex_error (lexer, _("expecting %s or %s after %s"),
+ "CONTINUE", "STOP", "ERROR");
return CMD_FAILURE;
}
}
static int
parse_insert (struct lexer *lexer, char **filename)
{
- char *target_fn;
+ const char *target_fn;
char *relative_filename;
/* Skip optional FILE=. */
if (lex_match_id (lexer, "FILE"))
- lex_match (lexer, '=');
+ lex_match (lexer, T_EQUALS);
/* File name can be identifier or string. */
- if (lex_token (lexer) != T_ID && lex_token (lexer) != T_STRING)
+ if (lex_token (lexer) != T_ID && !lex_is_string (lexer))
{
lex_error (lexer, _("expecting file name"));
return CMD_FAILURE;
}
- target_fn = ds_cstr (lex_tokstr (lexer));
+ target_fn = lex_tokcstr (lexer);
relative_filename =
fn_search_path (target_fn,