CTABLES
[pspp] / src / language / lexer / macro.h
index 40e8d0853405f1db7c2a053c3fed895b2b7ba927..4a6f73dff97cb12b7c657c162615c14384e893c4 100644 (file)
@@ -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
@@ -79,12 +81,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 +94,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 +129,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 *);