CTABLES: Stop parsing after a summary spec error.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 28 May 2023 06:17:32 +0000 (23:17 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 28 May 2023 06:17:32 +0000 (23:17 -0700)
src/language/commands/ctables.c
tests/language/commands/ctables.at

index 36fcca64c7d1f81be1d5b5e78f91bcf1f2dab4f7..78b5616c1f3610add4c472c1f91ce93d15e411e7 100644 (file)
@@ -1383,11 +1383,14 @@ ctables_axis_parse_postfix (struct ctables_axis_parse_ctx *ctx)
 
       struct msg_location *loc = lex_ofs_location (ctx->lexer, start_ofs,
                                                    lex_ofs (ctx->lexer) - 1);
-      add_summary_spec (sub, function, weighting, area, percentile, label,
-                        formatp, is_ctables_format, loc, sv);
+      bool ok = add_summary_spec (sub, function, weighting, area, percentile,
+                                  label, formatp, is_ctables_format, loc, sv);
       free (label);
       msg_location_destroy (loc);
 
+      if (!ok)
+        goto error;
+
       lex_match (ctx->lexer, T_COMMA);
       if (sv == CSV_CELL && lex_match_id (ctx->lexer, "TOTALS"))
         {
index 001eea6ea8139f964bc4ab378dc160ab8c2039af..d0bf368fecd537a4241df9f69401f0b8a00bb62c 100644 (file)
@@ -286,10 +286,6 @@ ctables.sps:15.16-15.18: note: CTABLES: 'QN1' is not a scale variable.
    15 | CTABLES /TABLE qn1 [MEAN TOTALS].
       |                ^~~
 
-ctables.sps:15.32: error: CTABLES: Syntax error expecting `@<:@'.
-   15 | CTABLES /TABLE qn1 [MEAN TOTALS].
-      |                                ^
-
 ctables.sps:16.21-16.24: error: CTABLES: Summary function MEAN applies only to
 scale variables.
    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
@@ -299,10 +295,6 @@ ctables.sps:16.16-16.18: note: CTABLES: 'QN1' is not a scale variable.
    16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
       |                ^~~
 
-ctables.sps:16.40: error: CTABLES: Syntax error expecting `@:>@'.
-   16 | CTABLES /TABLE qn1 [MEAN TOTALS[STDDEV]%].
-      |                                        ^
-
 ctables.sps:17.56: error: CTABLES: Syntax error expecting string.
    17 | CTABLES /TABLE qn1 /CATEGORIES VARIABLES=qn1 [SUBTOTAL=x].
       |                                                        ^