if (e)
{
- msg (SE, _("%s subcommand may be given at most once."), "COLUMN");
+ lex_sbc_only_once ("COLUMN");
expr_free (e);
return CMD_CASCADING_FAILURE;
}
goto done;
if (!lex_match (lexer, T_EQUALS))
{
- msg (SE, _("`=' expected after variable list."));
+ lex_error_expecting (lexer, "`='", NULL_SENTINEL);
goto done;
}
if (!parse_DATA_LIST_vars (lexer, dict, &new_names, &nn,
if (!lex_match (lexer, T_LPAREN))
{
- msg (SE, _("`(' expected after variable list."));
+ lex_error_expecting (lexer, "`('", NULL_SENTINEL);
goto fail;
}
if (!parse_format_specifier (lexer, &f)
if (!lex_match (lexer, T_RPAREN))
{
- msg (SE, _("`)' expected after output format."));
+ lex_error_expecting (lexer, "`)'", NULL_SENTINEL);
goto fail;
}
if (already_encountered & 1)
{
- msg (SE, _("%s subcommand may be given at most once."), "REORDER");
+ lex_sbc_only_once ("REORDER");
goto done;
}
already_encountered |= 1;
{
if (!lex_match (lexer, T_LPAREN))
{
- msg (SE, _("`(' expected on %s subcommand."), "REORDER");
+ lex_error_expecting (lexer, "`('", NULL_SENTINEL);
free (v);
goto done;
}
}
if (!lex_match (lexer, T_RPAREN))
{
- msg (SE, _("`)' expected following variable names on "
- "REORDER subcommand."));
+ lex_error_expecting (lexer, "`)'", NULL_SENTINEL);
free (v);
goto done;
}
{
if (already_encountered & 2)
{
- msg (SE, _("%s subcommand may be given at most once."), "RENAME");
+ lex_sbc_only_once ("RENAME");
goto done;
}
already_encountered |= 2;
if (!lex_match (lexer, T_LPAREN))
{
- msg (SE, _("`(' expected on %s subcommand."), "RENAME");
+ lex_error_expecting (lexer, "`('", NULL_SENTINEL);
goto done;
}
if (!parse_variables (lexer, dataset_dict (ds),
goto done;
if (!lex_match (lexer, T_EQUALS))
{
- msg (SE, _("`=' expected between lists of new and old variable "
- "names on RENAME subcommand."));
+ lex_error_expecting (lexer, "`='", NULL_SENTINEL);
goto done;
}
if (!parse_DATA_LIST_vars (lexer, dataset_dict (ds),
}
if (!lex_match (lexer, T_RPAREN))
{
- msg (SE, _("`)' expected after variable lists on RENAME "
- "subcommand."));
+ lex_error_expecting (lexer, "`)'", NULL_SENTINEL);
goto done;
}
}
break;
if (lex_token (lexer) != T_SLASH)
{
- msg (SE, _("`/' or `.' expected."));
+ lex_error_expecting (lexer, "`/'", "`.'", NULL_SENTINEL);
goto done;
}
lex_get (lexer);
if (!lex_match (lexer, T_RPAREN))
{
- msg (SE, _("`)' expected after output format."));
+ lex_error_expecting (lexer, "`)'", NULL_SENTINEL);
goto fail;
}
}
size_t prev_nv_1 = rename_cnt;
size_t prev_nv_2 = rename_cnt;
- if (!lex_match (lexer, T_LPAREN))
- {
- msg (SE, _("`(' expected."));
- goto lossage;
- }
+ if (!lex_force_match (lexer, T_LPAREN))
+ goto lossage;
if (!parse_variables (lexer, dataset_dict (ds), &rename_vars, &rename_cnt,
PV_APPEND | PV_NO_DUPLICATE))
goto lossage;
- if (!lex_match (lexer, T_EQUALS))
- {
- msg (SE, _("`=' expected between lists of new and old variable names."));
- goto lossage;
- }
+ if (!lex_force_match (lexer, T_EQUALS))
+ goto lossage;
if (!parse_DATA_LIST_vars (lexer, dataset_dict (ds),
&rename_new_names, &prev_nv_1,
PV_APPEND | PV_NO_DUPLICATE))
rename_new_names = NULL;
goto lossage;
}
- if (!lex_match (lexer, T_RPAREN))
- {
- msg (SE, _("`)' expected after variable names."));
- goto lossage;
- }
+ if (!lex_force_match (lexer, T_RPAREN))
+ goto lossage;
}
while (lex_token (lexer) != T_ENDCMD);
break;
else if (!lex_match (lexer, T_COMMA))
{
- lex_error_expecting (lexer, ",", ")", NULL_SENTINEL);
+ lex_error_expecting (lexer, "`,'", "`)'", NULL_SENTINEL);
goto fail;
}
}
{
dump (1, "if (!lex_match (lexer, T_LPAREN))");
dump (1, "{");
- dump (0, "msg (SE, _(\"`(' expected after %s "
- "specifier of %s subcommand.\"));",
- s->specname, sbc->name);
- dump (0, "goto lossage;");
+ dump (0, "lex_error_expecting (lexer, \"`('\", "
+ "NULL_SENTINEL);");
+ dump (0, "goto lossage;");
dump (-1, "}");
outdent ();
}
if (s->value == VAL_INT)
{
- dump (1, "if (!lex_is_integer (lexer))");
- dump (1, "{");
- dump (0, "msg (SE, _(\"%s specifier of %s subcommand "
- "requires an integer argument.\"));",
- s->specname, sbc->name);
+ dump (1, "if (!lex_force_int (lexer))");
dump (0, "goto lossage;");
- dump (-1, "}");
dump (-1, "p->%s%s = lex_integer (lexer);",
sbc->prefix, st_lower (s->valname));
}
else if (s->value == VAL_DBL)
{
- dump (1, "if (!lex_is_number (lexer))");
- dump (1, "{");
- dump (0, "msg (SE, _(\"Number expected after %s "
- "specifier of %s subcommand.\"));",
- s->specname, sbc->name);
+ dump (1, "if (!lex_force_num (lexer))");
dump (0, "goto lossage;");
- dump (-1, "}");
dump (-1, "p->%s%s = lex_tokval (lexer);", sbc->prefix,
st_lower (s->valname));
}
if (s->valtype == VT_PAREN)
{
- dump (1, "if (!lex_match (lexer, T_RPAREN))");
- dump (1, "{");
- dump (0, "msg (SE, _(\"`)' expected after argument for "
- "%s specifier of %s.\"));",
- s->specname, sbc->name);
+ dump (1, "if (!lex_force_match (lexer, T_RPAREN))");
dump (0, "goto lossage;");
- dump (-1, "}");
outdent ();
if (s->optvalue)
{
{
dump (1, "if (p->sbc_%s > 1)", st_lower (sbc->name));
dump (1, "{");
- dump (0, "msg (SE, _(\"%s subcommand may be given only once.\"));",
- sbc->name);
+ dump (0, "lex_sbc_only_once (\"%s\");", sbc->name);
dump (0, "goto lossage;");
dump (-1, "}");
outdent ();
{
dump (0, "if ( 0 == p->sbc_%s)", st_lower (sbc->name));
dump (1, "{");
- dump (0, "msg (SE, _(\"%s subcommand must be given.\"));",
- sbc->name);
+ dump (0, "lex_sbc_missing (\"%s\");", sbc->name);
dump (0, "goto lossage;");
dump (-1, "}");
dump_blank_line (0);
if (!lex_match (lexer, T_RPAREN))
{
free (v);
- msg (SE, _("`)' expected after GROUPED interval list."));
+ lex_error_expecting (lexer, "`)'", NULL_SENTINEL);
return 0;
}
}
npt->missing++;
if (npt->missing > 1)
{
- msg (SE, _("The %s subcommand may be given only once."), "MISSING");
+ lex_sbc_only_once ("MISSING");
goto lossage;
}
while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD)
npt->method++;
if (npt->method > 1)
{
- msg (SE, _("The %s subcommand may be given only once."), "METHOD");
+ lex_sbc_only_once ("METHOD");
goto lossage;
}
switch (npar_method (lexer, nps))
direction = SC_ASCEND;
else
{
- msg (SE, _("`A' or `D' expected inside parentheses."));
- goto error;
- }
- if (!lex_match (lexer, T_RPAREN))
- {
- msg (SE, _("`)' expected."));
+ lex_error_expecting (lexer, "A", "D", NULL_SENTINEL);
goto error;
}
+ if (!lex_force_match (lexer, T_RPAREN))
+ goto error;
if (saw_direction != NULL)
*saw_direction = true;
}
if (tt.n_vars == 0 && tt.mode != MODE_PAIRED)
{
- msg (SE, _("One or more VARIABLES must be specified."));
+ lex_sbc_missing ("VARIABLES");
goto parse_failed;
}
#include "data/settings.h"
#include "language/command.h"
#include "language/lexer/lexer.h"
+#include "libpspp/cast.h"
#include "libpspp/i18n.h"
#include "libpspp/message.h"
#include "libpspp/misc.h"
}
else
{
- msg (SE, _("Expecting %s or %s."), "WRITEABLE", "READONLY");
+ lex_error_expecting (lexer, "WRITEABLE", "READONLY", NULL_SENTINEL);
goto error;
}
CROSSTABS.
])
AT_CHECK([pspp -O format=csv q2c.sps], [1], [dnl
-q2c.sps:8: error: EXAMINE: VARIABLES subcommand must be given.
+q2c.sps:8: error: EXAMINE: Required subcommand VARIABLES was not specified.
q2c.sps:9.7: error: ONEWAY: Syntax error at end of command: expecting variable name.
-q2c.sps:10: error: CROSSTABS: TABLES subcommand must be given.
+q2c.sps:10: error: CROSSTABS: Required subcommand TABLES was not specified.
])
AT_CLEANUP
T-TEST /groups=id(3) .
])
AT_CHECK([pspp -O format=csv t-test.sps], [1], [dnl
-t-test.sps:11: error: T-TEST: One or more VARIABLES must be specified.
+t-test.sps:11: error: T-TEST: Required subcommand VARIABLES was not specified.
-t-test.sps:12: error: T-TEST: One or more VARIABLES must be specified.
+t-test.sps:12: error: T-TEST: Required subcommand VARIABLES was not specified.
])
AT_CLEANUP