#include "language/lexer/macro.h"
#include "language/lexer/scan.h"
#include "language/lexer/token.h"
+#include "libpspp/message.h"
#include "gl/xalloc.h"
}
static bool
-match_macro_id (struct lexer *lexer, const char *id)
+match_macro_id (struct lexer *lexer, const char *keyword)
{
- if (id[0] != '!')
- return lex_match_id (lexer, id);
+ if (keyword[0] != '!')
+ return lex_match_id (lexer, keyword);
else if (lex_token (lexer) == T_MACRO_ID
- && ss_equals_case (lex_tokss (lexer), ss_cstr (id)))
+ && lex_id_match_n (ss_cstr (keyword), lex_tokss (lexer), 4))
{
lex_get (lexer);
return true;
struct substring s = lex_tokss (lexer);
struct string_lexer slex;
string_lexer_init (&slex, s.string, s.length, SEG_MODE_INTERACTIVE);
- struct token another_token;
+ struct token another_token = { .type = T_STOP };
if (!string_lexer_next (&slex, token)
|| string_lexer_next (&slex, &another_token))
{
settings_set_mprint (true);
while (lex_token (lexer) != T_STOP)
- lex_get (lexer);
+ {
+ if (!lex_next_is_from_macro (lexer, 0) && lex_token (lexer) != T_ENDCMD)
+ {
+ struct substring rep = lex_next_representation (lexer, 0, 0);
+ msg (MN, "unexpanded token \"%.*s\"", (int) rep.length, rep.string);
+ }
+ lex_get (lexer);
+ }
return CMD_SUCCESS;
}