if (type == 0)
{
- lex_sbc_missing (lexer, "TYPE");
+ lex_sbc_missing ("TYPE");
goto error;
}
else if (handle == NULL)
{
- lex_sbc_missing (lexer, "OUTFILE");
+ lex_sbc_missing ("OUTFILE");
goto error;
}
else if (!replace && fn_exists (fh_get_file_name (handle)))
}
}
-/* Reports an error to the effect that subcommand SBC may only be
- specified once. */
+/* Reports an error to the effect that subcommand SBC may only be specified
+ once.
+
+ This function does not take a lexer as an argument or use lex_error(),
+ because the result would ordinarily just be redundant: "Syntax error at
+ SUBCOMMAND: Subcommand SUBCOMMAND may only be specified once.", which does
+ not help the user find the error. */
void
lex_sbc_only_once (const char *sbc)
{
msg (SE, _("Subcommand %s may only be specified once."), sbc);
}
-/* Reports an error to the effect that subcommand SBC is
- missing. */
+/* Reports an error to the effect that subcommand SBC is missing.
+
+ This function does not take a lexer as an argument or use lex_error(),
+ because a missing subcommand can normally be detected only after the whole
+ command has been parsed, and so lex_error() would always report "Syntax
+ error at end of command", which does not help the user find the error. */
void
-lex_sbc_missing (struct lexer *lexer, const char *sbc)
+lex_sbc_missing (const char *sbc)
{
- lex_error (lexer, _("missing required subcommand %s"), sbc);
+ msg (SE, _("Required subcommand %s was not specified."), sbc);
}
/* Prints a syntax error message containing the current token and
void lex_error_expecting (struct lexer *, const char *, ...) SENTINEL(0);
void lex_sbc_only_once (const char *);
-void lex_sbc_missing (struct lexer *, const char *);
+void lex_sbc_missing (const char *);
void lex_error_valist (struct lexer *, const char *, va_list)
PRINTF_FORMAT (2, 0);