return true;
const struct ctables_nest *n0 = &stack->nests[0];
- assert (n0->n > 0);
+ if (n0->n == 0)
+ {
+ assert (stack->n == 1);
+ return true;
+ }
+
const struct variable *v0 = n0->vars[n0->n - 1];
struct ctables_categories *c0 = t->categories[var_get_dict_index (v0)];
t->clabels_example = v0;
struct ctables_nest *nest = xmalloc (sizeof *nest);
*nest = (struct ctables_nest) { .n = 0 };
t->stacks[a] = (struct ctables_stack) { .nests = nest, .n = 1 };
+
+ /* There's no point in moving labels away from an axis that has no
+ labels, so avoid dealing with the special cases around that. */
+ t->label_axis[a] = a;
}
struct ctables_stack *stack = &t->stacks[t->summary_axis];
if (!ct->e_weight)
goto error;
}
- else if (lex_match_id (lexer, " HIDESMALLCOUNTS"))
+ else if (lex_match_id (lexer, "HIDESMALLCOUNTS"))
{
if (lex_match_id (lexer, "COUNT"))
{
}
else if (lex_match_id (lexer, "CLABELS"))
{
- while (lex_token (lexer) != T_SLASH && lex_token (lexer) != T_ENDCMD)
+ if (lex_match_id (lexer, "AUTO"))
{
- if (lex_match_id (lexer, "AUTO"))
- {
- t->label_axis[PIVOT_AXIS_ROW] = PIVOT_AXIS_ROW;
- t->label_axis[PIVOT_AXIS_COLUMN] = PIVOT_AXIS_COLUMN;
- }
- else if (lex_match_id (lexer, "ROWLABELS"))
- {
- lex_match (lexer, T_EQUALS);
- if (lex_match_id (lexer, "OPPOSITE"))
- t->label_axis[PIVOT_AXIS_ROW] = PIVOT_AXIS_COLUMN;
- else if (lex_match_id (lexer, "LAYER"))
- t->label_axis[PIVOT_AXIS_ROW] = PIVOT_AXIS_LAYER;
- else
- {
- lex_error_expecting (lexer, "OPPOSITE", "LAYER");
- goto error;
- }
- }
- else if (lex_match_id (lexer, "COLLABELS"))
+ t->label_axis[PIVOT_AXIS_ROW] = PIVOT_AXIS_ROW;
+ t->label_axis[PIVOT_AXIS_COLUMN] = PIVOT_AXIS_COLUMN;
+ }
+ else if (lex_match_id (lexer, "ROWLABELS"))
+ {
+ lex_match (lexer, T_EQUALS);
+ t->label_axis[PIVOT_AXIS_COLUMN] = PIVOT_AXIS_COLUMN;
+ if (lex_match_id (lexer, "OPPOSITE"))
+ t->label_axis[PIVOT_AXIS_ROW] = PIVOT_AXIS_COLUMN;
+ else if (lex_match_id (lexer, "LAYER"))
+ t->label_axis[PIVOT_AXIS_ROW] = PIVOT_AXIS_LAYER;
+ else
{
- lex_match (lexer, T_EQUALS);
- if (lex_match_id (lexer, "OPPOSITE"))
- t->label_axis[PIVOT_AXIS_COLUMN] = PIVOT_AXIS_ROW;
- else if (lex_match_id (lexer, "LAYER"))
- t->label_axis[PIVOT_AXIS_COLUMN] = PIVOT_AXIS_LAYER;
- else
- {
- lex_error_expecting (lexer, "OPPOSITE", "LAYER");
- goto error;
- }
+ lex_error_expecting (lexer, "OPPOSITE", "LAYER");
+ goto error;
}
+ }
+ else if (lex_match_id (lexer, "COLLABELS"))
+ {
+ lex_match (lexer, T_EQUALS);
+ t->label_axis[PIVOT_AXIS_ROW] = PIVOT_AXIS_ROW;
+ if (lex_match_id (lexer, "OPPOSITE"))
+ t->label_axis[PIVOT_AXIS_COLUMN] = PIVOT_AXIS_ROW;
+ else if (lex_match_id (lexer, "LAYER"))
+ t->label_axis[PIVOT_AXIS_COLUMN] = PIVOT_AXIS_LAYER;
else
{
- lex_error_expecting (lexer, "AUTO", "ROWLABELS",
- "COLLABELS");
+ lex_error_expecting (lexer, "OPPOSITE", "LAYER");
goto error;
}
}
+ else
+ {
+ lex_error_expecting (lexer, "AUTO", "ROWLABELS",
+ "COLLABELS");
+ goto error;
+ }
}
else if (lex_match_id (lexer, "CRITERIA"))
{