else if (parse_macro_function (ctx, &args, ss_cstr ("!concat"), 1, INT_MAX,
input_consumed))
{
- struct string s;
- bool all_strings = true;
+ struct string s = DS_EMPTY_INITIALIZER;
for (size_t i = 0; i < args.n; i++)
{
if (args.mts[i].token.type == T_STRING)
ds_put_substring (&s, args.mts[i].token.string);
else
- {
- all_strings = false;
- ds_put_substring (&s, args.mts[i].representation);
- }
+ ds_put_substring (&s, args.mts[i].representation);
}
- if (all_strings)
- {
- *output = (struct macro_token) {
- .token = { .type = T_STRING, .string = s.ss },
- };
- output->representation = ss_cstr (token_to_string (&output->token));
- }
- else
- {
- *output = (struct macro_token) {
- .token = { .type = T_MACRO_ID /*XXX*/, .string = s.ss },
- };
- ss_alloc_substring (&output->representation, s.ss);
- }
+ *output = (struct macro_token) {
+ .token = { .type = T_MACRO_ID /*XXX*/, .string = s.ss },
+ };
+ ss_alloc_substring (&output->representation, s.ss);
}
else if (parse_macro_function (ctx, &args, ss_cstr ("!quote"), 1, 1,
input_consumed))
else
macro_token_copy (output, &args.mts[0]);
}
+ else if (ctx->n_input > 0
+ && ctx->input[0].token.type == T_MACRO_ID
+ && ss_equals_case (ctx->input[0].token.string, ss_cstr ("!null")))
+ {
+ *input_consumed = 1;
+ *output = (struct macro_token) {
+ .token = { .type = T_MACRO_ID /* XXX*/ },
+ };
+ ss_alloc_substring (&output->token.string, ss_cstr (""));
+ return true;
+ }
else
return false;