return false;
}
+static bool
+parse_settings_value_show (struct lexer *lexer, const char *name,
+ enum settings_value_show *show)
+{
+ if (lex_match_id (lexer, name))
+ {
+ if (!lex_force_match (lexer, T_EQUALS))
+ exit (1);
+
+ if (lex_match_id (lexer, "DEFAULT"))
+ *show = SETTINGS_VALUE_SHOW_DEFAULT;
+ else if (lex_match_id (lexer, "VALUE"))
+ *show = SETTINGS_VALUE_SHOW_VALUE;
+ else if (lex_match_id (lexer, "LABEL"))
+ *show = SETTINGS_VALUE_SHOW_LABEL;
+ else if (lex_match_id (lexer, "BOTH"))
+ *show = SETTINGS_VALUE_SHOW_BOTH;
+ else
+ {
+ lex_error_expecting (lexer, "DEFAULT", "VALUE", "LABEL", "BOTH");
+ exit (1);
+ }
+
+ return true;
+ }
+ else
+ return false;
+}
+
+static bool
+parse_string_setting (struct lexer *lexer, const char *name, char **stringp)
+{
+ if (lex_match_id (lexer, name))
+ {
+ lex_match (lexer, T_EQUALS);
+ if (!lex_force_string (lexer))
+ exit (1);
+
+ free (*stringp);
+ *stringp = xstrdup (lex_tokcstr (lexer));
+
+ lex_get (lexer);
+ return true;
+ }
+ else
+ return false;
+}
+
static void
read_look (struct lexer *lexer, struct pivot_table *pt)
{
&& !parse_bool_setting (lexer, "TOPCONTINUATION", "YES", "NO",
&look->top_continuation)
&& !parse_bool_setting (lexer, "BOTTOMCONTINUATION", "YES", "NO",
- &look->bottom_continuation))
+ &look->bottom_continuation)
+ && !parse_string_setting (lexer, "CONTINUATION",
+ &look->continuation))
break;
}
pivot_table_set_look (pt, look);
exit (1);
}
+static bool
+parse_value_setting (struct lexer *lexer, const char *name,
+ struct pivot_value **valuep)
+{
+ if (lex_match_id (lexer, name))
+ {
+ lex_match (lexer, T_EQUALS);
+
+ pivot_value_destroy (*valuep);
+ *valuep = read_value (lexer);
+
+ return true;
+ }
+ else
+ return false;
+}
+
static void
read_border (struct lexer *lexer, struct pivot_table *pt)
{
{
lex_match (lexer, T_EQUALS);
while (lex_token (lexer) == T_ID)
- if (!parse_bool_setting (lexer, "GRID", "YES", "NO",
- &pt->show_grid_lines)
- && !parse_bool_setting (lexer, "CAPTION", "YES", "NO",
- &pt->show_caption)
- && !parse_bool_setting (lexer, "TITLE", "YES", "NO",
- &pt->show_caption))
+ {
+ if (parse_bool_setting (lexer, "GRID", "YES", "NO",
+ &pt->show_grid_lines)
+ || parse_bool_setting (lexer, "CAPTION", "YES", "NO",
+ &pt->show_caption)
+ || parse_bool_setting (lexer, "TITLE", "YES", "NO",
+ &pt->show_title))
+ continue;
+
+ if (parse_settings_value_show (lexer, "VALUES", &pt->show_values)
+ || parse_settings_value_show (lexer, "VARIABLES",
+ &pt->show_variables))
+ continue;
+
break;
+ }
+ }
+ else if (parse_value_setting (lexer, "TITLE", &pt->title)
+ || parse_value_setting (lexer, "SUBTYPE", &pt->subtype)
+ || parse_value_setting (lexer, "CORNER", &pt->corner_text)
+ || parse_value_setting (lexer, "CAPTION", &pt->caption)
+ || parse_string_setting (lexer, "NOTES", &pt->notes))
+ {
+ /* Nothing. */
}
else if (lex_match_id (lexer, "BORDER"))
read_border (lexer, pt);