struct macro_expander;
+struct macro_token
+ {
+ struct token token;
+ struct substring representation;
+ };
+
+void macro_token_copy (struct macro_token *, const struct macro_token *);
+void macro_token_uninit (struct macro_token *);
+
+struct macro_tokens
+ {
+ struct macro_token *mts;
+ size_t n;
+ size_t allocated;
+ };
+
+void macro_tokens_copy (struct macro_tokens *, const struct macro_tokens *);
+void macro_tokens_uninit (struct macro_tokens *);
+void macro_tokens_add (struct macro_tokens *, const struct macro_token *);
+
+void macro_tokens_print (const struct macro_tokens *, FILE *);
+
struct macro_param
{
bool positional; /* Is this a positional parameter? */
char *name; /* "!1" or "!name". */
- struct tokens def; /* Default expansion. */
+ struct macro_tokens def; /* Default expansion. */
bool expand_arg; /* Macro-expand the argument? */
enum
struct macro_param *params;
size_t n_params;
- struct substring body;
- struct tokens body_tokens;
+ struct macro_tokens body;
};
void macro_destroy (struct macro *);
struct macro_expander **);
void macro_expander_destroy (struct macro_expander *);
-int macro_expander_add (struct macro_expander *, const struct token *);
+int macro_expander_add (struct macro_expander *, const struct macro_token *);
-void macro_expander_get_expansion (struct macro_expander *, struct tokens *);
+void macro_expander_get_expansion (struct macro_expander *, struct macro_tokens *);
#endif /* macro.h */