X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Flexer%2Flexer.c;h=f577c598b89c9bf5a0ce939e94476feef5cfd417;hb=db57300f720b0916461aad06cec4d268481f06e0;hp=5ff5099652ac0405eebb02c45bd94622e216239b;hpb=c94be33beb7085e1cbb1ec47f0e3a49c896d443b;p=pspp diff --git a/src/language/lexer/lexer.c b/src/language/lexer/lexer.c index 5ff5099652..f577c598b8 100644 --- a/src/language/lexer/lexer.c +++ b/src/language/lexer/lexer.c @@ -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) {