enum mc_state
{
- /* Error state. */
- MC_ERROR,
-
/* Accumulating tokens in mc->params toward the end of any type of
argument. */
MC_ARG,
mc->param->name, mc->macro->name);
free (expected_s);
- mc->state = MC_ERROR;
- return -1;
+ return mc_finished (mc);
}
static int
mc_enclose (struct macro_call *mc, const struct macro_token *mt,
const struct msg_location *loc)
{
- mc->n_tokens++;
-
const struct token *token = &mt->token;
const struct macro_param *p = mc->param;
if (token_equal (&p->start, token))
{
+ mc->n_tokens++;
+
struct macro_tokens **argp = &mc->args[p - mc->macro->params];
*argp = xzalloc (sizeof **argp);
mc->state = MC_ARG;
{
struct macro_tokens **argp = &mc->args[p - mc->macro->params];
if (*argp)
- {
- mc_error (mc, loc,
- _("Argument %s multiply specified in call to macro %s."),
- p->name, mc->macro->name);
- mc->state = MC_ERROR;
- return -1;
- }
+ mc_error (mc, loc,
+ _("Argument %s multiply specified in call to macro %s."),
+ p->name, mc->macro->name);
*argp = xzalloc (sizeof **argp);
mc->param = p;
mc_equals (struct macro_call *mc, const struct macro_token *mt,
const struct msg_location *loc)
{
- const struct token *token = &mt->token;
- mc->n_tokens++;
-
- if (token->type == T_EQUALS)
+ if (mt->token.type == T_EQUALS)
{
+ mc->n_tokens++;
mc->state = mc->param->arg_type == ARG_ENCLOSE ? MC_ENCLOSE : MC_ARG;
return 0;
}
{
switch (mc->state)
{
- case MC_ERROR:
- return -1;
-
case MC_ARG:
return mc_add_arg (mc, mt, loc);