X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Flexer%2Fmacro.h;h=db6edd83a9d67f14724288ef47dbb68742a5f0aa;hb=f41e87501f3a3c600f4443033799b1689f84270a;hp=40e8d0853405f1db7c2a053c3fed895b2b7ba927;hpb=82e6fde7bd3bde18dca346519cfc7f6f2bf740e0;p=pspp diff --git a/src/language/lexer/macro.h b/src/language/lexer/macro.h index 40e8d08534..db6edd83a9 100644 --- a/src/language/lexer/macro.h +++ b/src/language/lexer/macro.h @@ -25,6 +25,8 @@ #include "language/lexer/segment.h" #include "language/lexer/token.h" +struct msg_location; + /* A token along with the syntax that was tokenized to produce it. The syntax allows the token to be turned back into syntax accurately. */ struct macro_token @@ -55,9 +57,6 @@ void macro_tokens_uninit (struct macro_tokens *); struct macro_token *macro_tokens_add_uninit (struct macro_tokens *); void macro_tokens_add (struct macro_tokens *, const struct macro_token *); -void macro_tokens_from_string (struct macro_tokens *, const struct substring, - enum segmenter_mode); - void macro_tokens_to_syntax (struct macro_tokens *, struct string *, size_t *ofs, size_t *len); @@ -79,12 +78,10 @@ struct macro_param ARG_CMDEND } arg_type; - union - { - int n_tokens; /* ARG_N_TOKENS. */ - struct token charend; /* ARG_CHAREND. */ - struct token enclose[2]; /* ARG_ENCLOSE. */ - }; + + int n_tokens; /* ARG_N_TOKENS only. */ + struct token start; /* ARG_ENCLOSE only. */ + struct token end; /* ARG_ENCLOSE and ARG_CHAREND only. */ }; /* A macro. */ @@ -94,9 +91,7 @@ struct macro char *name; /* Source code location of macro definition, for error reporting. */ - char *file_name; - int first_line; - int last_line; + struct msg_location *location; /* Parameters. */ struct macro_param *params; @@ -131,11 +126,12 @@ macro_set_is_empty (const struct macro_set *set) struct macro_call; int macro_call_create (const struct macro_set *, const struct token *, - struct macro_call **); -int macro_call_add (struct macro_call *, const struct macro_token *); + struct macro_call **); +int macro_call_add (struct macro_call *, const struct macro_token *, + const struct msg_location *); void macro_call_expand (struct macro_call *, enum segmenter_mode segmenter_mode, - struct macro_tokens *); + const struct msg_location *call_loc, struct macro_tokens *); void macro_call_destroy (struct macro_call *);