+ struct ctables_axis *nest = ctables_axis_new_nonterminal (
+ CTAO_NEST, lhs, rhs, ctx->lexer, start_ofs);
+
+ const struct ctables_axis *outer_scale = find_scale (lhs);
+ const struct ctables_axis *inner_scale = find_scale (rhs);
+ if (outer_scale && inner_scale)
+ {
+ msg_at (SE, nest->loc, _("Cannot nest scale variables."));
+ msg_at (SN, outer_scale->loc, _("This is an outer scale variable."));
+ msg_at (SN, inner_scale->loc, _("This is an inner scale variable."));
+ ctables_axis_destroy (nest);
+ return NULL;
+ }
+
+ const struct ctables_axis *outer_sum = find_categorical_summary (lhs);
+ if (outer_sum)
+ {
+ msg_at (SE, nest->loc,
+ _("Summaries may only be requested for categorical variables "
+ "at the innermost nesting level."));
+ msg_at (SN, outer_sum->loc,
+ _("This outer categorical variable has a summary."));
+ ctables_axis_destroy (nest);
+ return NULL;
+ }
+
+ lhs = nest;