.representation = ss_buffer (&src->buffer[start - src->tail],
end - start),
};
+ src->middle += middle_ofs + 1;
n_call = macro_expander_add (me, &mt);
+ src->middle -= middle_ofs + 1;
}
if (n_call < 0)
{
const struct lex_token *call_first
= &src->tokens[src->middle & (src->capacity - 1)];
const struct lex_token *call_last
- = &src->tokens[(src->middle + n_call) & (src->capacity - 1)];
+ = &src->tokens[(src->middle + n_call - 1) & (src->capacity - 1)];
size_t call_pos = call_first->token_pos;
size_t call_len = (call_last->token_pos + call_last->token_len) - call_pos;
size_t line_pos = call_first->line_pos;
if (is_macro_keyword (var_name)
|| macro_find_parameter_by_name (me->macro, var_name))
{
- printf ("cannot use argument name or macro keyword as !LET variable\n");
+ printf ("cannot use argument name or macro keyword %.*s as !LET variable\n", (int) var_name.length, var_name.string);
return 0;
}
p++;
if (is_macro_keyword (var_name)
|| macro_find_parameter_by_name (me->macro, var_name))
{
- printf ("cannot use argument name or macro keyword as !DO variable\n");
+ printf ("cannot use argument name or macro keyword %.*s as !DO variable\n", (int) var_name.length, var_name.string);
return 0;
}
p++;
!for2 x=1 y=5.
])
AT_CHECK([pspp --testing-mode define.sps], [0], [dnl
-cannot use argument name or macro keyword as !DO variable
-cannot use argument name or macro keyword as !DO variable
+cannot use argument name or macro keyword !x as !DO variable
+cannot use argument name or macro keyword !noexpand as !DO variable
!DO 1 = 1 !TO 5 !var !DOEND.
!DO !noexpand = 1 !TO 5 !var !DOEND.
!ENDDEFINE.
DEBUG EXPAND.
-!macro 1.
+!macro x=1.
!macro2.
])
AT_CHECK([pspp --testing-mode define.sps -O format=csv], [0], [dnl
-cannot use argument name or macro keyword as !LET variable
-cannot use argument name or macro keyword as !LET variable
+cannot use argument name or macro keyword !x as !LET variable
+cannot use argument name or macro keyword !do as !LET variable
expected macro variable name following !DO
-!LET =
+!LET 1 = 1
!LET !do = x
])