From 68c9dfef7d2b78399ae8a446a3236d81ef1c8e4f Mon Sep 17 00:00:00 2001 From: John Kerl Date: Sun, 15 Nov 2015 19:24:14 -0700 Subject: [PATCH] int-math UTs --- c/mapping/lrec_evaluators.c | 34 +- c/mapping/mlr_val.c | 30 +- c/reg_test/expected/out | 3748 +++++++++++++++++++++++++---- c/reg_test/input/Makefile.am | 1 + c/reg_test/input/mixed-types.xtab | 10 + c/reg_test/run | 464 +++- c/todo.txt | 16 +- doc/content-for-reference.html | 5 +- doc/mlr.1.premade | 7 +- doc/reference.html | 4 +- 10 files changed, 3791 insertions(+), 528 deletions(-) create mode 100644 c/reg_test/input/mixed-types.xtab diff --git a/c/mapping/lrec_evaluators.c b/c/mapping/lrec_evaluators.c index e34ca2b3d..d484ee11d 100644 --- a/c/mapping/lrec_evaluators.c +++ b/c/mapping/lrec_evaluators.c @@ -179,6 +179,34 @@ lrec_evaluator_t* lrec_evaluator_alloc_from_n_n_func(mv_unary_func_t* pfunc, lre return pevaluator; } +// ---------------------------------------------------------------- +typedef struct _lrec_evaluator_i_i_state_t { + mv_unary_func_t* pfunc; + lrec_evaluator_t* parg1; +} lrec_evaluator_i_i_state_t; + +mv_t lrec_evaluator_i_i_func(lrec_t* prec, context_t* pctx, void* pvstate) { + lrec_evaluator_i_i_state_t* pstate = pvstate; + mv_t val1 = pstate->parg1->pevaluator_func(prec, pctx, pstate->parg1->pvstate); + + mt_get_int_nullable(&val1); + NULL_OR_ERROR_OUT(val1); + + return pstate->pfunc(&val1); +} + +lrec_evaluator_t* lrec_evaluator_alloc_from_i_i_func(mv_unary_func_t* pfunc, lrec_evaluator_t* parg1) { + lrec_evaluator_i_i_state_t* pstate = mlr_malloc_or_die(sizeof(lrec_evaluator_i_i_state_t)); + pstate->pfunc = pfunc; + pstate->parg1 = parg1; + + lrec_evaluator_t* pevaluator = mlr_malloc_or_die(sizeof(lrec_evaluator_t)); + pevaluator->pvstate = pstate; + pevaluator->pevaluator_func = lrec_evaluator_i_i_func; + + return pevaluator; +} + // ---------------------------------------------------------------- typedef struct _lrec_evaluator_f_ff_state_t { mv_binary_func_t* pfunc; @@ -257,11 +285,11 @@ lrec_evaluator_t* lrec_evaluator_alloc_from_n_nn_func(mv_binary_func_t* pfunc, mv_t lrec_evaluator_n_nn_nullable_func(lrec_t* prec, context_t* pctx, void* pvstate) { lrec_evaluator_f_ff_state_t* pstate = pvstate; mv_t val1 = pstate->parg1->pevaluator_func(prec, pctx, pstate->parg1->pvstate); - mt_get_float_nullable(&val1); + mt_get_number_nullable(&val1); ERROR_OUT(val1); mv_t val2 = pstate->parg2->pevaluator_func(prec, pctx, pstate->parg2->pvstate); - mt_get_float_nullable(&val2); + mt_get_number_nullable(&val2); ERROR_OUT(val2); return pstate->pfunc(&val1, &val2); @@ -1305,7 +1333,7 @@ lrec_evaluator_t* lrec_evaluator_alloc_from_unary_func_name(char* fnnm, lrec_eva if (streq(fnnm, "!")) { return lrec_evaluator_alloc_from_b_b_func(b_b_not_func, parg1); } else if (streq(fnnm, "+")) { return lrec_evaluator_alloc_from_n_n_func(n_n_upos_func, parg1); } else if (streq(fnnm, "-")) { return lrec_evaluator_alloc_from_n_n_func(n_n_uneg_func, parg1); - } else if (streq(fnnm, "~")) { return lrec_evaluator_alloc_from_n_n_func(i_i_bitwise_not_func, parg1); + } else if (streq(fnnm, "~")) { return lrec_evaluator_alloc_from_i_i_func(i_i_bitwise_not_func, parg1); } else if (streq(fnnm, "abs")) { return lrec_evaluator_alloc_from_n_n_func(n_n_abs_func, parg1); } else if (streq(fnnm, "acos")) { return lrec_evaluator_alloc_from_f_f_func(f_f_acos_func, parg1); } else if (streq(fnnm, "acosh")) { return lrec_evaluator_alloc_from_f_f_func(f_f_acosh_func, parg1); diff --git a/c/mapping/mlr_val.c b/c/mapping/mlr_val.c index 1c1f7c0be..3d7d6fd95 100644 --- a/c/mapping/mlr_val.c +++ b/c/mapping/mlr_val.c @@ -895,6 +895,7 @@ static mv_t divide_f_if(mv_t* pa, mv_t* pb) { static mv_t divide_i_ii(mv_t* pa, mv_t* pb) { double a = (double)pa->u.intv; double b = (double)pb->u.intv; + // Pythonic division, not C division. mv_t rv = {.type = MT_FLOAT, .u.fltv = a / b}; return rv; } @@ -934,9 +935,23 @@ static mv_t int_divide_f_if(mv_t* pa, mv_t* pb) { return rv; } static mv_t int_divide_i_ii(mv_t* pa, mv_t* pb) { - double a = (double)pa->u.intv; - double b = (double)pb->u.intv; - mv_t rv = {.type = MT_FLOAT, .u.fltv = floor(a / b)}; + long long a = pa->u.intv; + long long b = pb->u.intv; + // Pythonic division, not C division. + long long q = a / b; + long long r = a % b; + if (a < 0) { + if (b > 0) { + if (r != 0) + q--; + } + } else { + if (b < 0) { + if (r != 0) + q--; + } + } + mv_t rv = {.type = MT_INT, .u.intv = q}; return rv; } @@ -961,25 +976,26 @@ static mv_t mod_e_xx(mv_t* pa, mv_t* pb) { static mv_t mod_f_ff(mv_t* pa, mv_t* pb) { double a = pa->u.fltv; double b = pb->u.fltv; - mv_t rv = {.type = MT_FLOAT, .u.fltv = floor(a / b)}; + mv_t rv = {.type = MT_FLOAT, .u.fltv = a - b * floor(a / b)}; return rv; } static mv_t mod_f_fi(mv_t* pa, mv_t* pb) { double a = pa->u.fltv; double b = (double)pb->u.intv; - mv_t rv = {.type = MT_FLOAT, .u.fltv = floor(a / b)}; + mv_t rv = {.type = MT_FLOAT, .u.fltv = a - b * floor(a / b)}; return rv; } static mv_t mod_f_if(mv_t* pa, mv_t* pb) { double a = (double)pa->u.intv; double b = pb->u.fltv; - mv_t rv = {.type = MT_FLOAT, .u.fltv = floor(a / b)}; + mv_t rv = {.type = MT_FLOAT, .u.fltv = a - b * floor(a / b)}; return rv; } static mv_t mod_i_ii(mv_t* pa, mv_t* pb) { long long a = pa->u.intv; long long b = pb->u.intv; long long u = a % b; + // Pythonic division, not C division. if (a >= 0LL) { if (b < 0LL) { u += b; @@ -989,7 +1005,7 @@ static mv_t mod_i_ii(mv_t* pa, mv_t* pb) { u += b; } } - mv_t rv = {.type = MT_FLOAT, .u.fltv = u}; + mv_t rv = {.type = MT_INT, .u.intv = u}; return rv; } diff --git a/c/reg_test/expected/out b/c/reg_test/expected/out index 1b096919a..1b7cbb6b1 100644 --- a/c/reg_test/expected/out +++ b/c/reg_test/expected/out @@ -3838,7 +3838,1815 @@ bin_lo bin_hi x_count y_count ================================================================ -DSLs +DSL OPERATOR ASSOCIATIVITY + +mlr put -v $x = 1 || 2 || 3 /dev/null += (operator): + x (field_name). + || (operator): + || (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 || 2 || 3 /dev/null +|| (operator): + || (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ^^ 2 ^^ 3 /dev/null += (operator): + x (field_name). + ^^ (operator): + ^^ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 ^^ 2 ^^ 3 /dev/null +^^ (operator): + ^^ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 && 2 && 3 /dev/null += (operator): + x (field_name). + && (operator): + && (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 && 2 && 3 /dev/null +&& (operator): + && (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 == 2 == 3 /dev/null += (operator): + x (field_name). + == (operator): + == (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 == 2 == 3 /dev/null +== (operator): + == (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 != 2 != 3 /dev/null += (operator): + x (field_name). + != (operator): + != (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 != 2 != 3 /dev/null +!= (operator): + != (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 =~ 2 =~ 3 /dev/null += (operator): + x (field_name). + =~ (operator): + =~ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 =~ 2 =~ 3 /dev/null +=~ (operator): + =~ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 !=~ 2 !=~ 3 /dev/null += (operator): + x (field_name). + !=~ (operator): + !=~ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 !=~ 2 !=~ 3 /dev/null +!=~ (operator): + !=~ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 == 2 != 3 /dev/null += (operator): + x (field_name). + != (operator): + == (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 == 2 != 3 /dev/null +!= (operator): + == (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 != 2 == 3 /dev/null += (operator): + x (field_name). + == (operator): + != (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 != 2 == 3 /dev/null +== (operator): + != (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 < 2 < 3 /dev/null += (operator): + x (field_name). + < (operator): + < (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 < 2 < 3 /dev/null +< (operator): + < (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 <= 2 <= 3 /dev/null += (operator): + x (field_name). + <= (operator): + <= (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 <= 2 <= 3 /dev/null +<= (operator): + <= (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 > 2 > 3 /dev/null += (operator): + x (field_name). + > (operator): + > (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 > 2 > 3 /dev/null +> (operator): + > (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 >= 2 >= 3 /dev/null += (operator): + x (field_name). + >= (operator): + >= (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 >= 2 >= 3 /dev/null +>= (operator): + >= (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 < 2 <= 3 /dev/null += (operator): + x (field_name). + <= (operator): + < (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 < 2 <= 3 /dev/null +<= (operator): + < (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 <= 2 < 3 /dev/null += (operator): + x (field_name). + < (operator): + <= (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 <= 2 < 3 /dev/null +< (operator): + <= (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 | 2 | 3 /dev/null += (operator): + x (field_name). + | (operator): + | (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 | 2 | 3 /dev/null +| (operator): + | (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ^ 2 ^ 3 /dev/null += (operator): + x (field_name). + ^ (operator): + ^ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 ^ 2 ^ 3 /dev/null +^ (operator): + ^ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 & 2 & 3 /dev/null += (operator): + x (field_name). + & (operator): + & (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 & 2 & 3 /dev/null +& (operator): + & (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 | 2 & 3 /dev/null += (operator): + x (field_name). + | (operator): + 1 (literal). + & (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 | 2 & 3 /dev/null +| (operator): + 1 (literal). + & (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 | 2 ^ 3 /dev/null += (operator): + x (field_name). + | (operator): + 1 (literal). + ^ (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 | 2 ^ 3 /dev/null +| (operator): + 1 (literal). + ^ (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ^ 2 | 3 /dev/null += (operator): + x (field_name). + | (operator): + ^ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 ^ 2 | 3 /dev/null +| (operator): + ^ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ^ 2 & 3 /dev/null += (operator): + x (field_name). + ^ (operator): + 1 (literal). + & (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 ^ 2 & 3 /dev/null +^ (operator): + 1 (literal). + & (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 & 2 | 3 /dev/null += (operator): + x (field_name). + | (operator): + & (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 & 2 | 3 /dev/null +| (operator): + & (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 & 2 ^ 3 /dev/null += (operator): + x (field_name). + ^ (operator): + & (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 & 2 ^ 3 /dev/null +^ (operator): + & (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 << 2 << 3 /dev/null += (operator): + x (field_name). + << (operator): + << (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 << 2 << 3 /dev/null +<< (operator): + << (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 >> 2 >> 3 /dev/null += (operator): + x (field_name). + >> (operator): + >> (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 >> 2 >> 3 /dev/null +>> (operator): + >> (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 << 2 >> 3 /dev/null += (operator): + x (field_name). + >> (operator): + << (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 << 2 >> 3 /dev/null +>> (operator): + << (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 >> 2 << 3 /dev/null += (operator): + x (field_name). + << (operator): + >> (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 >> 2 << 3 /dev/null +<< (operator): + >> (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 + 2 + 3 /dev/null += (operator): + x (field_name). + + (operator): + + (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 + 2 + 3 /dev/null ++ (operator): + + (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 - 2 - 3 /dev/null += (operator): + x (field_name). + - (operator): + - (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 - 2 - 3 /dev/null +- (operator): + - (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 + 2 - 3 /dev/null += (operator): + x (field_name). + - (operator): + + (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 + 2 - 3 /dev/null +- (operator): + + (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 - 2 + 3 /dev/null += (operator): + x (field_name). + + (operator): + - (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 - 2 + 3 /dev/null ++ (operator): + - (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 . 2 . 3 /dev/null += (operator): + x (field_name). + . (operator): + . (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 . 2 . 3 /dev/null +. (operator): + . (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 * 2 * 3 /dev/null += (operator): + x (field_name). + * (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 * 2 * 3 /dev/null +* (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 / 2 / 3 /dev/null += (operator): + x (field_name). + / (operator): + / (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 / 2 / 3 /dev/null +/ (operator): + / (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 // 2 // 3 /dev/null += (operator): + x (field_name). + // (operator): + // (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 // 2 // 3 /dev/null +// (operator): + // (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 % 2 % 3 /dev/null += (operator): + x (field_name). + % (operator): + % (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 % 2 % 3 /dev/null +% (operator): + % (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ** 2 ** 3 /dev/null += (operator): + x (field_name). + ** (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 ** 2 ** 3 /dev/null +** (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 * 2 / 3 /dev/null += (operator): + x (field_name). + / (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 * 2 / 3 /dev/null +/ (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 * 2 // 3 /dev/null += (operator): + x (field_name). + // (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 * 2 // 3 /dev/null +// (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 * 2 % 3 /dev/null += (operator): + x (field_name). + % (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 * 2 % 3 /dev/null +% (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 * 2 ** 3 /dev/null += (operator): + x (field_name). + * (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 * 2 ** 3 /dev/null +* (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 / 2 * 3 /dev/null += (operator): + x (field_name). + * (operator): + / (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 / 2 * 3 /dev/null +* (operator): + / (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 / 2 // 3 /dev/null += (operator): + x (field_name). + // (operator): + / (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 / 2 // 3 /dev/null +// (operator): + / (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 / 2 % 3 /dev/null += (operator): + x (field_name). + % (operator): + / (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 / 2 % 3 /dev/null +% (operator): + / (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 / 2 ** 3 /dev/null += (operator): + x (field_name). + / (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 / 2 ** 3 /dev/null +/ (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 // 2 * 3 /dev/null += (operator): + x (field_name). + * (operator): + // (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 // 2 * 3 /dev/null +* (operator): + // (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 // 2 / 3 /dev/null += (operator): + x (field_name). + / (operator): + // (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 // 2 / 3 /dev/null +/ (operator): + // (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 // 2 % 3 /dev/null += (operator): + x (field_name). + % (operator): + // (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 // 2 % 3 /dev/null +% (operator): + // (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 // 2 ** 3 /dev/null += (operator): + x (field_name). + // (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 // 2 ** 3 /dev/null +// (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 % 2 * 3 /dev/null += (operator): + x (field_name). + * (operator): + % (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 % 2 * 3 /dev/null +* (operator): + % (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 % 2 / 3 /dev/null += (operator): + x (field_name). + / (operator): + % (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 % 2 / 3 /dev/null +/ (operator): + % (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 % 2 // 3 /dev/null += (operator): + x (field_name). + // (operator): + % (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 % 2 // 3 /dev/null +// (operator): + % (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 % 2 ** 3 /dev/null += (operator): + x (field_name). + % (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 % 2 ** 3 /dev/null +% (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ** 2 * 3 /dev/null += (operator): + x (field_name). + * (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 ** 2 * 3 /dev/null +* (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ** 2 / 3 /dev/null += (operator): + x (field_name). + / (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 ** 2 / 3 /dev/null +/ (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ** 2 // 3 /dev/null += (operator): + x (field_name). + // (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 ** 2 // 3 /dev/null +// (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ** 2 % 3 /dev/null += (operator): + x (field_name). + % (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 ** 2 % 3 /dev/null +% (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + + +================================================================ +DSL OPERATOR PRECEDENCE + +mlr put -v $x = 1 || 2 ^^ 3 /dev/null += (operator): + x (field_name). + || (operator): + 1 (literal). + ^^ (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 || 2 ^^ 3 /dev/null +|| (operator): + 1 (literal). + ^^ (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 || 2 && 3 /dev/null += (operator): + x (field_name). + || (operator): + 1 (literal). + && (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 || 2 && 3 /dev/null +|| (operator): + 1 (literal). + && (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ^^ 2 || 3 /dev/null += (operator): + x (field_name). + || (operator): + ^^ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 ^^ 2 || 3 /dev/null +|| (operator): + ^^ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ^^ 2 && 3 /dev/null += (operator): + x (field_name). + ^^ (operator): + 1 (literal). + && (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 ^^ 2 && 3 /dev/null +^^ (operator): + 1 (literal). + && (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 && 2 || 3 /dev/null += (operator): + x (field_name). + || (operator): + && (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 && 2 || 3 /dev/null +|| (operator): + && (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 && 2 ^^ 3 /dev/null += (operator): + x (field_name). + ^^ (operator): + && (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 && 2 ^^ 3 /dev/null +^^ (operator): + && (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 == 2 <= 3 /dev/null += (operator): + x (field_name). + == (operator): + 1 (literal). + <= (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 == 2 <= 3 /dev/null +== (operator): + 1 (literal). + <= (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 <= 2 == 3 /dev/null += (operator): + x (field_name). + == (operator): + <= (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 <= 2 == 3 /dev/null +== (operator): + <= (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 <= 2 | 3 /dev/null += (operator): + x (field_name). + <= (operator): + 1 (literal). + | (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 <= 2 | 3 /dev/null +<= (operator): + 1 (literal). + | (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 | 2 <= 3 /dev/null += (operator): + x (field_name). + <= (operator): + | (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 | 2 <= 3 /dev/null +<= (operator): + | (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 | 2 ^ 3 /dev/null += (operator): + x (field_name). + | (operator): + 1 (literal). + ^ (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 | 2 ^ 3 /dev/null +| (operator): + 1 (literal). + ^ (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ^ 2 | 3 /dev/null += (operator): + x (field_name). + | (operator): + ^ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 ^ 2 | 3 /dev/null +| (operator): + ^ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ^ 2 & 3 /dev/null += (operator): + x (field_name). + ^ (operator): + 1 (literal). + & (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 ^ 2 & 3 /dev/null +^ (operator): + 1 (literal). + & (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 & 2 ^ 3 /dev/null += (operator): + x (field_name). + ^ (operator): + & (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 & 2 ^ 3 /dev/null +^ (operator): + & (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 & 2 << 3 /dev/null += (operator): + x (field_name). + & (operator): + 1 (literal). + << (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 & 2 << 3 /dev/null +& (operator): + 1 (literal). + << (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 << 2 & 3 /dev/null += (operator): + x (field_name). + & (operator): + << (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 << 2 & 3 /dev/null +& (operator): + << (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 + 2 * 3 /dev/null += (operator): + x (field_name). + + (operator): + 1 (literal). + * (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 + 2 * 3 /dev/null ++ (operator): + 1 (literal). + * (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 * 2 + 3 /dev/null += (operator): + x (field_name). + + (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 * 2 + 3 /dev/null ++ (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 + (2 * 3) /dev/null += (operator): + x (field_name). + + (operator): + 1 (literal). + * (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 + (2 * 3) /dev/null ++ (operator): + 1 (literal). + * (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 * (2 + 3) /dev/null += (operator): + x (field_name). + * (operator): + 1 (literal). + + (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 * (2 + 3) /dev/null +* (operator): + 1 (literal). + + (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = (1 + 2) * 3 /dev/null += (operator): + x (field_name). + * (operator): + + (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v (1 + 2) * 3 /dev/null +* (operator): + + (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = (1 * 2) + 3 /dev/null += (operator): + x (field_name). + + (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v (1 * 2) + 3 /dev/null ++ (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 + 2 ** 3 /dev/null += (operator): + x (field_name). + + (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 + 2 ** 3 /dev/null ++ (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ** 2 + 3 /dev/null += (operator): + x (field_name). + + (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 ** 2 + 3 /dev/null ++ (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 + (2 ** 3) /dev/null += (operator): + x (field_name). + + (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 + (2 ** 3) /dev/null ++ (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ** (2 + 3) /dev/null += (operator): + x (field_name). + ** (operator): + 1 (literal). + + (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 ** (2 + 3) /dev/null +** (operator): + 1 (literal). + + (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = (1 + 2) ** 3 /dev/null += (operator): + x (field_name). + ** (operator): + + (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v (1 + 2) ** 3 /dev/null +** (operator): + + (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = (1 ** 2) + 3 /dev/null += (operator): + x (field_name). + + (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v (1 ** 2) + 3 /dev/null ++ (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 * 2 ** 3 /dev/null += (operator): + x (field_name). + * (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 * 2 ** 3 /dev/null +* (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ** 2 * 3 /dev/null += (operator): + x (field_name). + * (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v 1 ** 2 * 3 /dev/null +* (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 * (2 ** 3) /dev/null += (operator): + x (field_name). + * (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 * (2 ** 3) /dev/null +* (operator): + 1 (literal). + ** (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 ** (2 * 3) /dev/null += (operator): + x (field_name). + ** (operator): + 1 (literal). + * (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 ** (2 * 3) /dev/null +** (operator): + 1 (literal). + * (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = (1 * 2) ** 3 /dev/null += (operator): + x (field_name). + ** (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v (1 * 2) ** 3 /dev/null +** (operator): + * (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = (1 ** 2) * 3 /dev/null += (operator): + x (field_name). + * (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v (1 ** 2) * 3 /dev/null +* (operator): + ** (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = -1 + 2 * 3 /dev/null += (operator): + x (field_name). + + (operator): + - (operator): + 1 (literal). + * (operator): + 2 (literal). + 3 (literal). + +mlr filter -v -1 + 2 * 3 /dev/null ++ (operator): + - (operator): + 1 (literal). + * (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = -1 * 2 + 3 /dev/null += (operator): + x (field_name). + + (operator): + * (operator): + - (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v -1 * 2 + 3 /dev/null ++ (operator): + * (operator): + - (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 + -2 * 3 /dev/null += (operator): + x (field_name). + + (operator): + 1 (literal). + * (operator): + - (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 + -2 * 3 /dev/null ++ (operator): + 1 (literal). + * (operator): + - (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 * -2 + 3 /dev/null += (operator): + x (field_name). + + (operator): + * (operator): + 1 (literal). + - (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 * -2 + 3 /dev/null ++ (operator): + * (operator): + 1 (literal). + - (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 + 2 * -3 /dev/null += (operator): + x (field_name). + + (operator): + 1 (literal). + * (operator): + 2 (literal). + - (operator): + 3 (literal). + +mlr filter -v 1 + 2 * -3 /dev/null ++ (operator): + 1 (literal). + * (operator): + 2 (literal). + - (operator): + 3 (literal). + +mlr put -v $x = 1 * 2 + -3 /dev/null += (operator): + x (field_name). + + (operator): + * (operator): + 1 (literal). + 2 (literal). + - (operator): + 3 (literal). + +mlr filter -v 1 * 2 + -3 /dev/null ++ (operator): + * (operator): + 1 (literal). + 2 (literal). + - (operator): + 3 (literal). + +mlr put -v $x = ~1 | 2 & 3 /dev/null += (operator): + x (field_name). + | (operator): + ~ (operator): + 1 (literal). + & (operator): + 2 (literal). + 3 (literal). + +mlr filter -v ~1 | 2 & 3 /dev/null +| (operator): + ~ (operator): + 1 (literal). + & (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = ~1 & 2 | 3 /dev/null += (operator): + x (field_name). + | (operator): + & (operator): + ~ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr filter -v ~1 & 2 | 3 /dev/null +| (operator): + & (operator): + ~ (operator): + 1 (literal). + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 | ~2 & 3 /dev/null += (operator): + x (field_name). + | (operator): + 1 (literal). + & (operator): + ~ (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 | ~2 & 3 /dev/null +| (operator): + 1 (literal). + & (operator): + ~ (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 & ~2 | 3 /dev/null += (operator): + x (field_name). + | (operator): + & (operator): + 1 (literal). + ~ (operator): + 2 (literal). + 3 (literal). + +mlr filter -v 1 & ~2 | 3 /dev/null +| (operator): + & (operator): + 1 (literal). + ~ (operator): + 2 (literal). + 3 (literal). + +mlr put -v $x = 1 | 2 & ~3 /dev/null += (operator): + x (field_name). + | (operator): + 1 (literal). + & (operator): + 2 (literal). + ~ (operator): + 3 (literal). + +mlr filter -v 1 | 2 & ~3 /dev/null +| (operator): + 1 (literal). + & (operator): + 2 (literal). + ~ (operator): + 3 (literal). + +mlr put -v $x = 1 & 2 | ~3 /dev/null += (operator): + x (field_name). + | (operator): + & (operator): + 1 (literal). + 2 (literal). + ~ (operator): + 3 (literal). + +mlr filter -v 1 & 2 | ~3 /dev/null +| (operator): + & (operator): + 1 (literal). + 2 (literal). + ~ (operator): + 3 (literal). + +mlr put -v $x = $a==1 && $b == 1 && $c == 1 /dev/null += (operator): + x (field_name). + && (operator): + && (operator): + == (operator): + a (field_name). + 1 (literal). + == (operator): + b (field_name). + 1 (literal). + == (operator): + c (field_name). + 1 (literal). + +mlr filter -v $a==1 && $b == 1 && $c == 1 /dev/null +&& (operator): + && (operator): + == (operator): + a (field_name). + 1 (literal). + == (operator): + b (field_name). + 1 (literal). + == (operator): + c (field_name). + 1 (literal). + +mlr put -v $x = $a==1 || $b == 1 && $c == 1 /dev/null += (operator): + x (field_name). + || (operator): + == (operator): + a (field_name). + 1 (literal). + && (operator): + == (operator): + b (field_name). + 1 (literal). + == (operator): + c (field_name). + 1 (literal). + +mlr filter -v $a==1 || $b == 1 && $c == 1 /dev/null +|| (operator): + == (operator): + a (field_name). + 1 (literal). + && (operator): + == (operator): + b (field_name). + 1 (literal). + == (operator): + c (field_name). + 1 (literal). + +mlr put -v $x = $a==1 || $b == 1 || $c == 1 /dev/null += (operator): + x (field_name). + || (operator): + || (operator): + == (operator): + a (field_name). + 1 (literal). + == (operator): + b (field_name). + 1 (literal). + == (operator): + c (field_name). + 1 (literal). + +mlr filter -v $a==1 || $b == 1 || $c == 1 /dev/null +|| (operator): + || (operator): + == (operator): + a (field_name). + 1 (literal). + == (operator): + b (field_name). + 1 (literal). + == (operator): + c (field_name). + 1 (literal). + +mlr put -v $x = $a==1 && $b == 1 || $c == 1 /dev/null += (operator): + x (field_name). + || (operator): + && (operator): + == (operator): + a (field_name). + 1 (literal). + == (operator): + b (field_name). + 1 (literal). + == (operator): + c (field_name). + 1 (literal). + +mlr filter -v $a==1 && $b == 1 || $c == 1 /dev/null +|| (operator): + && (operator): + == (operator): + a (field_name). + 1 (literal). + == (operator): + b (field_name). + 1 (literal). + == (operator): + c (field_name). + 1 (literal). + + +================================================================ +DSL FUNCTIONAL TESTS mlr filter $x>.3 ./reg_test/input/abixy a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533 @@ -3971,223 +5779,6 @@ zee wye 8 0.5985540091064224 0.976181385699006 18 8 7 2 hat wye 9 0.03144187646093577 0.7495507603507059 19 9 7 2 pan wye 10 0.5026260055412137 0.9526183602969864 20 10 7 2 - -================================================================ -OPERATOR PRECEDENCE AND ASSOCIATIVITY - -mlr put -v $x=$a+$b+$c /dev/null -= (operator): - x (field_name). - + (operator): - + (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a+$b-$c /dev/null -= (operator): - x (field_name). - - (operator): - + (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a-$b-$c /dev/null -= (operator): - x (field_name). - - (operator): - - (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a-$b+$c /dev/null -= (operator): - x (field_name). - + (operator): - - (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a*$b*$c /dev/null -= (operator): - x (field_name). - * (operator): - * (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a*$b/$c /dev/null -= (operator): - x (field_name). - / (operator): - * (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a/$b/$c /dev/null -= (operator): - x (field_name). - / (operator): - / (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a/$b*$c /dev/null -= (operator): - x (field_name). - * (operator): - / (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a+$b+$c /dev/null -= (operator): - x (field_name). - + (operator): - + (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a+$b*$c /dev/null -= (operator): - x (field_name). - + (operator): - a (field_name). - * (operator): - b (field_name). - c (field_name). - -mlr put -v $x=$a*$b*$c /dev/null -= (operator): - x (field_name). - * (operator): - * (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a*$b+$c /dev/null -= (operator): - x (field_name). - + (operator): - * (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a+$b+$c /dev/null -= (operator): - x (field_name). - + (operator): - + (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a+$b**$c /dev/null -= (operator): - x (field_name). - + (operator): - a (field_name). - ** (operator): - b (field_name). - c (field_name). - -mlr put -v $x=$a**$b**$c /dev/null -= (operator): - x (field_name). - ** (operator): - a (field_name). - ** (operator): - b (field_name). - c (field_name). - -mlr put -v $x=$a**$b+$c /dev/null -= (operator): - x (field_name). - + (operator): - ** (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a.$b.$c /dev/null -= (operator): - x (field_name). - . (operator): - . (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=-$a+$b*$c /dev/null -= (operator): - x (field_name). - + (operator): - - (operator): - a (field_name). - * (operator): - b (field_name). - c (field_name). - -mlr put -v $x=-$a*$b+$c /dev/null -= (operator): - x (field_name). - + (operator): - * (operator): - - (operator): - a (field_name). - b (field_name). - c (field_name). - -mlr put -v $x=$a+-$b*$c /dev/null -= (operator): - x (field_name). - + (operator): - a (field_name). - * (operator): - - (operator): - b (field_name). - c (field_name). - -mlr put -v $x=$a*-$b+$c /dev/null -= (operator): - x (field_name). - + (operator): - * (operator): - a (field_name). - - (operator): - b (field_name). - c (field_name). - -mlr put -v $x=$a+$b*-$c /dev/null -= (operator): - x (field_name). - + (operator): - a (field_name). - * (operator): - b (field_name). - - (operator): - c (field_name). - -mlr put -v $x=$a*$b+-$c /dev/null -= (operator): - x (field_name). - + (operator): - * (operator): - a (field_name). - b (field_name). - - (operator): - c (field_name). - mlr --opprint put $y=madd($x,10,37) then put $z=msub($x,10,37) ./reg_test/input/modarith.dat x y z -37 10 27 @@ -4416,234 +6007,1517 @@ x y z 72 18 1 73 36 1 -mlr filter -v $a==1 && $b == 1 && $c == 1 /dev/null -&& (operator): - && (operator): - == (operator): - a (field_name). - 1 (literal). - == (operator): - b (field_name). - 1 (literal). - == (operator): - c (field_name). - 1 (literal). +mlr put $z=min($x, $y) ./reg_test/input/minmax.dkvp +x=1,y=2,z=1 +x=1,y=,z=1 +x=,y=,z= +x=,y=2,z=2 +x=3,y=2,z=2 +x=3,y=,z=3 +x=,y=,z= +x=,y=2,z=2 -mlr filter -v $a==1 || $b == 1 && $c == 1 /dev/null -|| (operator): - == (operator): - a (field_name). - 1 (literal). - && (operator): - == (operator): - b (field_name). - 1 (literal). - == (operator): - c (field_name). - 1 (literal). +mlr put $z=max($x, $y) ./reg_test/input/minmax.dkvp +x=1,y=2,z=2 +x=1,y=,z=1 +x=,y=,z= +x=,y=2,z=2 +x=3,y=2,z=3 +x=3,y=,z=3 +x=,y=,z= +x=,y=2,z=2 -mlr filter -v $a==1 || $b == 1 || $c == 1 /dev/null -|| (operator): - || (operator): - == (operator): - a (field_name). - 1 (literal). - == (operator): - b (field_name). - 1 (literal). - == (operator): - c (field_name). - 1 (literal). -mlr filter -v $a==1 && $b == 1 || $c == 1 /dev/null -|| (operator): - && (operator): - == (operator): - a (field_name). - 1 (literal). - == (operator): - b (field_name). - 1 (literal). - == (operator): - c (field_name). - 1 (literal). +================================================================ +DSL TYPE-INFERENCE -mlr filter -v $x<$a*$b*$c /dev/null -< (operator): - x (field_name). - * (operator): - * (operator): - a (field_name). - b (field_name). - c (field_name). +mlr --xtab put $y=abs($pf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 71.200000 -mlr filter -v $x<$a*$b/$c /dev/null -< (operator): - x (field_name). - / (operator): - * (operator): - a (field_name). - b (field_name). - c (field_name). +mlr --xtab put $y=abs($nf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 71.200000 -mlr filter -v $x<$a/$b/$c /dev/null -< (operator): - x (field_name). - / (operator): - / (operator): - a (field_name). - b (field_name). - c (field_name). +mlr --xtab put $y=abs($zf) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 -mlr filter -v $x<$a/$b*$c /dev/null -< (operator): - x (field_name). - * (operator): - / (operator): - a (field_name). - b (field_name). - c (field_name). +mlr --xtab put $y=abs($pi1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 75 -mlr filter -v $x<$a+$b+$c /dev/null -< (operator): - x (field_name). - + (operator): - + (operator): - a (field_name). - b (field_name). - c (field_name). +mlr --xtab put $y=abs($ni1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 75 -mlr filter -v $x<$a+$b*$c /dev/null -< (operator): - x (field_name). - + (operator): - a (field_name). - * (operator): - b (field_name). - c (field_name). +mlr --xtab put $y=abs($zi) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0 -mlr filter -v $x<$a*$b*$c /dev/null -< (operator): - x (field_name). - * (operator): - * (operator): - a (field_name). - b (field_name). - c (field_name). +mlr --xtab put -f $y=abs($pf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 71.200000 -mlr filter -v $x<$a*$b+$c /dev/null -< (operator): - x (field_name). - + (operator): - * (operator): - a (field_name). - b (field_name). - c (field_name). +mlr --xtab put -f $y=abs($nf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 71.200000 -mlr filter -v $x<$a+$b+$c /dev/null -< (operator): - x (field_name). - + (operator): - + (operator): - a (field_name). - b (field_name). - c (field_name). +mlr --xtab put -f $y=abs($zf) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 -mlr filter -v $x<$a+$b**$c /dev/null -< (operator): - x (field_name). - + (operator): - a (field_name). - ** (operator): - b (field_name). - c (field_name). +mlr --xtab put -f $y=abs($pi1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 75.000000 -mlr filter -v $x<$a**$b**$c /dev/null -< (operator): - x (field_name). - ** (operator): - a (field_name). - ** (operator): - b (field_name). - c (field_name). +mlr --xtab put -f $y=abs($ni1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 75.000000 -mlr filter -v $x<$a**$b+$c /dev/null -< (operator): - x (field_name). - + (operator): - ** (operator): - a (field_name). - b (field_name). - c (field_name). +mlr --xtab put -f $y=abs($zi) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 -mlr filter -v $x<$a.$b.$c /dev/null -< (operator): - x (field_name). - . (operator): - . (operator): - a (field_name). - b (field_name). - c (field_name). +mlr --xtab put $y=ceil($pf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 72.000000 -mlr filter -v $x<-$a+$b*$c /dev/null -< (operator): - x (field_name). - + (operator): - - (operator): - a (field_name). - * (operator): - b (field_name). - c (field_name). +mlr --xtab put $y=ceil($nf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -71.000000 -mlr filter -v $x<-$a*$b+$c /dev/null -< (operator): - x (field_name). - + (operator): - * (operator): - - (operator): - a (field_name). - b (field_name). - c (field_name). +mlr --xtab put $y=ceil($zf) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 -mlr filter -v $x<$a+-$b*$c /dev/null -< (operator): - x (field_name). - + (operator): - a (field_name). - * (operator): - - (operator): - b (field_name). - c (field_name). +mlr --xtab put $y=ceil($pi1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 75 -mlr filter -v $x<$a*-$b+$c /dev/null -< (operator): - x (field_name). - + (operator): - * (operator): - a (field_name). - - (operator): - b (field_name). - c (field_name). +mlr --xtab put $y=ceil($ni1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -75 -mlr filter -v $x<$a+$b*-$c /dev/null -< (operator): - x (field_name). - + (operator): - a (field_name). - * (operator): - b (field_name). - - (operator): - c (field_name). +mlr --xtab put $y=ceil($zi) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0 -mlr filter -v $x<$a*$b+-$c /dev/null -< (operator): - x (field_name). - + (operator): - * (operator): - a (field_name). - b (field_name). - - (operator): - c (field_name). +mlr --xtab put -f $y=floor($pf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 71.000000 + +mlr --xtab put -f $y=floor($nf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -72.000000 + +mlr --xtab put -f $y=floor($zf) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 + +mlr --xtab put -f $y=floor($pi1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 75.000000 + +mlr --xtab put -f $y=floor($ni1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -75.000000 + +mlr --xtab put -f $y=floor($zi) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 + +mlr --xtab put $y=round($pf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 71.000000 + +mlr --xtab put $y=round($nf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -71.000000 + +mlr --xtab put $y=round($zf) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 + +mlr --xtab put $y=round($pi1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 75 + +mlr --xtab put $y=round($ni1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -75 + +mlr --xtab put $y=round($zi) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0 + +mlr --xtab put -f $y=round($pf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 71.000000 + +mlr --xtab put -f $y=round($nf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -71.000000 + +mlr --xtab put -f $y=round($zf) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 + +mlr --xtab put -f $y=round($pi1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 75.000000 + +mlr --xtab put -f $y=round($ni1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -75.000000 + +mlr --xtab put -f $y=round($zi) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 + +mlr --xtab put $y=sgn($pf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 1.000000 + +mlr --xtab put $y=sgn($nf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -1.000000 + +mlr --xtab put $y=sgn($zf) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 + +mlr --xtab put $y=sgn($pi1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 1 + +mlr --xtab put $y=sgn($ni1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -1 + +mlr --xtab put $y=sgn($zi) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0 + +mlr --xtab put -f $y=sgn($pf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 1.000000 + +mlr --xtab put -f $y=sgn($nf1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -1.000000 + +mlr --xtab put -f $y=sgn($zf) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 + +mlr --xtab put -f $y=sgn($pi1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 1.000000 + +mlr --xtab put -f $y=sgn($ni1) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y -1.000000 + +mlr --xtab put -f $y=sgn($zi) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +y 0.000000 + +mlr --xtab put $min=min($pf1,$pf2);$max=max($pf1,$pf2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 71.200000 +max 73.400000 + +mlr --xtab put $min=min($pf1,$pi2);$max=max($pf1,$pi2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 71.200000 +max 76.000000 + +mlr --xtab put $min=min($pi1,$pf2);$max=max($pi1,$pf2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 73.400000 +max 75.000000 + +mlr --xtab put $min=min($pi1,$pi2);$max=max($pi1,$pi2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 75 +max 76 + +mlr --xtab put -f $min=min($pf1,$pf2);$max=max($pf1,$pf2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 71.200000 +max 73.400000 + +mlr --xtab put -f $min=min($pf1,$pi2);$max=max($pf1,$pi2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 71.200000 +max 76.000000 + +mlr --xtab put -f $min=min($pi1,$pf2);$max=max($pi1,$pf2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 73.400000 +max 75.000000 + +mlr --xtab put -f $min=min($pi1,$pi2);$max=max($pi1,$pi2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 75.000000 +max 76.000000 + +mlr --xtab put $min=min($pf1,$pf2);$max=max($pf1,$pf2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 71.200000 +max 73.400000 + +mlr --xtab put $min=min($pf1,$pi2);$max=max($pf1,$pi2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 71.200000 +max 76.000000 + +mlr --xtab put $min=min($pi1,$pf2);$max=max($pi1,$pf2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 73.400000 +max 75.000000 + +mlr --xtab put $min=min($pi1,$pi2);$max=max($pi1,$pi2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 75 +max 76 + +mlr --xtab put -f $min=min($pf1,$pf2);$max=max($pf1,$pf2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 71.200000 +max 73.400000 + +mlr --xtab put -f $min=min($pf1,$pi2);$max=max($pf1,$pi2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 71.200000 +max 76.000000 + +mlr --xtab put -f $min=min($pi1,$pf2);$max=max($pi1,$pf2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 73.400000 +max 75.000000 + +mlr --xtab put -f $min=min($pi1,$pi2);$max=max($pi1,$pi2) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +min 75.000000 +max 76.000000 + +mlr --xtab put $sum=$pf1+$pf2;$diff=$pf1-$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +sum 144.600000 +diff -2.200000 + +mlr --xtab put $sum=$pf1+$pi2;$diff=$pf1-$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +sum 147.200000 +diff -4.800000 + +mlr --xtab put $sum=$pi1+$pf2;$diff=$pi1-$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +sum 148.400000 +diff 1.600000 + +mlr --xtab put $sum=$pi1+$pi2;$diff=$pi1-$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +sum 151 +diff -1 + +mlr --xtab put -f $sum=$pf1+$pf2;$diff=$pf1-$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +sum 144.600000 +diff -2.200000 + +mlr --xtab put -f $sum=$pf1+$pi2;$diff=$pf1-$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +sum 147.200000 +diff -4.800000 + +mlr --xtab put -f $sum=$pi1+$pf2;$diff=$pi1-$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +sum 148.400000 +diff 1.600000 + +mlr --xtab put -f $sum=$pi1+$pi2;$diff=$pi1-$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +sum 151.000000 +diff -1.000000 + +mlr --xtab put $prod=$pf1*$pf2;$quot=$pf1/$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +prod 5226.080000 +quot 0.970027 + +mlr --xtab put $prod=$pf1*$pi2;$quot=$pf1/$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +prod 5411.200000 +quot 0.936842 + +mlr --xtab put $prod=$pi1*$pf2;$quot=$pi1/$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +prod 5505.000000 +quot 1.021798 + +mlr --xtab put $prod=$pi1*$pi2;$quot=$pi1/$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +prod 5700 +quot 0.986842 + +mlr --xtab put -f $prod=$pf1*$pf2;$quot=$pf1/$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +prod 5226.080000 +quot 0.970027 + +mlr --xtab put -f $prod=$pf1*$pi2;$quot=$pf1/$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +prod 5411.200000 +quot 0.936842 + +mlr --xtab put -f $prod=$pi1*$pf2;$quot=$pi1/$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +prod 5505.000000 +quot 1.021798 + +mlr --xtab put -f $prod=$pi1*$pi2;$quot=$pi1/$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +prod 5700.000000 +quot 0.986842 + +mlr --xtab put $iquot=$pf1//$pf2;$mod=$pf1%$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +iquot 0.000000 +mod 71.200000 + +mlr --xtab put $iquot=$pf1//$pi2;$mod=$pf1%$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +iquot 0.000000 +mod 71.200000 + +mlr --xtab put $iquot=$pi1//$pf2;$mod=$pi1%$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +iquot 1.000000 +mod 1.600000 + +mlr --xtab put $iquot=$pi1//$pi2;$mod=$pi1%$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +iquot 0 +mod 75 + +mlr --xtab put -f $iquot=$pf1//$pf2;$mod=$pf1%$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +iquot 0.000000 +mod 71.200000 + +mlr --xtab put -f $iquot=$pf1//$pi2;$mod=$pf1%$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +iquot 0.000000 +mod 71.200000 + +mlr --xtab put -f $iquot=$pi1//$pf2;$mod=$pi1%$pf2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +iquot 1.000000 +mod 1.600000 + +mlr --xtab put -f $iquot=$pi1//$pi2;$mod=$pi1%$pi2 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +iquot 0.000000 +mod 75.000000 + +mlr --xtab put $a=roundm($pf1,10.0);$b=roundm($pf1,-10.0) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +a 70.000000 +b 70.000000 + +mlr --xtab put $a=roundm($pf1,10) ;$b=roundm($pf1,-10) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +a 70.000000 +b 70.000000 + +mlr --xtab put $a=roundm($pi1,10.0);$b=roundm($pi1,-10.0) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +a 80.000000 +b 80.000000 + +mlr --xtab put $a=roundm($pi1,10) ;$b=roundm($pi1,-10) ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +a 70 +b 70 + + +================================================================ +DSL PYTHONIC DIVISION + +mlr --xtab put $quot=$pf1/10.0;$iquot=$pf1//10.0;$mod=$pf1%10.0 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot 7.120000 +iquot 7.000000 +mod 1.200000 + +mlr --xtab put $quot=$pi1/10 ;$iquot=$pi1//10 ;$mod=$pi1%10 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot 7.500000 +iquot 7 +mod 5 + +mlr --xtab put $quot=$nf1/10.0;$iquot=$nf1//10.0;$mod=$nf1%10.0 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot -7.120000 +iquot -8.000000 +mod 8.800000 + +mlr --xtab put $quot=$ni1/10 ;$iquot=$ni1//10 ;$mod=$ni1%10 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot -7.500000 +iquot -8 +mod 5 + +mlr --xtab put -f $quot=$pf1/10.0;$iquot=$pf1//10.0;$mod=$pf1%10.0 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot 7.120000 +iquot 7.000000 +mod 1.200000 + +mlr --xtab put -f $quot=$pi1/10 ;$iquot=$pi1//10 ;$mod=$pi1%10 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot 7.500000 +iquot 7.000000 +mod 5.000000 + +mlr --xtab put -f $quot=$nf1/10.0;$iquot=$nf1//10.0;$mod=$nf1%10.0 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot -7.120000 +iquot -8.000000 +mod 8.800000 + +mlr --xtab put -f $quot=$ni1/10 ;$iquot=$ni1//10 ;$mod=$ni1%10 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot -7.500000 +iquot -8.000000 +mod 5.000000 + +mlr --xtab put $quot=$pf1/-10.0;$iquot=$pf1//-10.0;$mod=$pf1%-10.0 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot -7.120000 +iquot -8.000000 +mod -8.800000 + +mlr --xtab put $quot=$pi1/-10 ;$iquot=$pi1//-10 ;$mod=$pi1%-10 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot -7.500000 +iquot -8 +mod -5 + +mlr --xtab put $quot=$nf1/-10.0;$iquot=$nf1//-10.0;$mod=$nf1%-10.0 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot 7.120000 +iquot 7.000000 +mod -1.200000 + +mlr --xtab put $quot=$ni1/-10 ;$iquot=$ni1//-10 ;$mod=$ni1%-10 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot 7.500000 +iquot 7 +mod -5 + +mlr --xtab put -f $quot=$pf1/-10.0;$iquot=$pf1//-10.0;$mod=$pf1%-10.0 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot -7.120000 +iquot -8.000000 +mod -8.800000 + +mlr --xtab put -f $quot=$pi1/-10 ;$iquot=$pi1//-10 ;$mod=$pi1%-10 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot -7.500000 +iquot -8.000000 +mod -5.000000 + +mlr --xtab put -f $quot=$nf1/-10.0;$iquot=$nf1//-10.0;$mod=$nf1%-10.0 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot 7.120000 +iquot 7.000000 +mod -1.200000 + +mlr --xtab put -f $quot=$ni1/-10 ;$iquot=$ni1//-10 ;$mod=$ni1%-10 ./reg_test/input/mixed-types.xtab +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 +quot 7.500000 +iquot 7.000000 +mod -5.000000 + + +================================================================ +DSL REGEX MATCHING mlr filter -v $x =~ "bcd" ./reg_test/input/regex.dkvp =~ (operator): @@ -4740,6 +7614,10 @@ mlr filter -v $x =~ "^a.*"."d$"i ./reg_test/input/regex.dkvp d$ (regexi). x=abcd,y=ghi + +================================================================ +DSL DATETIME FUNCTIONS + mlr --csvlite put $gmt=sec2gmt($sec) ./reg_test/input/sec2gmt sec,gmt 0,1970-01-01T00:00:00Z @@ -4791,26 +7669,6 @@ sec 2017-07-14T02:40:00Z 2033-05-18T03:33:20Z -mlr put $z=min($x, $y) ./reg_test/input/minmax.dkvp -x=1,y=2,z=1.000000 -x=1,y=,z=1.000000 -x=,y=,z= -x=,y=2,z=2.000000 -x=3,y=2,z=2.000000 -x=3,y=,z=3.000000 -x=,y=,z= -x=,y=2,z=2.000000 - -mlr put $z=max($x, $y) ./reg_test/input/minmax.dkvp -x=1,y=2,z=2.000000 -x=1,y=,z=1.000000 -x=,y=,z= -x=,y=2,z=2.000000 -x=3,y=2,z=3.000000 -x=3,y=,z=3.000000 -x=,y=,z= -x=,y=2,z=2.000000 - mlr --opprint put $hms=sec2hms($sec); $resec=hms2sec($hms); $diff=$resec-$sec ./reg_test/input/sec2xhms sec hms resec diff 0 00:00:00 0 0 @@ -4935,7 +7793,7 @@ sec hms resec diff ================================================================ -SUB/GSUB +DSL SUB/GSUB mlr --opprint put $y = sub($x, "e.*l", "y123y") ./reg_test/input/sub.dat x y diff --git a/c/reg_test/input/Makefile.am b/c/reg_test/input/Makefile.am index 049ef49f9..605927013 100644 --- a/c/reg_test/input/Makefile.am +++ b/c/reg_test/input/Makefile.am @@ -36,6 +36,7 @@ EXTRA_DIST= \ logi.dkvp \ minmax.dkvp \ missings.dkvp \ + mixed-types.xtab \ modarith.dat \ multi-ips.dkvp \ multi-sep.csv \ diff --git a/c/reg_test/input/mixed-types.xtab b/c/reg_test/input/mixed-types.xtab new file mode 100644 index 000000000..2a47e04a3 --- /dev/null +++ b/c/reg_test/input/mixed-types.xtab @@ -0,0 +1,10 @@ +pf1 71.2 +nf1 -71.2 +zf 0.0 +pf2 73.4 +nf2 -73.4 +pi1 75 +ni1 -75 +zi 0 +pi2 76 +ni2 -76 diff --git a/c/reg_test/run b/c/reg_test/run index d76ada169..8c5bd0ce9 100755 --- a/c/reg_test/run +++ b/c/reg_test/run @@ -321,7 +321,267 @@ run_mlr --odkvp step -a rsum,delta,counter -f x,y -g a $indir/abixy-het run_mlr --opprint histogram -f x,y --lo 0 --hi 1 --nbins 20 $indir/small # ---------------------------------------------------------------- -announce DSLs +announce DSL OPERATOR ASSOCIATIVITY +# Note: filter -v and put -v print the AST. + +run_mlr put -v '$x = 1 || 2 || 3' /dev/null +run_mlr filter -v ' 1 || 2 || 3' /dev/null +run_mlr put -v '$x = 1 ^^ 2 ^^ 3' /dev/null +run_mlr filter -v ' 1 ^^ 2 ^^ 3' /dev/null +run_mlr put -v '$x = 1 && 2 && 3' /dev/null +run_mlr filter -v ' 1 && 2 && 3' /dev/null + +run_mlr put -v '$x = 1 == 2 == 3' /dev/null +run_mlr filter -v ' 1 == 2 == 3' /dev/null +run_mlr put -v '$x = 1 != 2 != 3' /dev/null +run_mlr filter -v ' 1 != 2 != 3' /dev/null +run_mlr put -v '$x = 1 =~ 2 =~ 3' /dev/null +run_mlr filter -v ' 1 =~ 2 =~ 3' /dev/null +run_mlr put -v '$x = 1 !=~ 2 !=~ 3' /dev/null +run_mlr filter -v ' 1 !=~ 2 !=~ 3' /dev/null +run_mlr put -v '$x = 1 == 2 != 3' /dev/null +run_mlr filter -v ' 1 == 2 != 3' /dev/null +run_mlr put -v '$x = 1 != 2 == 3' /dev/null +run_mlr filter -v ' 1 != 2 == 3' /dev/null + +run_mlr put -v '$x = 1 < 2 < 3' /dev/null +run_mlr filter -v ' 1 < 2 < 3' /dev/null +run_mlr put -v '$x = 1 <= 2 <= 3' /dev/null +run_mlr filter -v ' 1 <= 2 <= 3' /dev/null +run_mlr put -v '$x = 1 > 2 > 3' /dev/null +run_mlr filter -v ' 1 > 2 > 3' /dev/null +run_mlr put -v '$x = 1 >= 2 >= 3' /dev/null +run_mlr filter -v ' 1 >= 2 >= 3' /dev/null +run_mlr put -v '$x = 1 < 2 <= 3' /dev/null +run_mlr filter -v ' 1 < 2 <= 3' /dev/null +run_mlr put -v '$x = 1 <= 2 < 3' /dev/null +run_mlr filter -v ' 1 <= 2 < 3' /dev/null + +run_mlr put -v '$x = 1 | 2 | 3' /dev/null +run_mlr filter -v ' 1 | 2 | 3' /dev/null +run_mlr put -v '$x = 1 ^ 2 ^ 3' /dev/null +run_mlr filter -v ' 1 ^ 2 ^ 3' /dev/null +run_mlr put -v '$x = 1 & 2 & 3' /dev/null +run_mlr filter -v ' 1 & 2 & 3' /dev/null +run_mlr put -v '$x = 1 | 2 & 3' /dev/null +run_mlr filter -v ' 1 | 2 & 3' /dev/null +run_mlr put -v '$x = 1 | 2 ^ 3' /dev/null +run_mlr filter -v ' 1 | 2 ^ 3' /dev/null +run_mlr put -v '$x = 1 ^ 2 | 3' /dev/null +run_mlr filter -v ' 1 ^ 2 | 3' /dev/null +run_mlr put -v '$x = 1 ^ 2 & 3' /dev/null +run_mlr filter -v ' 1 ^ 2 & 3' /dev/null +run_mlr put -v '$x = 1 & 2 | 3' /dev/null +run_mlr filter -v ' 1 & 2 | 3' /dev/null +run_mlr put -v '$x = 1 & 2 ^ 3' /dev/null +run_mlr filter -v ' 1 & 2 ^ 3' /dev/null + +run_mlr put -v '$x = 1 << 2 << 3' /dev/null +run_mlr filter -v ' 1 << 2 << 3' /dev/null +run_mlr put -v '$x = 1 >> 2 >> 3' /dev/null +run_mlr filter -v ' 1 >> 2 >> 3' /dev/null +run_mlr put -v '$x = 1 << 2 >> 3' /dev/null +run_mlr filter -v ' 1 << 2 >> 3' /dev/null +run_mlr put -v '$x = 1 >> 2 << 3' /dev/null +run_mlr filter -v ' 1 >> 2 << 3' /dev/null + +run_mlr put -v '$x = 1 + 2 + 3' /dev/null +run_mlr filter -v ' 1 + 2 + 3' /dev/null +run_mlr put -v '$x = 1 - 2 - 3' /dev/null +run_mlr filter -v ' 1 - 2 - 3' /dev/null +run_mlr put -v '$x = 1 + 2 - 3' /dev/null +run_mlr filter -v ' 1 + 2 - 3' /dev/null +run_mlr put -v '$x = 1 - 2 + 3' /dev/null +run_mlr filter -v ' 1 - 2 + 3' /dev/null +run_mlr put -v '$x = 1 . 2 . 3' /dev/null +run_mlr filter -v ' 1 . 2 . 3' /dev/null + +run_mlr put -v '$x = 1 * 2 * 3' /dev/null +run_mlr filter -v ' 1 * 2 * 3' /dev/null +run_mlr put -v '$x = 1 / 2 / 3' /dev/null +run_mlr filter -v ' 1 / 2 / 3' /dev/null +run_mlr put -v '$x = 1 // 2 // 3' /dev/null +run_mlr filter -v ' 1 // 2 // 3' /dev/null +run_mlr put -v '$x = 1 % 2 % 3' /dev/null +run_mlr filter -v ' 1 % 2 % 3' /dev/null +run_mlr put -v '$x = 1 ** 2 ** 3' /dev/null +run_mlr filter -v ' 1 ** 2 ** 3' /dev/null + + +run_mlr put -v '$x = 1 * 2 / 3' /dev/null +run_mlr filter -v ' 1 * 2 / 3' /dev/null +run_mlr put -v '$x = 1 * 2 // 3' /dev/null +run_mlr filter -v ' 1 * 2 // 3' /dev/null +run_mlr put -v '$x = 1 * 2 % 3' /dev/null +run_mlr filter -v ' 1 * 2 % 3' /dev/null +run_mlr put -v '$x = 1 * 2 ** 3' /dev/null +run_mlr filter -v ' 1 * 2 ** 3' /dev/null + +run_mlr put -v '$x = 1 / 2 * 3' /dev/null +run_mlr filter -v ' 1 / 2 * 3' /dev/null +run_mlr put -v '$x = 1 / 2 // 3' /dev/null +run_mlr filter -v ' 1 / 2 // 3' /dev/null +run_mlr put -v '$x = 1 / 2 % 3' /dev/null +run_mlr filter -v ' 1 / 2 % 3' /dev/null +run_mlr put -v '$x = 1 / 2 ** 3' /dev/null +run_mlr filter -v ' 1 / 2 ** 3' /dev/null + +run_mlr put -v '$x = 1 // 2 * 3' /dev/null +run_mlr filter -v ' 1 // 2 * 3' /dev/null +run_mlr put -v '$x = 1 // 2 / 3' /dev/null +run_mlr filter -v ' 1 // 2 / 3' /dev/null +run_mlr put -v '$x = 1 // 2 % 3' /dev/null +run_mlr filter -v ' 1 // 2 % 3' /dev/null +run_mlr put -v '$x = 1 // 2 ** 3' /dev/null +run_mlr filter -v ' 1 // 2 ** 3' /dev/null + +run_mlr put -v '$x = 1 % 2 * 3' /dev/null +run_mlr filter -v ' 1 % 2 * 3' /dev/null +run_mlr put -v '$x = 1 % 2 / 3' /dev/null +run_mlr filter -v ' 1 % 2 / 3' /dev/null +run_mlr put -v '$x = 1 % 2 // 3' /dev/null +run_mlr filter -v ' 1 % 2 // 3' /dev/null +run_mlr put -v '$x = 1 % 2 ** 3' /dev/null +run_mlr filter -v ' 1 % 2 ** 3' /dev/null + +run_mlr put -v '$x = 1 ** 2 * 3' /dev/null +run_mlr filter -v ' 1 ** 2 * 3' /dev/null +run_mlr put -v '$x = 1 ** 2 / 3' /dev/null +run_mlr filter -v ' 1 ** 2 / 3' /dev/null +run_mlr put -v '$x = 1 ** 2 // 3' /dev/null +run_mlr filter -v ' 1 ** 2 // 3' /dev/null +run_mlr put -v '$x = 1 ** 2 % 3' /dev/null +run_mlr filter -v ' 1 ** 2 % 3' /dev/null + +#run_mlr put -v '$x = ++1' /dev/null +#run_mlr filter -v ' ++1' /dev/null +#run_mlr put -v '$x = --1' /dev/null +#run_mlr filter -v ' --1' /dev/null +#run_mlr put -v '$x = !!1' /dev/null +#run_mlr filter -v ' !!1' /dev/null +#run_mlr put -v '$x = ~;1' /dev/null +#run_mlr filter -v ' ~~1' /dev/null + +# ---------------------------------------------------------------- +announce DSL OPERATOR PRECEDENCE +# Note: filter -v and put -v print the AST. + +run_mlr put -v '$x = 1 || 2 ^^ 3' /dev/null +run_mlr filter -v ' 1 || 2 ^^ 3' /dev/null +run_mlr put -v '$x = 1 || 2 && 3' /dev/null +run_mlr filter -v ' 1 || 2 && 3' /dev/null + +run_mlr put -v '$x = 1 ^^ 2 || 3' /dev/null +run_mlr filter -v ' 1 ^^ 2 || 3' /dev/null +run_mlr put -v '$x = 1 ^^ 2 && 3' /dev/null +run_mlr filter -v ' 1 ^^ 2 && 3' /dev/null + +run_mlr put -v '$x = 1 && 2 || 3' /dev/null +run_mlr filter -v ' 1 && 2 || 3' /dev/null +run_mlr put -v '$x = 1 && 2 ^^ 3' /dev/null +run_mlr filter -v ' 1 && 2 ^^ 3' /dev/null + +run_mlr put -v '$x = 1 == 2 <= 3' /dev/null +run_mlr filter -v ' 1 == 2 <= 3' /dev/null +run_mlr put -v '$x = 1 <= 2 == 3' /dev/null +run_mlr filter -v ' 1 <= 2 == 3' /dev/null + +run_mlr put -v '$x = 1 <= 2 | 3' /dev/null +run_mlr filter -v ' 1 <= 2 | 3' /dev/null +run_mlr put -v '$x = 1 | 2 <= 3' /dev/null +run_mlr filter -v ' 1 | 2 <= 3' /dev/null + +run_mlr put -v '$x = 1 | 2 ^ 3' /dev/null +run_mlr filter -v ' 1 | 2 ^ 3' /dev/null +run_mlr put -v '$x = 1 ^ 2 | 3' /dev/null +run_mlr filter -v ' 1 ^ 2 | 3' /dev/null + +run_mlr put -v '$x = 1 ^ 2 & 3' /dev/null +run_mlr filter -v ' 1 ^ 2 & 3' /dev/null +run_mlr put -v '$x = 1 & 2 ^ 3' /dev/null +run_mlr filter -v ' 1 & 2 ^ 3' /dev/null + +run_mlr put -v '$x = 1 & 2 << 3' /dev/null +run_mlr filter -v ' 1 & 2 << 3' /dev/null +run_mlr put -v '$x = 1 << 2 & 3' /dev/null +run_mlr filter -v ' 1 << 2 & 3' /dev/null + +run_mlr put -v '$x = 1 + 2 * 3' /dev/null +run_mlr filter -v ' 1 + 2 * 3' /dev/null +run_mlr put -v '$x = 1 * 2 + 3' /dev/null +run_mlr filter -v ' 1 * 2 + 3' /dev/null +run_mlr put -v '$x = 1 + (2 * 3)' /dev/null +run_mlr filter -v ' 1 + (2 * 3)' /dev/null +run_mlr put -v '$x = 1 * (2 + 3)' /dev/null +run_mlr filter -v ' 1 * (2 + 3)' /dev/null +run_mlr put -v '$x = (1 + 2) * 3' /dev/null +run_mlr filter -v ' (1 + 2) * 3' /dev/null +run_mlr put -v '$x = (1 * 2) + 3' /dev/null +run_mlr filter -v ' (1 * 2) + 3' /dev/null + +run_mlr put -v '$x = 1 + 2 ** 3' /dev/null +run_mlr filter -v ' 1 + 2 ** 3' /dev/null +run_mlr put -v '$x = 1 ** 2 + 3' /dev/null +run_mlr filter -v ' 1 ** 2 + 3' /dev/null +run_mlr put -v '$x = 1 + (2 ** 3)' /dev/null +run_mlr filter -v ' 1 + (2 ** 3)' /dev/null +run_mlr put -v '$x = 1 ** (2 + 3)' /dev/null +run_mlr filter -v ' 1 ** (2 + 3)' /dev/null +run_mlr put -v '$x = (1 + 2) ** 3' /dev/null +run_mlr filter -v ' (1 + 2) ** 3' /dev/null +run_mlr put -v '$x = (1 ** 2) + 3' /dev/null +run_mlr filter -v ' (1 ** 2) + 3' /dev/null + +run_mlr put -v '$x = 1 * 2 ** 3' /dev/null +run_mlr filter -v ' 1 * 2 ** 3' /dev/null +run_mlr put -v '$x = 1 ** 2 * 3' /dev/null +run_mlr filter -v ' 1 ** 2 * 3' /dev/null +run_mlr put -v '$x = 1 * (2 ** 3)' /dev/null +run_mlr filter -v ' 1 * (2 ** 3)' /dev/null +run_mlr put -v '$x = 1 ** (2 * 3)' /dev/null +run_mlr filter -v ' 1 ** (2 * 3)' /dev/null +run_mlr put -v '$x = (1 * 2) ** 3' /dev/null +run_mlr filter -v ' (1 * 2) ** 3' /dev/null +run_mlr put -v '$x = (1 ** 2) * 3' /dev/null +run_mlr filter -v ' (1 ** 2) * 3' /dev/null + +run_mlr put -v '$x = -1 + 2 * 3' /dev/null +run_mlr filter -v ' -1 + 2 * 3' /dev/null +run_mlr put -v '$x = -1 * 2 + 3' /dev/null +run_mlr filter -v ' -1 * 2 + 3' /dev/null +run_mlr put -v '$x = 1 + -2 * 3' /dev/null +run_mlr filter -v ' 1 + -2 * 3' /dev/null +run_mlr put -v '$x = 1 * -2 + 3' /dev/null +run_mlr filter -v ' 1 * -2 + 3' /dev/null +run_mlr put -v '$x = 1 + 2 * -3' /dev/null +run_mlr filter -v ' 1 + 2 * -3' /dev/null +run_mlr put -v '$x = 1 * 2 + -3' /dev/null +run_mlr filter -v ' 1 * 2 + -3' /dev/null + +run_mlr put -v '$x = ~1 | 2 & 3' /dev/null +run_mlr filter -v ' ~1 | 2 & 3' /dev/null +run_mlr put -v '$x = ~1 & 2 | 3' /dev/null +run_mlr filter -v ' ~1 & 2 | 3' /dev/null +run_mlr put -v '$x = 1 | ~2 & 3' /dev/null +run_mlr filter -v ' 1 | ~2 & 3' /dev/null +run_mlr put -v '$x = 1 & ~2 | 3' /dev/null +run_mlr filter -v ' 1 & ~2 | 3' /dev/null +run_mlr put -v '$x = 1 | 2 & ~3' /dev/null +run_mlr filter -v ' 1 | 2 & ~3' /dev/null +run_mlr put -v '$x = 1 & 2 | ~3' /dev/null +run_mlr filter -v ' 1 & 2 | ~3' /dev/null + +run_mlr put -v '$x = $a==1 && $b == 1 && $c == 1' /dev/null +run_mlr filter -v ' $a==1 && $b == 1 && $c == 1' /dev/null +run_mlr put -v '$x = $a==1 || $b == 1 && $c == 1' /dev/null +run_mlr filter -v ' $a==1 || $b == 1 && $c == 1' /dev/null +run_mlr put -v '$x = $a==1 || $b == 1 || $c == 1' /dev/null +run_mlr filter -v ' $a==1 || $b == 1 || $c == 1' /dev/null +run_mlr put -v '$x = $a==1 && $b == 1 || $c == 1' /dev/null +run_mlr filter -v ' $a==1 && $b == 1 || $c == 1' /dev/null + +# ---------------------------------------------------------------- +announce DSL FUNCTIONAL TESTS run_mlr filter '$x>.3' $indir/abixy run_mlr filter '$x>0.3' $indir/abixy @@ -343,70 +603,149 @@ run_mlr put '$c = $a . $b' $indir/abixy run_mlr --opprint put '$nr=NR;$fnr=FNR;$nf=NF;$filenum=FILENUM' $indir/abixy $indir/abixy -announce OPERATOR PRECEDENCE AND ASSOCIATIVITY - -# Note: filter -v and put -v print the AST. Here we're checking associativity -# and precedence. -run_mlr put -v '$x=$a+$b+$c' /dev/null -run_mlr put -v '$x=$a+$b-$c' /dev/null -run_mlr put -v '$x=$a-$b-$c' /dev/null -run_mlr put -v '$x=$a-$b+$c' /dev/null - -run_mlr put -v '$x=$a*$b*$c' /dev/null -run_mlr put -v '$x=$a*$b/$c' /dev/null -run_mlr put -v '$x=$a/$b/$c' /dev/null -run_mlr put -v '$x=$a/$b*$c' /dev/null - -run_mlr put -v '$x=$a+$b+$c' /dev/null -run_mlr put -v '$x=$a+$b*$c' /dev/null -run_mlr put -v '$x=$a*$b*$c' /dev/null -run_mlr put -v '$x=$a*$b+$c' /dev/null - -run_mlr put -v '$x=$a+$b+$c' /dev/null -run_mlr put -v '$x=$a+$b**$c' /dev/null -run_mlr put -v '$x=$a**$b**$c' /dev/null -run_mlr put -v '$x=$a**$b+$c' /dev/null - -run_mlr put -v '$x=$a.$b.$c' /dev/null - -run_mlr put -v '$x=-$a+$b*$c' /dev/null -run_mlr put -v '$x=-$a*$b+$c' /dev/null -run_mlr put -v '$x=$a+-$b*$c' /dev/null -run_mlr put -v '$x=$a*-$b+$c' /dev/null -run_mlr put -v '$x=$a+$b*-$c' /dev/null -run_mlr put -v '$x=$a*$b+-$c' /dev/null - run_mlr --opprint put '$y=madd($x,10,37)' then put '$z=msub($x,10,37)' $indir/modarith.dat run_mlr --opprint put '$y=mexp($x,35,37)' then put '$z=mmul($x,$y,37)' $indir/modarith.dat -run_mlr filter -v '$a==1 && $b == 1 && $c == 1' /dev/null -run_mlr filter -v '$a==1 || $b == 1 && $c == 1' /dev/null -run_mlr filter -v '$a==1 || $b == 1 || $c == 1' /dev/null -run_mlr filter -v '$a==1 && $b == 1 || $c == 1' /dev/null +run_mlr put '$z=min($x, $y)' $indir/minmax.dkvp +run_mlr put '$z=max($x, $y)' $indir/minmax.dkvp -run_mlr filter -v '$x<$a*$b*$c' /dev/null -run_mlr filter -v '$x<$a*$b/$c' /dev/null -run_mlr filter -v '$x<$a/$b/$c' /dev/null -run_mlr filter -v '$x<$a/$b*$c' /dev/null +# ---------------------------------------------------------------- +announce DSL TYPE-INFERENCE -run_mlr filter -v '$x<$a+$b+$c' /dev/null -run_mlr filter -v '$x<$a+$b*$c' /dev/null -run_mlr filter -v '$x<$a*$b*$c' /dev/null -run_mlr filter -v '$x<$a*$b+$c' /dev/null +run_mlr --xtab put '$y=abs($pf1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=abs($nf1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=abs($zf)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=abs($pi1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=abs($ni1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=abs($zi)' $indir/mixed-types.xtab -run_mlr filter -v '$x<$a+$b+$c' /dev/null -run_mlr filter -v '$x<$a+$b**$c' /dev/null -run_mlr filter -v '$x<$a**$b**$c' /dev/null -run_mlr filter -v '$x<$a**$b+$c' /dev/null +run_mlr --xtab put -f '$y=abs($pf1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=abs($nf1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=abs($zf)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=abs($pi1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=abs($ni1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=abs($zi)' $indir/mixed-types.xtab -run_mlr filter -v '$x<$a.$b.$c' /dev/null +run_mlr --xtab put '$y=ceil($pf1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=ceil($nf1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=ceil($zf)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=ceil($pi1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=ceil($ni1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=ceil($zi)' $indir/mixed-types.xtab -run_mlr filter -v '$x<-$a+$b*$c' /dev/null -run_mlr filter -v '$x<-$a*$b+$c' /dev/null -run_mlr filter -v '$x<$a+-$b*$c' /dev/null -run_mlr filter -v '$x<$a*-$b+$c' /dev/null -run_mlr filter -v '$x<$a+$b*-$c' /dev/null -run_mlr filter -v '$x<$a*$b+-$c' /dev/null +run_mlr --xtab put -f '$y=floor($pf1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=floor($nf1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=floor($zf)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=floor($pi1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=floor($ni1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=floor($zi)' $indir/mixed-types.xtab + +run_mlr --xtab put '$y=round($pf1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=round($nf1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=round($zf)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=round($pi1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=round($ni1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=round($zi)' $indir/mixed-types.xtab + +run_mlr --xtab put -f '$y=round($pf1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=round($nf1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=round($zf)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=round($pi1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=round($ni1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=round($zi)' $indir/mixed-types.xtab + +run_mlr --xtab put '$y=sgn($pf1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=sgn($nf1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=sgn($zf)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=sgn($pi1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=sgn($ni1)' $indir/mixed-types.xtab +run_mlr --xtab put '$y=sgn($zi)' $indir/mixed-types.xtab + +run_mlr --xtab put -f '$y=sgn($pf1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=sgn($nf1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=sgn($zf)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=sgn($pi1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=sgn($ni1)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$y=sgn($zi)' $indir/mixed-types.xtab + +run_mlr --xtab put '$min=min($pf1,$pf2);$max=max($pf1,$pf2)' $indir/mixed-types.xtab +run_mlr --xtab put '$min=min($pf1,$pi2);$max=max($pf1,$pi2)' $indir/mixed-types.xtab +run_mlr --xtab put '$min=min($pi1,$pf2);$max=max($pi1,$pf2)' $indir/mixed-types.xtab +run_mlr --xtab put '$min=min($pi1,$pi2);$max=max($pi1,$pi2)' $indir/mixed-types.xtab + +run_mlr --xtab put -f '$min=min($pf1,$pf2);$max=max($pf1,$pf2)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$min=min($pf1,$pi2);$max=max($pf1,$pi2)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$min=min($pi1,$pf2);$max=max($pi1,$pf2)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$min=min($pi1,$pi2);$max=max($pi1,$pi2)' $indir/mixed-types.xtab + +run_mlr --xtab put '$min=min($pf1,$pf2);$max=max($pf1,$pf2)' $indir/mixed-types.xtab +run_mlr --xtab put '$min=min($pf1,$pi2);$max=max($pf1,$pi2)' $indir/mixed-types.xtab +run_mlr --xtab put '$min=min($pi1,$pf2);$max=max($pi1,$pf2)' $indir/mixed-types.xtab +run_mlr --xtab put '$min=min($pi1,$pi2);$max=max($pi1,$pi2)' $indir/mixed-types.xtab + +run_mlr --xtab put -f '$min=min($pf1,$pf2);$max=max($pf1,$pf2)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$min=min($pf1,$pi2);$max=max($pf1,$pi2)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$min=min($pi1,$pf2);$max=max($pi1,$pf2)' $indir/mixed-types.xtab +run_mlr --xtab put -f '$min=min($pi1,$pi2);$max=max($pi1,$pi2)' $indir/mixed-types.xtab + +run_mlr --xtab put '$sum=$pf1+$pf2;$diff=$pf1-$pf2' $indir/mixed-types.xtab +run_mlr --xtab put '$sum=$pf1+$pi2;$diff=$pf1-$pi2' $indir/mixed-types.xtab +run_mlr --xtab put '$sum=$pi1+$pf2;$diff=$pi1-$pf2' $indir/mixed-types.xtab +run_mlr --xtab put '$sum=$pi1+$pi2;$diff=$pi1-$pi2' $indir/mixed-types.xtab + +run_mlr --xtab put -f '$sum=$pf1+$pf2;$diff=$pf1-$pf2' $indir/mixed-types.xtab +run_mlr --xtab put -f '$sum=$pf1+$pi2;$diff=$pf1-$pi2' $indir/mixed-types.xtab +run_mlr --xtab put -f '$sum=$pi1+$pf2;$diff=$pi1-$pf2' $indir/mixed-types.xtab +run_mlr --xtab put -f '$sum=$pi1+$pi2;$diff=$pi1-$pi2' $indir/mixed-types.xtab + +run_mlr --xtab put '$prod=$pf1*$pf2;$quot=$pf1/$pf2' $indir/mixed-types.xtab +run_mlr --xtab put '$prod=$pf1*$pi2;$quot=$pf1/$pi2' $indir/mixed-types.xtab +run_mlr --xtab put '$prod=$pi1*$pf2;$quot=$pi1/$pf2' $indir/mixed-types.xtab +run_mlr --xtab put '$prod=$pi1*$pi2;$quot=$pi1/$pi2' $indir/mixed-types.xtab + +run_mlr --xtab put -f '$prod=$pf1*$pf2;$quot=$pf1/$pf2' $indir/mixed-types.xtab +run_mlr --xtab put -f '$prod=$pf1*$pi2;$quot=$pf1/$pi2' $indir/mixed-types.xtab +run_mlr --xtab put -f '$prod=$pi1*$pf2;$quot=$pi1/$pf2' $indir/mixed-types.xtab +run_mlr --xtab put -f '$prod=$pi1*$pi2;$quot=$pi1/$pi2' $indir/mixed-types.xtab + +run_mlr --xtab put '$iquot=$pf1//$pf2;$mod=$pf1%$pf2' $indir/mixed-types.xtab +run_mlr --xtab put '$iquot=$pf1//$pi2;$mod=$pf1%$pi2' $indir/mixed-types.xtab +run_mlr --xtab put '$iquot=$pi1//$pf2;$mod=$pi1%$pf2' $indir/mixed-types.xtab +run_mlr --xtab put '$iquot=$pi1//$pi2;$mod=$pi1%$pi2' $indir/mixed-types.xtab + +run_mlr --xtab put -f '$iquot=$pf1//$pf2;$mod=$pf1%$pf2' $indir/mixed-types.xtab +run_mlr --xtab put -f '$iquot=$pf1//$pi2;$mod=$pf1%$pi2' $indir/mixed-types.xtab +run_mlr --xtab put -f '$iquot=$pi1//$pf2;$mod=$pi1%$pf2' $indir/mixed-types.xtab +run_mlr --xtab put -f '$iquot=$pi1//$pi2;$mod=$pi1%$pi2' $indir/mixed-types.xtab + +run_mlr --xtab put '$a=roundm($pf1,10.0);$b=roundm($pf1,-10.0)' $indir/mixed-types.xtab +run_mlr --xtab put '$a=roundm($pf1,10) ;$b=roundm($pf1,-10) ' $indir/mixed-types.xtab +run_mlr --xtab put '$a=roundm($pi1,10.0);$b=roundm($pi1,-10.0)' $indir/mixed-types.xtab +run_mlr --xtab put '$a=roundm($pi1,10) ;$b=roundm($pi1,-10) ' $indir/mixed-types.xtab + +# ---------------------------------------------------------------- +announce DSL PYTHONIC DIVISION + +run_mlr --xtab put '$quot=$pf1/10.0;$iquot=$pf1//10.0;$mod=$pf1%10.0' $indir/mixed-types.xtab +run_mlr --xtab put '$quot=$pi1/10 ;$iquot=$pi1//10 ;$mod=$pi1%10 ' $indir/mixed-types.xtab +run_mlr --xtab put '$quot=$nf1/10.0;$iquot=$nf1//10.0;$mod=$nf1%10.0' $indir/mixed-types.xtab +run_mlr --xtab put '$quot=$ni1/10 ;$iquot=$ni1//10 ;$mod=$ni1%10 ' $indir/mixed-types.xtab +run_mlr --xtab put -f '$quot=$pf1/10.0;$iquot=$pf1//10.0;$mod=$pf1%10.0' $indir/mixed-types.xtab +run_mlr --xtab put -f '$quot=$pi1/10 ;$iquot=$pi1//10 ;$mod=$pi1%10 ' $indir/mixed-types.xtab +run_mlr --xtab put -f '$quot=$nf1/10.0;$iquot=$nf1//10.0;$mod=$nf1%10.0' $indir/mixed-types.xtab +run_mlr --xtab put -f '$quot=$ni1/10 ;$iquot=$ni1//10 ;$mod=$ni1%10 ' $indir/mixed-types.xtab + +run_mlr --xtab put '$quot=$pf1/-10.0;$iquot=$pf1//-10.0;$mod=$pf1%-10.0' $indir/mixed-types.xtab +run_mlr --xtab put '$quot=$pi1/-10 ;$iquot=$pi1//-10 ;$mod=$pi1%-10 ' $indir/mixed-types.xtab +run_mlr --xtab put '$quot=$nf1/-10.0;$iquot=$nf1//-10.0;$mod=$nf1%-10.0' $indir/mixed-types.xtab +run_mlr --xtab put '$quot=$ni1/-10 ;$iquot=$ni1//-10 ;$mod=$ni1%-10 ' $indir/mixed-types.xtab +run_mlr --xtab put -f '$quot=$pf1/-10.0;$iquot=$pf1//-10.0;$mod=$pf1%-10.0' $indir/mixed-types.xtab +run_mlr --xtab put -f '$quot=$pi1/-10 ;$iquot=$pi1//-10 ;$mod=$pi1%-10 ' $indir/mixed-types.xtab +run_mlr --xtab put -f '$quot=$nf1/-10.0;$iquot=$nf1//-10.0;$mod=$nf1%-10.0' $indir/mixed-types.xtab +run_mlr --xtab put -f '$quot=$ni1/-10 ;$iquot=$ni1//-10 ;$mod=$ni1%-10 ' $indir/mixed-types.xtab + +# ---------------------------------------------------------------- +announce DSL REGEX MATCHING run_mlr filter -v '$x =~ "bcd"' $indir/regex.dkvp run_mlr filter -v '$x =~ "^bcd"' $indir/regex.dkvp @@ -423,20 +762,21 @@ run_mlr filter -v '$x =~ "^abc$"i' $indir/regex.dkvp run_mlr filter -v '$x =~ "^a.*d$"i' $indir/regex.dkvp run_mlr filter -v '$x =~ "^a.*"."d$"i' $indir/regex.dkvp +# ---------------------------------------------------------------- +announce DSL DATETIME FUNCTIONS + run_mlr --csvlite put '$gmt=sec2gmt($sec)' $indir/sec2gmt run_mlr --csvlite put '$sec=gmt2sec($gmt)' $indir/gmt2sec run_mlr --csvlite sec2gmt sec $indir/sec2gmt -run_mlr put '$z=min($x, $y)' $indir/minmax.dkvp -run_mlr put '$z=max($x, $y)' $indir/minmax.dkvp - run_mlr --opprint put '$hms=sec2hms($sec); $resec=hms2sec($hms); $diff=$resec-$sec' $indir/sec2xhms run_mlr --opprint put '$hms=fsec2hms($sec); $resec=hms2fsec($hms); $diff=$resec-$sec' $indir/fsec2xhms run_mlr --opprint put '$hms=sec2dhms($sec); $resec=dhms2sec($hms); $diff=$resec-$sec' $indir/sec2xhms run_mlr --opprint put '$hms=fsec2dhms($sec); $resec=dhms2fsec($hms); $diff=$resec-$sec' $indir/fsec2xhms -announce SUB/GSUB +# ---------------------------------------------------------------- +announce DSL SUB/GSUB run_mlr --opprint put '$y = sub($x, "e.*l", "y123y")' $indir/sub.dat run_mlr --opprint put '$y = sub($x, "e.*l"i, "y123y")' $indir/sub.dat @@ -614,7 +954,7 @@ run_mlr --icsvlite --oxtab cat $indir/utf8-2.csv run_mlr --inidx --ifs space --opprint cat $indir/utf8-align.nidx run_mlr --inidx --ifs space --opprint --right cat $indir/utf8-align.nidx -run_mlr --oxtab cat $indir/utf8-align.dkvp +run_mlr --oxtab cat $indir/utf8-align.dkvp run_mlr --inidx --ifs space --oxtab --xvright cat $indir/utf8-align.nidx diff --git a/c/todo.txt b/c/todo.txt index 6a26fde86..b84fa5cda 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -22,12 +22,17 @@ TOP OF LIST ! try to get a grip on jb issues 1st * full-int64 I/O & math: - o expanded UTs x all of + - ~ * / // % abs ceil floor max min round roundm sgn. incl. ./tmod - o UT for ~ ^^ | ^ & << >> in both grammars; UT for matches etc. in put grammar; sgn. + - proofread associativity & precedence UTs + - proofread int/float UTs x all of + - ~ * / // % abs ceil floor max min round roundm sgn. incl. ./tmod + - proofread put/filter -s/-f tests + ! -75 // 10 + ! 75 // -10 o visually check all precedence stackings (horiz/vert) in the grammars - o urandint -> w/urand @ mlr -h, mld, etc. - o faqent '$y=~$x' vs. '$y= ~$x'; mlr filter '-$y==-$x' error @ cli parse due to leading - + o faqent '$y=~$x' vs. '$y= ~$x'; also, mlr filter '-$y==-$x' error @ cli parse due to leading "-". o dsls bake deps + o filter/put -s + ? $y = ! ! $x + o more functional tests Operators Associativity --------- ------------- @@ -43,8 +48,9 @@ TOP OF LIST < <= > >= left to right == != =~ !=~ left to right && left to right + ^^ left to right || left to right - = N/A for Miller (these is no $a=$b=$c) + = N/A for Miller (there is no $a=$b=$c) * packaging: - brew version bump?!? diff --git a/doc/content-for-reference.html b/doc/content-for-reference.html index 319905004..ab833430f 100644 --- a/doc/content-for-reference.html +++ b/doc/content-for-reference.html @@ -809,6 +809,7 @@ binary+ binary- . left to right < <= > >= left to right == != =~ !=~ left to right && left to right +^^ left to right || left to right = N/A for Miller (there is no $a=$b=$c) @@ -826,8 +827,8 @@ library.
  • Numbers in Miller are double-precision float or 64-bit signed integers. For most math functions, integers are cast to float on input, and produce float output.
  • The following, however, produce integer output if all inputs are -integers: + - ~ * / // -% abs ceil floor max min +integers: + - * / // % +abs ceil floor max min round roundm sgn. Note that integer overflow is possible for large numbers when inputs look like integers. Explicit use of float() (e.g. replacing $c = $a * $b with $c = float($a) diff --git a/doc/mlr.1.premade b/doc/mlr.1.premade index 1c06bdc82..e5b13d3cc 100644 --- a/doc/mlr.1.premade +++ b/doc/mlr.1.premade @@ -2,12 +2,12 @@ .\" Title: mlr .\" Author: [see the "AUTHOR" section] .\" Generator: ./mkman.rb -.\" Date: 2015-11-15 +.\" Date: 2015-11-16 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "MILLER" "1" "2015-11-15" "\ \&" "\ \&" +.TH "MILLER" "1" "2015-11-16" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Portability definitions .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -257,7 +257,8 @@ Please use "mlr --help-all-functions" or "mlr -f" for help on all functions. .RS 0 .\} .nf - --seed {n} with n of the form 12345678 or 0xcafefeed. For put/filter urand(). + --seed {n} with n of the form 12345678 or 0xcafefeed. For put/filter + urand()/urandint(). .fi .if n \{\ .RE diff --git a/doc/reference.html b/doc/reference.html index a72d6b81d..855f69473 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -376,7 +376,8 @@ Numerical formatting: function within mlr put (mlr --help-all-functions). Other options: - --seed {n} with n of the form 12345678 or 0xcafefeed. For put/filter urand(). + --seed {n} with n of the form 12345678 or 0xcafefeed. For put/filter + urand()/urandint(). Then-chaining: Output of one verb may be chained as input to another using "then", e.g. @@ -2946,6 +2947,7 @@ binary+ binary- . left to right < <= > >= left to right == != =~ !=~ left to right && left to right +^^ left to right || left to right = N/A for Miller (there is no $a=$b=$c)