#include "data/variable.h"
#include "language/command.h"
#include "language/lexer/lexer.h"
+#include "language/lexer/token.h"
#include "libpspp/message.h"
#include "libpspp/start-date.h"
#include "libpspp/version.h"
#include "output/driver.h"
+#include "gl/c-ctype.h"
#include "gl/xalloc.h"
#include "gettext.h"
static int
parse_title (struct lexer *lexer, void (*set_title) (const char *))
{
- if (!lex_force_string (lexer))
- return CMD_FAILURE;
- set_title (lex_tokcstr (lexer));
- lex_get (lexer);
+ if (lex_token (lexer) == T_STRING)
+ {
+ set_title (lex_tokcstr (lexer));
+ lex_get (lexer);
+ }
+ else
+ {
+ int start_ofs = lex_ofs (lexer);
+ while (lex_token (lexer) != T_ENDCMD)
+ lex_get (lexer);
+
+ /* Get the raw representation of all the tokens, including any space
+ between them, and use it as the title. */
+ char *title = lex_ofs_representation (lexer, start_ofs,
+ lex_ofs (lexer) - 1);
+ set_title (title);
+ free (title);
+ }
return CMD_SUCCESS;
}