+static bool
+macro_expand_arg (const struct token *token, const struct macro_expander *me,
+ struct macro_tokens *exp)
+{
+ if (!me || token->type != T_MACRO_ID)
+ return false;
+
+ /* Macro arguments. */
+ if (me->macro)
+ {
+ const struct macro_param *param = macro_find_parameter_by_name (
+ me->macro, token->string);
+ if (param)
+ {
+ macro_expand_arg__ (me, param - me->macro->params, exp);
+ return true;
+ }
+ else if (ss_equals (token->string, ss_cstr ("!*")))
+ {
+ for (size_t j = 0; j < me->macro->n_params; j++)
+ macro_expand_arg__ (me, j, exp);
+ return true;
+ }
+ }
+
+ /* Variables set by !DO or !LET. */
+ const char *var = stringi_map_find__ (me->vars, token->string.string,
+ token->string.length);
+ if (var)
+ {
+ macro_tokens_from_string (exp, ss_cstr (var),
+ me->segmenter_mode, me->stack);
+ return true;
+ }
+
+ return false;
+}
+