Some basic macros and tests work.
[pspp] / src / language / lexer / lexer.c
index 5ff5099652ac0405eebb02c45bd94622e216239b..f577c598b89c9bf5a0ce939e94476feef5cfd417 100644 (file)
@@ -1694,9 +1694,10 @@ lex_source_get (const struct lex_source *src_)
     {
       if (!lex_source_get__ (src))
         {
-          /* This should not be reachable because we always get a T_STOP at the
-             end of input and the macro_expander should always terminate
-             expansion on T_STOP. */
+          /* This should not be reachable because we always get a T_ENDCMD at
+             the end of an input file (transformed from T_STOP by
+             lex_source_try_get()) and the macro_expander should always
+             terminate expansion on T_ENDCMD. */
           NOT_REACHED ();
         }
 
@@ -1723,6 +1724,15 @@ lex_source_get (const struct lex_source *src_)
   macro_expander_get_expansion (me, &expansion);
   macro_expander_destroy (me);
 
+  if (settings_get_mprint ())
+    {
+      struct string mprint = DS_EMPTY_INITIALIZER;
+      macro_tokens_to_representation (&expansion, &mprint);
+      output_item_submit (text_item_create (TEXT_ITEM_LOG, ds_cstr (&mprint),
+                                            _("Macro Expansion")));
+      ds_destroy (&mprint);
+    }
+
   for (size_t i = 0; i < expansion.n; i++)
     {
       *lex_push_token__ (src) = (struct lex_token) {