diff options
author | andmarti1424 <andmarti@gmail.com> | 2017-04-30 21:33:44 -0300 |
---|---|---|
committer | andmarti1424 <andmarti@gmail.com> | 2017-04-30 21:33:44 -0300 |
commit | 4e572890674782ea239b36d17e8ae9e67dc7a960 (patch) | |
tree | a5794d24aac9f9e1b7bb6d4a353cf5e03a40adcc /src/gram.y | |
parent | 9085e988dec7902a1e6a63b45a16ea91b5c22dc1 (diff) |
Added subtotals feature. Still to handle multiple subtotals levels.
Diffstat (limited to 'src/gram.y')
-rwxr-xr-x | src/gram.y | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -24,6 +24,7 @@ #include "shift.h" #include "clipboard.h" #include "plot.h" +#include "subtotal.h" void yyerror(char *err); // error routine for yacc (gram.y) int yylex(); @@ -91,6 +92,8 @@ token S_DELETECOL token S_YANKCOL */ %token S_DATEFMT +%token S_SUBTOTAL +%token S_RSUBTOTAL %token S_FORMAT %token S_FMT %token S_LET @@ -529,7 +532,18 @@ command: | S_FREEZE COL { add_frange(lookat(0, $2), lookat(0, $2), 'c'); } | S_SORT range STRING { sortrange($2.left.vp, $2.right.vp, $3); - //scxfree($3); + //scxfree($3); + //do not free here + } + | S_SUBTOTAL range COL STRING COL { + subtotal($2.left.vp->row, $2.left.vp->col, $2.right.vp->row, + $2.right.vp->col, $3, $4, $5, 0); + scxfree($4); + } + | S_RSUBTOTAL range COL STRING COL { + subtotal($2.left.vp->row, $2.left.vp->col, $2.right.vp->row, + $2.right.vp->col, $3, $4, $5, 1); + scxfree($4); } | S_FILTERON range { enable_filters($2.left.vp, $2.right.vp); } @@ -725,7 +739,9 @@ command: | S_SEVAL e { seval_result = seval(NULL, $2); // TODO make sure this seval_result is always freed afterwards efree($2); } - | S_ERROR STRING { sc_error($2); } + | S_ERROR STRING { sc_error($2); + //free $2 + } | // nothing | error { |