From 3bb26972920e4de5b7962076e6eda434b59f0f25 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 27 May 2023 23:17:32 -0700 Subject: [PATCH] CTABLES: Stop parsing after a summary spec error. --- src/language/commands/ctables.c | 7 +++++-- tests/language/commands/ctables.at | 8 -------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/language/commands/ctables.c b/src/language/commands/ctables.c index 36fcca64c7..78b5616c1f 100644 --- a/src/language/commands/ctables.c +++ b/src/language/commands/ctables.c @@ -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")) { diff --git a/tests/language/commands/ctables.at b/tests/language/commands/ctables.at index 001eea6ea8..d0bf368fec 100644 --- a/tests/language/commands/ctables.at +++ b/tests/language/commands/ctables.at @@ -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]. | ^ -- 2.30.2