projects
/
pspp
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1268c4f
)
Fix parsing totals.
author
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 15 Jan 2022 06:08:52 +0000
(22:08 -0800)
committer
Ben Pfaff
<blp@cs.stanford.edu>
Sat, 2 Apr 2022 01:48:55 +0000
(18:48 -0700)
src/language/stats/ctables.c
patch
|
blob
|
history
diff --git
a/src/language/stats/ctables.c
b/src/language/stats/ctables.c
index a6de212483c92547f5ea5acd867d4322fe30e823..99efc09c5a2c339644b2981920fef47659d8f454 100644
(file)
--- a/
src/language/stats/ctables.c
+++ b/
src/language/stats/ctables.c
@@
-901,7
+901,7
@@
ctables_axis_parse_postfix (struct ctables_axis_parse_ctx *ctx)
if (!sub || !lex_match (ctx->lexer, T_LBRACK))
return sub;
if (!sub || !lex_match (ctx->lexer, T_LBRACK))
return sub;
-
bool totals = false
;
+
enum ctables_summary_variant sv = CSV_CELL
;
for (;;)
{
int start_ofs = lex_ofs (ctx->lexer);
for (;;)
{
int start_ofs = lex_ofs (ctx->lexer);
@@
-950,23
+950,20
@@
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);
struct msg_location *loc = lex_ofs_location (ctx->lexer, start_ofs,
lex_ofs (ctx->lexer) - 1);
- add_summary_spec (sub, function, percentile, label, formatp, loc,
- totals);
+ add_summary_spec (sub, function, percentile, label, formatp, loc, sv);
free (label);
msg_location_destroy (loc);
free (label);
msg_location_destroy (loc);
- if (lex_match (ctx->lexer, T_COMMA))
+ lex_match (ctx->lexer, T_COMMA);
+ if (sv == CSV_CELL && lex_match_id (ctx->lexer, "TOTALS"))
{
{
- if (!totals && lex_match_id (ctx->lexer, "TOTALS"))
- {
- if (!lex_force_match (ctx->lexer, T_LBRACK))
- goto error;
- totals = true;
- }
+ if (!lex_force_match (ctx->lexer, T_LBRACK))
+ goto error;
+ sv = CSV_TOTAL;
}
else if (lex_force_match (ctx->lexer, T_RBRACK))
{
}
else if (lex_force_match (ctx->lexer, T_RBRACK))
{
- if (
totals
&& !lex_force_match (ctx->lexer, T_RBRACK))
+ if (
sv == CSV_TOTAL
&& !lex_force_match (ctx->lexer, T_RBRACK))
goto error;
return sub;
}
goto error;
return sub;
}