diff --git a/go/reg-test/cases/case-c-dsl-functional-tests.sh b/go/reg-test/cases/case-dsl-functional-tests.sh similarity index 100% rename from go/reg-test/cases/case-c-dsl-functional-tests.sh rename to go/reg-test/cases/case-dsl-functional-tests.sh diff --git a/go/reg-test/cases/case-c-dsl-mapvar-emit.sh b/go/reg-test/cases/case-dsl-mapvar-emit.sh similarity index 100% rename from go/reg-test/cases/case-c-dsl-mapvar-emit.sh rename to go/reg-test/cases/case-dsl-mapvar-emit.sh diff --git a/go/reg-test/cases/case-c-dsl-oosvar-assignments.sh b/go/reg-test/cases/case-dsl-oosvar-assignments.sh similarity index 100% rename from go/reg-test/cases/case-c-dsl-oosvar-assignments.sh rename to go/reg-test/cases/case-dsl-oosvar-assignments.sh diff --git a/go/reg-test/expected/case-c-dsl-for-oosvar-loops.sh.out b/go/reg-test/expected/case-c-dsl-for-oosvar-loops.sh.out index cdf3cc047..082d29ab3 100644 --- a/go/reg-test/expected/case-c-dsl-for-oosvar-loops.sh.out +++ b/go/reg-test/expected/case-c-dsl-for-oosvar-loops.sh.out @@ -10,131 +10,88 @@ mlr --opprint -n put -v emit @n, "a", "b", "c", "d" } +DSL EXPRESSION: + + @o[1][1]["text1"][NR] = $a; + @o[1][2]["text2"][NR] = $b; + @o[1][2][$a][$i*100] = $x; + for((k1,k2),v in @o[1][2]) { + @n[3][4][k2][k1] = v; + } + end { + emit @n, "a", "b", "c", "d" + } + RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="o", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="text1", type=STRING_LITERAL. - text="NR", type=CONTEXT_VARIABLE. - text="a", type=FIELD_NAME. - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="o", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="text2", type=STRING_LITERAL. - text="NR", type=CONTEXT_VARIABLE. - text="b", type=FIELD_NAME. - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="o", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="a", type=FIELD_NAME. - text="*", type=OPERATOR: - text="i", type=FIELD_NAME. - text="100", type=NUMERIC_LITERAL. - text="x", type=FIELD_NAME. - text="for", type=FOR_OOSVAR: - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="k1", type=UNTYPED_LOCAL_DEFINITION. - text="k2", type=UNTYPED_LOCAL_DEFINITION. - text="v", type=UNTYPED_LOCAL_DEFINITION. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="o", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="for_loop_oosvar_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="n", type=STRING_LITERAL. - text="3", type=NUMERIC_LITERAL. - text="4", type=NUMERIC_LITERAL. - text="k2", type=NONINDEXED_LOCAL_VARIABLE. - text="k1", type=NONINDEXED_LOCAL_VARIABLE. - text="v", type=NONINDEXED_LOCAL_VARIABLE. - text="end", type=END: - text="end_block", type=STATEMENT_BLOCK: - text="emit", type=EMIT: - text="emit", type=EMIT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="n", type=STRING_LITERAL. - text="emit_namelist", type=EMIT: - text="a", type=STRING_LITERAL. - text="b", type=STRING_LITERAL. - text="c", type=STRING_LITERAL. - text="d", type=STRING_LITERAL. - text="stream", type=STREAM: - -BLOCKED AST: - -END-BLOCK: -text="end", type=END: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="end_block", type=STATEMENT_BLOCK: - text="emit", type=EMIT: - text="emit", type=EMIT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="n", type=STRING_LITERAL. - text="emit_namelist", type=EMIT: - text="a", type=STRING_LITERAL. - text="b", type=STRING_LITERAL. - text="c", type=STRING_LITERAL. - text="d", type=STRING_LITERAL. - text="stream", type=STREAM: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=2 max_var_depth=4 - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="o", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="text1", type=STRING_LITERAL. - text="NR", type=CONTEXT_VARIABLE. - text="a", type=FIELD_NAME. - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="o", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="text2", type=STRING_LITERAL. - text="NR", type=CONTEXT_VARIABLE. - text="b", type=FIELD_NAME. - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="o", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="a", type=FIELD_NAME. - text="*", type=OPERATOR: - text="i", type=FIELD_NAME. - text="100", type=NUMERIC_LITERAL. - text="x", type=FIELD_NAME. - text="for", type=FOR_OOSVAR: subframe_var_count=3 - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="k1", type=UNTYPED_LOCAL_DEFINITION. vardef_subframe_relative_index=0 vardef_subframe_index=1 vardef_frame_relative_index=1 - text="k2", type=UNTYPED_LOCAL_DEFINITION. vardef_subframe_relative_index=1 vardef_subframe_index=1 vardef_frame_relative_index=2 - text="v", type=UNTYPED_LOCAL_DEFINITION. vardef_subframe_relative_index=2 vardef_subframe_index=1 vardef_frame_relative_index=3 - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="o", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="for_loop_oosvar_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="n", type=STRING_LITERAL. - text="3", type=NUMERIC_LITERAL. - text="4", type=NUMERIC_LITERAL. - text="k2", type=NONINDEXED_LOCAL_VARIABLE. vardef_subframe_relative_index=1 vardef_subframe_index=1 vardef_frame_relative_index=2 - text="k1", type=NONINDEXED_LOCAL_VARIABLE. vardef_subframe_relative_index=0 vardef_subframe_index=1 vardef_frame_relative_index=1 - text="v", type=NONINDEXED_LOCAL_VARIABLE. vardef_subframe_relative_index=2 vardef_subframe_index=1 vardef_frame_relative_index=3 +* statement block + * assignment "=" + * array or map index access "[]" + * array or map index access "[]" + * array or map index access "[]" + * array or map index access "[]" + * direct oosvar value "o" + * int literal "1" + * int literal "1" + * string literal "text1" + * context variable "NR" + * direct field value "a" + * assignment "=" + * array or map index access "[]" + * array or map index access "[]" + * array or map index access "[]" + * array or map index access "[]" + * direct oosvar value "o" + * int literal "1" + * int literal "2" + * string literal "text2" + * context variable "NR" + * direct field value "b" + * assignment "=" + * array or map index access "[]" + * array or map index access "[]" + * array or map index access "[]" + * array or map index access "[]" + * direct oosvar value "o" + * int literal "1" + * int literal "2" + * direct field value "a" + * operator "*" + * direct field value "i" + * int literal "100" + * direct field value "x" + * multi-variable for-loop "for" + * parameter list + * local variable "k1" + * local variable "k2" + * local variable "v" + * array or map index access "[]" + * array or map index access "[]" + * direct oosvar value "o" + * int literal "1" + * int literal "2" + * statement block + * assignment "=" + * array or map index access "[]" + * array or map index access "[]" + * array or map index access "[]" + * array or map index access "[]" + * direct oosvar value "n" + * int literal "3" + * int literal "4" + * local variable "k2" + * local variable "k1" + * local variable "v" + * end block + * statement block + * emit statement "emit" + * emittable list + * direct oosvar value "n" + * emit keys + * string literal "a" + * string literal "b" + * string literal "c" + * string literal "d" + * no-op mlr --opprint --from ./reg-test/input/abixy put -q @@ -150,25 +107,25 @@ mlr --opprint --from ./reg-test/input/abixy put -q a b c d n 3 4 1 text2 pan -3 4 100 pan 0.346790 +3 4 100 pan 0.3467901443380824 3 4 2 text2 pan -3 4 200 eks 0.758680 +3 4 200 eks 0.7586799647899636 3 4 3 text2 wye -3 4 300 wye 0.204603 +3 4 300 wye 0.20460330576630303 3 4 4 text2 wye -3 4 400 eks 0.381399 +3 4 400 eks 0.38139939387114097 3 4 5 text2 pan -3 4 500 wye 0.573289 +3 4 500 wye 0.5732889198020006 3 4 6 text2 pan -3 4 600 zee 0.527126 +3 4 600 zee 0.5271261600918548 3 4 7 text2 zee -3 4 700 eks 0.611784 +3 4 700 eks 0.6117840605678454 3 4 8 text2 wye -3 4 800 zee 0.598554 +3 4 800 zee 0.5985540091064224 3 4 9 text2 wye -3 4 900 hat 0.031442 +3 4 900 hat 0.03144187646093577 3 4 10 text2 wye -3 4 1000 pan 0.502626 +3 4 1000 pan 0.5026260055412137 mlr --opprint --from ./reg-test/input/abixy put -q @sum[$a][$b] += $x; @@ -183,16 +140,16 @@ mlr --opprint --from ./reg-test/input/abixy put -q } a b sum -pan pan 0.346790 -pan wye 0.502626 -eks pan 0.758680 -eks wye 0.381399 -eks zee 0.611784 -wye wye 0.204603 -wye pan 0.573289 -zee pan 0.527126 -zee wye 0.598554 -hat wye 0.031442 +pan pan 0.3467901443380824 +pan wye 0.5026260055412137 +eks pan 0.7586799647899636 +eks wye 0.38139939387114097 +eks zee 0.6117840605678454 +wye wye 0.20460330576630303 +wye pan 0.5732889198020006 +zee pan 0.5271261600918548 +zee wye 0.5985540091064224 +hat wye 0.03144187646093577 a b count pan pan 1 @@ -207,16 +164,16 @@ zee wye 1 hat wye 1 a b mean -pan pan 0.346790 -pan wye 0.502626 -eks pan 0.758680 -eks wye 0.381399 -eks zee 0.611784 -wye wye 0.204603 -wye pan 0.573289 -zee pan 0.527126 -zee wye 0.598554 -hat wye 0.031442 +pan pan 0.3467901443380824 +pan wye 0.5026260055412137 +eks pan 0.7586799647899636 +eks wye 0.38139939387114097 +eks zee 0.6117840605678454 +wye wye 0.20460330576630303 +wye pan 0.5732889198020006 +zee pan 0.5271261600918548 +zee wye 0.5985540091064224 +hat wye 0.03144187646093577 mlr --opprint --from ./reg-test/input/abixy-wide put -q @value["sum"][$a][$b] += $x; @@ -229,31 +186,31 @@ mlr --opprint --from ./reg-test/input/abixy-wide put -q } stat a b value -sum cat pan 42.327158 -sum cat hat 43.184410 -sum cat dog 39.241473 -sum cat wye 45.196775 -sum cat cat 37.894148 -sum pan wye 40.135300 -sum pan pan 36.226334 -sum pan hat 35.115869 -sum pan dog 37.817560 -sum pan cat 42.235677 -sum wye cat 40.805723 -sum wye hat 41.166697 -sum wye dog 40.619547 -sum wye wye 32.490973 -sum wye pan 33.027196 -sum dog hat 43.515162 -sum dog pan 45.614011 -sum dog dog 43.545956 -sum dog wye 37.223795 -sum dog cat 45.642595 -sum hat hat 48.058897 -sum hat wye 34.054270 -sum hat pan 42.538758 -sum hat cat 44.325655 -sum hat dog 37.114244 +sum cat pan 42.327158262573356 +sum cat hat 43.18440957220826 +sum cat dog 39.2414728534826 +sum cat wye 45.19677452417291 +sum cat cat 37.89414847588904 +sum pan wye 40.135299712550946 +sum pan pan 36.2263342663248 +sum pan hat 35.115869257879424 +sum pan dog 37.81756018831723 +sum pan cat 42.23567663351311 +sum wye cat 40.80572298410698 +sum wye hat 41.16669669994168 +sum wye dog 40.61954681601182 +sum wye wye 32.49097273832244 +sum wye pan 33.027195515326675 +sum dog hat 43.515162210434674 +sum dog pan 45.61401108323896 +sum dog dog 43.545955695964984 +sum dog wye 37.223794671791296 +sum dog cat 45.64259509789859 +sum hat hat 48.05889741913474 +sum hat wye 34.05426961857805 +sum hat pan 42.53875750027864 +sum hat cat 44.325654701613004 +sum hat dog 37.11424443327952 count cat pan 89 count cat hat 90 count cat dog 78 @@ -279,198 +236,198 @@ count hat wye 70 count hat pan 85 count hat cat 88 count hat dog 78 -mean cat pan 0.475586 -mean cat hat 0.479827 -mean cat dog 0.503096 -mean cat wye 0.586971 -mean cat cat 0.479673 -mean pan wye 0.514555 -mean pan pan 0.470472 -mean pan hat 0.524117 -mean pan dog 0.518049 -mean pan cat 0.474558 -mean wye cat 0.551429 -mean wye hat 0.473180 -mean wye dog 0.534468 -mean wye wye 0.484940 -mean wye pan 0.500412 -mean dog hat 0.494490 -mean dog pan 0.524299 -mean dog dog 0.500528 -mean dog wye 0.471187 -mean dog cat 0.549911 -mean hat hat 0.546124 -mean hat wye 0.486490 -mean hat pan 0.500456 -mean hat cat 0.503701 -mean hat dog 0.475824 +mean cat pan 0.47558604789408265 +mean cat hat 0.47982677302453625 +mean cat dog 0.5030958058138795 +mean cat wye 0.5869710977165313 +mean cat cat 0.47967276551758276 +mean pan wye 0.5145551245198839 +mean pan pan 0.47047187358863374 +mean pan hat 0.5241174516101407 +mean pan dog 0.5180487697029758 +mean pan cat 0.4745581644214956 +mean wye cat 0.5514286889744187 +mean wye hat 0.47318042183841014 +mean wye dog 0.5344677212633134 +mean wye wye 0.4849398916167528 +mean wye pan 0.5004120532625254 +mean dog hat 0.49449047966403037 +mean dog pan 0.5242989779682639 +mean dog dog 0.5005282263904022 +mean dog wye 0.4711872743264721 +mean dog cat 0.5499107843120312 +mean hat hat 0.5461238343083493 +mean hat wye 0.4864895659796864 +mean hat pan 0.5004559705915135 +mean hat cat 0.5037006216092387 +mean hat dog 0.47582364658050663 mlr -n put -v for (k, k in $*) {} +DSL EXPRESSION: +for (k, k in $*) {} RAW AST: +* statement block + * double-variable for-loop "for" + * local variable "k" + * local variable "k" + * full record "$*" + * statement block -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="for", type=FOR_SREC: - text="variables", type=FOR_VARIABLES: - text="k", type=UNTYPED_LOCAL_DEFINITION. - text="k", type=UNTYPED_LOCAL_DEFINITION. - text="for_full_srec_block", type=STATEMENT_BLOCK: -mlr: redefinition of variable k in the same scope. +Exit status was 0; expected 1. mlr -n put -v for (k, k in @*) {} +DSL EXPRESSION: +for (k, k in @*) {} RAW AST: +* statement block + * double-variable for-loop "for" + * local variable "k" + * local variable "k" + * full oosvar "@*" + * statement block -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="for", type=FOR_OOSVAR: - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="k", type=UNTYPED_LOCAL_DEFINITION. - text="k", type=UNTYPED_LOCAL_DEFINITION. - text="empty_keylist", type=OOSVAR_KEYLIST: - text="for_full_oosvar_block", type=STATEMENT_BLOCK: -mlr: redefinition of variable k in the same scope. +Exit status was 0; expected 1. mlr -n put -v for ((a,a), c in @*) {} +DSL EXPRESSION: +for ((a,a), c in @*) {} RAW AST: +* statement block + * multi-variable for-loop "for" + * parameter list + * local variable "a" + * local variable "a" + * local variable "c" + * full oosvar "@*" + * statement block -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="for", type=FOR_OOSVAR: - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="c", type=UNTYPED_LOCAL_DEFINITION. - text="empty_keylist", type=OOSVAR_KEYLIST: - text="for_full_oosvar_block", type=STATEMENT_BLOCK: -mlr: redefinition of variable a in the same scope. +Exit status was 0; expected 1. mlr -n put -v for ((a,b), a in @*) {} +DSL EXPRESSION: +for ((a,b), a in @*) {} RAW AST: +* statement block + * multi-variable for-loop "for" + * parameter list + * local variable "a" + * local variable "b" + * local variable "a" + * full oosvar "@*" + * statement block -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="for", type=FOR_OOSVAR: - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="b", type=UNTYPED_LOCAL_DEFINITION. - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="empty_keylist", type=OOSVAR_KEYLIST: - text="for_full_oosvar_block", type=STATEMENT_BLOCK: -mlr: redefinition of variable a in the same scope. +Exit status was 0; expected 1. mlr -n put -v for ((a,b), b in @*) {} +DSL EXPRESSION: +for ((a,b), b in @*) {} RAW AST: +* statement block + * multi-variable for-loop "for" + * parameter list + * local variable "a" + * local variable "b" + * local variable "b" + * full oosvar "@*" + * statement block -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="for", type=FOR_OOSVAR: - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="b", type=UNTYPED_LOCAL_DEFINITION. - text="b", type=UNTYPED_LOCAL_DEFINITION. - text="empty_keylist", type=OOSVAR_KEYLIST: - text="for_full_oosvar_block", type=STATEMENT_BLOCK: -mlr: redefinition of variable b in the same scope. +Exit status was 0; expected 1. mlr -n put -v for ((a,a,c), d in @*) {} +DSL EXPRESSION: +for ((a,a,c), d in @*) {} RAW AST: +* statement block + * multi-variable for-loop "for" + * parameter list + * local variable "a" + * local variable "a" + * local variable "c" + * local variable "d" + * full oosvar "@*" + * statement block -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="for", type=FOR_OOSVAR: - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="c", type=UNTYPED_LOCAL_DEFINITION. - text="d", type=UNTYPED_LOCAL_DEFINITION. - text="empty_keylist", type=OOSVAR_KEYLIST: - text="for_full_oosvar_block", type=STATEMENT_BLOCK: -mlr: redefinition of variable a in the same scope. +Exit status was 0; expected 1. mlr -n put -v for ((a,b,a), d in @*) {} +DSL EXPRESSION: +for ((a,b,a), d in @*) {} RAW AST: +* statement block + * multi-variable for-loop "for" + * parameter list + * local variable "a" + * local variable "b" + * local variable "a" + * local variable "d" + * full oosvar "@*" + * statement block -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="for", type=FOR_OOSVAR: - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="b", type=UNTYPED_LOCAL_DEFINITION. - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="d", type=UNTYPED_LOCAL_DEFINITION. - text="empty_keylist", type=OOSVAR_KEYLIST: - text="for_full_oosvar_block", type=STATEMENT_BLOCK: -mlr: redefinition of variable a in the same scope. +Exit status was 0; expected 1. mlr -n put -v for ((a,b,c), a in @*) {} +DSL EXPRESSION: +for ((a,b,c), a in @*) {} RAW AST: +* statement block + * multi-variable for-loop "for" + * parameter list + * local variable "a" + * local variable "b" + * local variable "c" + * local variable "a" + * full oosvar "@*" + * statement block -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="for", type=FOR_OOSVAR: - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="b", type=UNTYPED_LOCAL_DEFINITION. - text="c", type=UNTYPED_LOCAL_DEFINITION. - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="empty_keylist", type=OOSVAR_KEYLIST: - text="for_full_oosvar_block", type=STATEMENT_BLOCK: -mlr: redefinition of variable a in the same scope. +Exit status was 0; expected 1. mlr -n put -v for ((a,b,b), d in @*) {} +DSL EXPRESSION: +for ((a,b,b), d in @*) {} RAW AST: +* statement block + * multi-variable for-loop "for" + * parameter list + * local variable "a" + * local variable "b" + * local variable "b" + * local variable "d" + * full oosvar "@*" + * statement block -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="for", type=FOR_OOSVAR: - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="b", type=UNTYPED_LOCAL_DEFINITION. - text="b", type=UNTYPED_LOCAL_DEFINITION. - text="d", type=UNTYPED_LOCAL_DEFINITION. - text="empty_keylist", type=OOSVAR_KEYLIST: - text="for_full_oosvar_block", type=STATEMENT_BLOCK: -mlr: redefinition of variable b in the same scope. +Exit status was 0; expected 1. mlr -n put -v for ((a,b,c), b in @*) {} +DSL EXPRESSION: +for ((a,b,c), b in @*) {} RAW AST: +* statement block + * multi-variable for-loop "for" + * parameter list + * local variable "a" + * local variable "b" + * local variable "c" + * local variable "b" + * full oosvar "@*" + * statement block -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="for", type=FOR_OOSVAR: - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="b", type=UNTYPED_LOCAL_DEFINITION. - text="c", type=UNTYPED_LOCAL_DEFINITION. - text="b", type=UNTYPED_LOCAL_DEFINITION. - text="empty_keylist", type=OOSVAR_KEYLIST: - text="for_full_oosvar_block", type=STATEMENT_BLOCK: -mlr: redefinition of variable b in the same scope. +Exit status was 0; expected 1. mlr -n put -v for ((a,b,c), c in @*) {} +DSL EXPRESSION: +for ((a,b,c), c in @*) {} RAW AST: +* statement block + * multi-variable for-loop "for" + * parameter list + * local variable "a" + * local variable "b" + * local variable "c" + * local variable "c" + * full oosvar "@*" + * statement block -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="for", type=FOR_OOSVAR: - text="key_and_value_variables", type=FOR_VARIABLES: - text="key_variables", type=FOR_VARIABLES: - text="a", type=UNTYPED_LOCAL_DEFINITION. - text="b", type=UNTYPED_LOCAL_DEFINITION. - text="c", type=UNTYPED_LOCAL_DEFINITION. - text="c", type=UNTYPED_LOCAL_DEFINITION. - text="empty_keylist", type=OOSVAR_KEYLIST: - text="for_full_oosvar_block", type=STATEMENT_BLOCK: -mlr: redefinition of variable c in the same scope. +Exit status was 0; expected 1. mlr --from ./reg-test/input/xyz2 put -q func f() { return {"a"."b":"c"."d",3:4}}; for (k,v in f()){print "k=".k.",v=".v} k=ab,v=cd diff --git a/go/reg-test/expected/case-c-dsl-mapvar-emit.sh.out b/go/reg-test/expected/case-c-dsl-mapvar-emit.sh.out deleted file mode 100644 index 370e40310..000000000 --- a/go/reg-test/expected/case-c-dsl-mapvar-emit.sh.out +++ /dev/null @@ -1,47 +0,0 @@ - - -================================================================ -MAPVAR EMIT - -mlr -n put end { - @a[2][3] = 4; - b[2][3] = 8; - emit (@a, b, {2:{3:12}}); - emitp (@a, b, {2:{3:12}}); - emit {}; - emit (@a, b, {2:{3:12}}), "t"; - emitp (@a, b, {2:{3:12}}), "t"; - emit {}; - emit (@a, b, {2:{3:12}}), "t", "u"; - emitp (@a, b, {2:{3:12}}), "t", "u"; -} -3=12 -a:2:3=4,b:2:3=8,_:2:3=12 - -t=2,3=12 -t=2,a:3=4,b:3=8,_:3=12 - -t=2,u=3,a=4,b=8,_=12 -t=2,u=3,a=4,b=8,_=12 - -mlr -n put end { - @a[2][3] = 4; - b[2][3] = 8; - emitp (@a, b, {2:{3:12}}); - emit (@a, b, {2:{3:12}}); - emit {}; - emitp (@a, b, {2:{3:12}}), "t"; - emit (@a, b, {2:{3:12}}), "t"; - emit {}; - emitp (@a, b, {2:{3:12}}), "t", "u"; - emit (@a, b, {2:{3:12}}), "t", "u"; -} -a:2:3=4,b:2:3=8,_:2:3=12 -3=12 - -t=2,a:3=4,b:3=8,_:3=12 -t=2,3=12 - -t=2,u=3,a=4,b=8,_=12 -t=2,u=3,a=4,b=8,_=12 - diff --git a/go/reg-test/expected/case-c-dsl-oosvar-assignments.sh.out b/go/reg-test/expected/case-c-dsl-oosvar-assignments.sh.out deleted file mode 100644 index cb93c1458..000000000 --- a/go/reg-test/expected/case-c-dsl-oosvar-assignments.sh.out +++ /dev/null @@ -1,1279 +0,0 @@ - - -================================================================ -OOSVAR-FROM-SREC ASSIGNMENT - -mlr put -v @v = $* /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="$*", type=FULL_SREC. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="$*", type=FULL_SREC. - - -mlr put -v @v[1] = $* /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="$*", type=FULL_SREC. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="$*", type=FULL_SREC. - - -mlr put -v @v[$2] = $* /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="2", type=FIELD_NAME. - text="$*", type=FULL_SREC. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="2", type=FIELD_NAME. - text="$*", type=FULL_SREC. - - -mlr put -v NR == 3 {@v = $*} /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="$*", type=FULL_SREC. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=2 max_var_depth=1 - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: subframe_var_count=0 - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="$*", type=FULL_SREC. - - -mlr put -v NR == 3 {@v[1] = $*} /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="$*", type=FULL_SREC. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=2 max_var_depth=1 - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: subframe_var_count=0 - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - text="$*", type=FULL_SREC. - - -mlr put -v NR == 3 {@v[$2] = $*} /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="2", type=FIELD_NAME. - text="$*", type=FULL_SREC. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=2 max_var_depth=1 - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: subframe_var_count=0 - text="=", type=OOSVAR_FROM_FULL_SREC_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="2", type=FIELD_NAME. - text="$*", type=FULL_SREC. - - -mlr --oxtab put -q @v = $*; end {emitp @v } ./reg-test/input/abixy-het -v:a pan -v:b wye -v:i 10 -v:x 0.5026260055412137 -v:y 0.9526183602969864 - -mlr --oxtab put -q @v[$a] = $*; end {emitp @v } ./reg-test/input/abixy-het -v:pan:a pan -v:pan:b wye -v:pan:i 10 -v:pan:x 0.5026260055412137 -v:pan:y 0.9526183602969864 -v:eks:a eks -v:eks:b zee -v:eks:iii 7 -v:eks:x 0.6117840605678454 -v:eks:y 0.1878849191181694 -v:wye:a wye -v:wye:b pan -v:wye:i 5 -v:wye:xxx 0.5732889198020006 -v:wye:y 0.8636244699032729 -v:zee:a zee -v:zee:b wye -v:zee:i 8 -v:zee:x 0.5985540091064224 -v:zee:yyy 0.976181385699006 - -mlr --oxtab put -q @v[$a] = $*; end {emitp @v, "a" } ./reg-test/input/abixy-het -a pan -v:a pan -v:b wye -v:i 10 -v:x 0.5026260055412137 -v:y 0.9526183602969864 - -a eks -v:a eks -v:b zee -v:iii 7 -v:x 0.6117840605678454 -v:y 0.1878849191181694 - -a wye -v:a wye -v:b pan -v:i 5 -v:xxx 0.5732889198020006 -v:y 0.8636244699032729 - -a zee -v:a zee -v:b wye -v:i 8 -v:x 0.5985540091064224 -v:yyy 0.976181385699006 - -mlr --oxtab put -q @v[$a][$b] = $*; end {emitp @v } ./reg-test/input/abixy-het -v:pan:pan:a pan -v:pan:pan:b pan -v:pan:pan:i 1 -v:pan:pan:x 0.3467901443380824 -v:pan:pan:y 0.7268028627434533 -v:pan:wye:a pan -v:pan:wye:b wye -v:pan:wye:i 10 -v:pan:wye:x 0.5026260055412137 -v:pan:wye:y 0.9526183602969864 -v:eks:pan:a eks -v:eks:pan:b pan -v:eks:pan:i 2 -v:eks:pan:x 0.7586799647899636 -v:eks:pan:y 0.5221511083334797 -v:eks:zee:a eks -v:eks:zee:b zee -v:eks:zee:iii 7 -v:eks:zee:x 0.6117840605678454 -v:eks:zee:y 0.1878849191181694 -v:wye:pan:a wye -v:wye:pan:b pan -v:wye:pan:i 5 -v:wye:pan:xxx 0.5732889198020006 -v:wye:pan:y 0.8636244699032729 -v:zee:pan:a zee -v:zee:pan:b pan -v:zee:pan:i 6 -v:zee:pan:x 0.5271261600918548 -v:zee:pan:y 0.49322128674835697 -v:zee:wye:a zee -v:zee:wye:b wye -v:zee:wye:i 8 -v:zee:wye:x 0.5985540091064224 -v:zee:wye:yyy 0.976181385699006 - -mlr --oxtab put -q @v[$a][$b] = $*; end {emitp @v, "a" } ./reg-test/input/abixy-het -a pan -v:pan:a pan -v:pan:b pan -v:pan:i 1 -v:pan:x 0.3467901443380824 -v:pan:y 0.7268028627434533 -v:wye:a pan -v:wye:b wye -v:wye:i 10 -v:wye:x 0.5026260055412137 -v:wye:y 0.9526183602969864 - -a eks -v:pan:a eks -v:pan:b pan -v:pan:i 2 -v:pan:x 0.7586799647899636 -v:pan:y 0.5221511083334797 -v:zee:a eks -v:zee:b zee -v:zee:iii 7 -v:zee:x 0.6117840605678454 -v:zee:y 0.1878849191181694 - -a wye -v:pan:a wye -v:pan:b pan -v:pan:i 5 -v:pan:xxx 0.5732889198020006 -v:pan:y 0.8636244699032729 - -a zee -v:pan:a zee -v:pan:b pan -v:pan:i 6 -v:pan:x 0.5271261600918548 -v:pan:y 0.49322128674835697 -v:wye:a zee -v:wye:b wye -v:wye:i 8 -v:wye:x 0.5985540091064224 -v:wye:yyy 0.976181385699006 - -mlr --oxtab put -q @v[$a][$b] = $*; end {emitp @v, "a", "b"} ./reg-test/input/abixy-het -a pan -b pan -v:a pan -v:b pan -v:i 1 -v:x 0.3467901443380824 -v:y 0.7268028627434533 - -a pan -b wye -v:a pan -v:b wye -v:i 10 -v:x 0.5026260055412137 -v:y 0.9526183602969864 - -a eks -b pan -v:a eks -v:b pan -v:i 2 -v:x 0.7586799647899636 -v:y 0.5221511083334797 - -a eks -b zee -v:a eks -v:b zee -v:iii 7 -v:x 0.6117840605678454 -v:y 0.1878849191181694 - -a wye -b pan -v:a wye -v:b pan -v:i 5 -v:xxx 0.5732889198020006 -v:y 0.8636244699032729 - -a zee -b pan -v:a zee -v:b pan -v:i 6 -v:x 0.5271261600918548 -v:y 0.49322128674835697 - -a zee -b wye -v:a zee -v:b wye -v:i 8 -v:x 0.5985540091064224 -v:yyy 0.976181385699006 - - -================================================================ -SREC-FROM-OOSVAR ASSIGNMENT - -mlr put -v $* = @v /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - - -mlr put -v $* = @v[1] /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - - -mlr put -v $* = @v[$2] /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="2", type=FIELD_NAME. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="2", type=FIELD_NAME. - - -mlr put -v NR == 3 {$* = @v } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=2 max_var_depth=1 - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: subframe_var_count=0 - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - - -mlr put -v NR == 3 {$* = @v[1] } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=2 max_var_depth=1 - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: subframe_var_count=0 - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - - -mlr put -v NR == 3 {$* = @v[$2]} /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="2", type=FIELD_NAME. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=2 max_var_depth=1 - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: subframe_var_count=0 - text="=", type=FULL_SREC_ASSIGNMENT: - text="$*", type=FULL_SREC. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="2", type=FIELD_NAME. - - -mlr put @v[NR] = $a; NR == 7 { @v = $*} ; $* = @v ./reg-test/input/abixy-het -1=pan -1=pan,2=eks -1=pan,2=eks -1=pan,2=eks,4=eks -1=pan,2=eks,4=eks,5=wye -1=pan,2=eks,4=eks,5=wye,6=zee -a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694 -a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694,8=zee -a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694,8=zee -a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694,8=zee,10=pan - - -================================================================ -OOSVAR-FROM-OOSVAR ASSIGNMENT - -mlr put -v @u = @v /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - - -mlr put -v @u = @v[1] /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - - -mlr put -v @u[2] = @v /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - - -mlr put -v @u[2] = @v[1] /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - - -mlr put -v begin { @u = @v } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="begin", type=BEGIN: - text="begin_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -BLOCKED AST: - -BEGIN-BLOCK: -text="begin", type=BEGIN: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="begin_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - - -mlr put -v begin { @u = @v[1] } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="begin", type=BEGIN: - text="begin_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -BLOCKED AST: - -BEGIN-BLOCK: -text="begin", type=BEGIN: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="begin_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - - -mlr put -v begin { @u[2] = @v } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="begin", type=BEGIN: - text="begin_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -BLOCKED AST: - -BEGIN-BLOCK: -text="begin", type=BEGIN: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="begin_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - - -mlr put -v begin { @u[2] = @v[1] } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="begin", type=BEGIN: - text="begin_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -BLOCKED AST: - -BEGIN-BLOCK: -text="begin", type=BEGIN: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="begin_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - - -mlr put -v NR == 3 { @u = @v } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=2 max_var_depth=1 - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: subframe_var_count=0 - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - - -mlr put -v NR == 3 { @u = @v[1] } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=2 max_var_depth=1 - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: subframe_var_count=0 - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - - -mlr put -v NR == 3 { @u[2] = @v } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=2 max_var_depth=1 - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: subframe_var_count=0 - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - - -mlr put -v NR == 3 { @u[2] = @v[1] } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -BLOCKED AST: - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=2 max_var_depth=1 - text="cond", type=CONDITIONAL_BLOCK: - text="==", type=OPERATOR: - text="NR", type=CONTEXT_VARIABLE. - text="3", type=NUMERIC_LITERAL. - text="cond_block", type=STATEMENT_BLOCK: subframe_var_count=0 - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - - -mlr put -v end { @u = @v } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="end", type=END: - text="end_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -BLOCKED AST: - -END-BLOCK: -text="end", type=END: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="end_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - - -mlr put -v end { @u = @v[1] } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="end", type=END: - text="end_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -BLOCKED AST: - -END-BLOCK: -text="end", type=END: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="end_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - - -mlr put -v end { @u[2] = @v } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="end", type=END: - text="end_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -BLOCKED AST: - -END-BLOCK: -text="end", type=END: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="end_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - - -mlr put -v end { @u[2] = @v[1] } /dev/null -RAW AST: - -AST ROOT: -text="block", type=STATEMENT_BLOCK: - text="end", type=END: - text="end_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -BLOCKED AST: - -END-BLOCK: -text="end", type=END: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - text="end_block", type=STATEMENT_BLOCK: - text="=", type=OOSVAR_ASSIGNMENT: - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="u", type=STRING_LITERAL. - text="2", type=NUMERIC_LITERAL. - text="oosvar_keylist", type=OOSVAR_KEYLIST: - text="v", type=STRING_LITERAL. - text="1", type=NUMERIC_LITERAL. - -MAIN BLOCK: -text="main_block", type=STATEMENT_BLOCK: subframe_var_count=1 max_subframe_depth=1 max_var_depth=1 - - -mlr put -q @s += $i; @t=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": 55, - "t": 55 -} -s=55 -t=55 - -mlr put -q @s[1] += $i; @t=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": 55 - }, - "t": { - "1": 55 - } -} -s:1=55 -t:1=55 - -mlr put -q @s[1] += $i; @t=@s[1]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": 55 - }, - "t": 55 -} -s:1=55 -t=55 - -mlr put -q @s[1] += $i; @t[3]=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": 55 - }, - "t": { - "3": { - "1": 55 - } - } -} -s:1=55 -t:3:1=55 - -mlr put -q @s[1] += $i; @t[3]=@s[1]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": 55 - }, - "t": { - "3": 55 - } -} -s:1=55 -t:3=55 - -mlr put -q @s[1][2] += $i; @t=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": { - "2": 55 - } - }, - "t": { - "1": { - "2": 55 - } - } -} -s:1:2=55 -t:1:2=55 - -mlr put -q @s[1][2] += $i; @t=@s[1]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": { - "2": 55 - } - }, - "t": { - "2": 55 - } -} -s:1:2=55 -t:2=55 - -mlr put -q @s[1][2] += $i; @t=@s[1][2]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": { - "2": 55 - } - }, - "t": 55 -} -s:1:2=55 -t=55 - -mlr put -q @s[1][2] += $i; @t[3]=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": { - "2": 55 - } - }, - "t": { - "3": { - "1": { - "2": 55 - } - } - } -} -s:1:2=55 -t:3:1:2=55 - -mlr put -q @s[1][2] += $i; @t[3]=@s[1]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": { - "2": 55 - } - }, - "t": { - "3": { - "2": 55 - } - } -} -s:1:2=55 -t:3:2=55 - -mlr put -q @s[1][2] += $i; @t[3]=@s[1][2]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": { - "2": 55 - } - }, - "t": { - "3": 55 - } -} -s:1:2=55 -t:3=55 - -mlr put -q @s[1][2] += $i; @t[3][4]=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": { - "2": 55 - } - }, - "t": { - "3": { - "4": { - "1": { - "2": 55 - } - } - } - } -} -s:1:2=55 -t:3:4:1:2=55 - -mlr put -q @s[1][2] += $i; @t[3][4]=@s[1]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": { - "2": 55 - } - }, - "t": { - "3": { - "4": { - "2": 55 - } - } - } -} -s:1:2=55 -t:3:4:2=55 - -mlr put -q @s[1][2] += $i; @t[3][4]=@s[1][2]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy -{ - "s": { - "1": { - "2": 55 - } - }, - "t": { - "3": { - "4": 55 - } - } -} -s:1:2=55 -t:3:4=55 - -mlr --opprint put -q @s[NR][NR] = $i/100; @t[NR*10]=@s; end{emitp@s,"A","B"; emitp @t,"C","D","E"} ./reg-test/input/abixy -A B s -1 1 0.010000 -2 2 0.020000 -3 3 0.030000 -4 4 0.040000 -5 5 0.050000 -6 6 0.060000 -7 7 0.070000 -8 8 0.080000 -9 9 0.090000 -10 10 0.100000 - -C D E t -10 1 1 0.010000 -20 1 1 0.010000 -20 2 2 0.020000 -30 1 1 0.010000 -30 2 2 0.020000 -30 3 3 0.030000 -40 1 1 0.010000 -40 2 2 0.020000 -40 3 3 0.030000 -40 4 4 0.040000 -50 1 1 0.010000 -50 2 2 0.020000 -50 3 3 0.030000 -50 4 4 0.040000 -50 5 5 0.050000 -60 1 1 0.010000 -60 2 2 0.020000 -60 3 3 0.030000 -60 4 4 0.040000 -60 5 5 0.050000 -60 6 6 0.060000 -70 1 1 0.010000 -70 2 2 0.020000 -70 3 3 0.030000 -70 4 4 0.040000 -70 5 5 0.050000 -70 6 6 0.060000 -70 7 7 0.070000 -80 1 1 0.010000 -80 2 2 0.020000 -80 3 3 0.030000 -80 4 4 0.040000 -80 5 5 0.050000 -80 6 6 0.060000 -80 7 7 0.070000 -80 8 8 0.080000 -90 1 1 0.010000 -90 2 2 0.020000 -90 3 3 0.030000 -90 4 4 0.040000 -90 5 5 0.050000 -90 6 6 0.060000 -90 7 7 0.070000 -90 8 8 0.080000 -90 9 9 0.090000 -100 1 1 0.010000 -100 2 2 0.020000 -100 3 3 0.030000 -100 4 4 0.040000 -100 5 5 0.050000 -100 6 6 0.060000 -100 7 7 0.070000 -100 8 8 0.080000 -100 9 9 0.090000 -100 10 10 0.100000 - diff --git a/go/reg-test/expected/case-c-dsl-oosvars.sh.out b/go/reg-test/expected/case-c-dsl-oosvars.sh.out index 65bd48486..16e413b03 100644 --- a/go/reg-test/expected/case-c-dsl-oosvars.sh.out +++ b/go/reg-test/expected/case-c-dsl-oosvars.sh.out @@ -349,7 +349,9 @@ RAW AST: * direct oosvar value "sum" * direct oosvar value "count" * emitf statement "emitf" - * direct oosvar value "mean" + * emittable list + * direct oosvar value "mean" + * no-op a b i x y pan pan 1 0.3467901443380824 0.7268028627434533 @@ -379,7 +381,9 @@ RAW AST: * direct oosvar value "sum" * direct oosvar value "count" * emitf statement "emitf" - * direct oosvar value "mean" + * emittable list + * direct oosvar value "mean" + * no-op * begin block * statement block * assignment "=" @@ -415,7 +419,43 @@ mean 0.45362938403357633 mlr put -v begin{ @a = @b[1] }; $c = @d; @e[$i][2+$j][3] = $4; end{@f[@g[5][@h]] = 6} /dev/null -Exit status was 1; expected 0. +DSL EXPRESSION: +begin{ @a = @b[1] }; $c = @d; @e[$i][2+$j][3] = $4; end{@f[@g[5][@h]] = 6} +RAW AST: +* statement block + * begin block + * statement block + * assignment "=" + * direct oosvar value "a" + * array or map index access "[]" + * direct oosvar value "b" + * int literal "1" + * assignment "=" + * direct field value "c" + * direct oosvar value "d" + * assignment "=" + * array or map index access "[]" + * array or map index access "[]" + * array or map index access "[]" + * direct oosvar value "e" + * direct field value "i" + * operator "+" + * int literal "2" + * direct field value "j" + * int literal "3" + * direct field value "4" + * end block + * statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "f" + * array or map index access "[]" + * array or map index access "[]" + * direct oosvar value "g" + * int literal "5" + * direct oosvar value "h" + * int literal "6" + mlr put @y[$a]=$y; end{dump} ./reg-test/input/abixy a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533 @@ -439,7 +479,11 @@ a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864 } mlr stats1 -a sum -f y -g a ./reg-test/input/abixy -Exit status was 1; expected 0. +a=pan,y_sum=1.6794212230404397 +a=eks,y_sum=0.8442247707359537 +a=wye,y_sum=1.2019429954199206 +a=zee,y_sum=1.469402672447363 +a=hat,y_sum=0.7495507603507059 mlr put @y_sum[$a] = $y; end{dump} ./reg-test/input/abixy a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533 @@ -855,36 +899,37 @@ aaa=999 mlr --from ./reg-test/input/abixy put x = 1; print "OX=".x; unset x; print "NX=".x OX=1 NX= -OX=1 -NX= -OX=1 -NX= a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533 +OX=1 +NX= a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797 +OX=1 +NX= a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776 OX=1 NX= -OX=1 -NX= -OX=1 -NX= a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463 +OX=1 +NX= a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729 +OX=1 +NX= a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697 OX=1 NX= -OX=1 -NX= -OX=1 -NX= a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694 +OX=1 +NX= a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006 +OX=1 +NX= a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059 OX=1 NX= a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864 mlr put -q @{variable.name} += $x; end{emit @{variable.name}} ./reg-test/input/abixy +Exit status was 1; expected 0. mlr put -q @{variable.name}[$a] += $x; end{emit @{variable.name},"a"} ./reg-test/input/abixy Exit status was 1; expected 0. @@ -912,5 +957,41 @@ mlr --opprint --from ./reg-test/input/abixy put -q emitp @output, "NR", "k" } -Exit status was 1; expected 0. +NR k output +1 a pan +1 b pan +1 x 0.3467901443380824 +1 y 0.7268028627434533 +2 a eks +2 b pan +2 x 0.7586799647899636 +2 y 0.5221511083334797 +3 a wye +3 b wye +3 x 0.20460330576630303 +3 y 0.33831852551664776 +5 a wye +5 b pan +5 x 0.5732889198020006 +5 y 0.8636244699032729 +6 a zee +6 b pan +6 x 0.5271261600918548 +6 y 0.49322128674835697 +7 a eks +7 b zee +7 x 0.6117840605678454 +7 y 0.1878849191181694 +8 a zee +8 b wye +8 x 0.5985540091064224 +8 y 0.976181385699006 +9 a hat +9 b wye +9 x 0.03144187646093577 +9 y 0.7495507603507059 +10 a pan +10 b wye +10 x 0.5026260055412137 +10 y 0.9526183602969864 diff --git a/go/reg-test/expected/case-c-dsl-functional-tests.sh.out b/go/reg-test/expected/case-dsl-functional-tests.sh.out similarity index 93% rename from go/reg-test/expected/case-c-dsl-functional-tests.sh.out rename to go/reg-test/expected/case-dsl-functional-tests.sh.out index d1974a3d5..d228e348d 100644 --- a/go/reg-test/expected/case-c-dsl-functional-tests.sh.out +++ b/go/reg-test/expected/case-dsl-functional-tests.sh.out @@ -80,42 +80,52 @@ a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059 a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864 mlr filter $nosuchfield>.3 ./reg-test/input/abixy +a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533 +a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797 +a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776 +a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463 +a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729 +a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697 +a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694 +a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006 +a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059 +a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864 mlr put $x2 = $x**2 ./reg-test/input/abixy -a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,x2=0.120263 -a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,x2=0.575595 -a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,x2=0.041863 -a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,x2=0.145465 -a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,x2=0.328660 -a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697,x2=0.277862 -a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694,x2=0.374280 -a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006,x2=0.358267 -a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059,x2=0.000989 -a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864,x2=0.252633 +a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,x2=0.12026340421002804 +a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,x2=0.5755952889737004 +a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,x2=0.04186251273049929 +a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,x2=0.14546549764527372 +a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,x2=0.3286601855677447 +a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697,x2=0.2778619886531837 +a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694,x2=0.37427973676488113 +a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006,x2=0.3582669018173712 +a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059,x2=0.0009885915953847467 +a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864,x2=0.2526329014463162 mlr put $x2 = $x**2; ./reg-test/input/abixy -a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,x2=0.120263 -a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,x2=0.575595 -a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,x2=0.041863 -a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,x2=0.145465 -a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,x2=0.328660 -a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697,x2=0.277862 -a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694,x2=0.374280 -a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006,x2=0.358267 -a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059,x2=0.000989 -a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864,x2=0.252633 +a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,x2=0.12026340421002804 +a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,x2=0.5755952889737004 +a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,x2=0.04186251273049929 +a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,x2=0.14546549764527372 +a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,x2=0.3286601855677447 +a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697,x2=0.2778619886531837 +a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694,x2=0.37427973676488113 +a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006,x2=0.3582669018173712 +a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059,x2=0.0009885915953847467 +a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864,x2=0.2526329014463162 mlr put $z = -0.024*$x+0.13 ./reg-test/input/abixy -a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,z=0.121677 -a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,z=0.111792 -a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,z=0.125090 -a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,z=0.120846 -a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,z=0.116241 -a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697,z=0.117349 -a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694,z=0.115317 -a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006,z=0.115635 -a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059,z=0.129245 -a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864,z=0.117937 +a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,z=0.12167703653588603 +a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,z=0.11179168084504087 +a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,z=0.12508952066160872 +a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,z=0.12084641454709262 +a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,z=0.11624106592475199 +a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697,z=0.1173489721577955 +a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694,z=0.11531718254637172 +a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006,z=0.11563470378144587 +a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059,z=0.12924539496493753 +a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864,z=0.11793697586701088 mlr put $c = $a . $b ./reg-test/input/abixy a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,c=panpan @@ -416,13 +426,13 @@ x=,y=2,z=2 mlr put $z=max($x, $y) ./reg-test/input/minmax.dkvp x=1,y=2,z=2 -x=1,y=,z=1 +x=1,y=,z= x=,y=,z= -x=,y=2,z=2 +x=,y=2,z= x=3,y=2,z=3 -x=3,y=,z=3 +x=3,y=,z= x=,y=,z= -x=,y=2,z=2 +x=,y=2,z= mlr put $o=min() x=1,y=2,z=3,o= diff --git a/go/reg-test/expected/case-dsl-mapvar-emit.sh.out b/go/reg-test/expected/case-dsl-mapvar-emit.sh.out new file mode 100644 index 000000000..2f48c540f --- /dev/null +++ b/go/reg-test/expected/case-dsl-mapvar-emit.sh.out @@ -0,0 +1,96 @@ + + +================================================================ +MAPVAR EMIT + +mlr -n put end { + @a[2][3] = 4; + b[2][3] = 8; + emit (@a, b, {2:{3:12}}); + emitp (@a, b, {2:{3:12}}); + emit {}; + emit (@a, b, {2:{3:12}}), "t"; + emitp (@a, b, {2:{3:12}}), "t"; + emit {}; + emit (@a, b, {2:{3:12}}), "t", "u"; + emitp (@a, b, {2:{3:12}}), "t", "u"; +} +2:3=12 +a:2:3=4,b:2:3=8,_:2:3=12 + +t=2,3=12 +t=2,a:3=4,b:3=8,_:3=12 + +t=2,u=3,a=4,b=8,_=12 +t=2,u=3,a=4,b=8,_=12 + +mlr -n put end { + @a[2][3] = 4; + b[2][3] = 8; + emitp (@a, b, {2:{3:12}}); + emit (@a, b, {2:{3:12}}); + emit {}; + emitp (@a, b, {2:{3:12}}), "t"; + emit (@a, b, {2:{3:12}}), "t"; + emit {}; + emitp (@a, b, {2:{3:12}}), "t", "u"; + emit (@a, b, {2:{3:12}}), "t", "u"; +} +a:2:3=4,b:2:3=8,_:2:3=12 +2:3=12 + +t=2,a:3=4,b:3=8,_:3=12 +t=2,3=12 + +t=2,u=3,a=4,b=8,_=12 +t=2,u=3,a=4,b=8,_=12 + +mlr --opprint --from ./reg-test/input/abixy put -q + @output[NR] = $*; + end { + for ((nr, k), v in @output) { + if (nr == 4 || k == "i") { + unset @output[nr][k] + } + } + emitp @output, "NR", "k" + } + +NR k output +1 a pan +1 b pan +1 x 0.3467901443380824 +1 y 0.7268028627434533 +2 a eks +2 b pan +2 x 0.7586799647899636 +2 y 0.5221511083334797 +3 a wye +3 b wye +3 x 0.20460330576630303 +3 y 0.33831852551664776 +5 a wye +5 b pan +5 x 0.5732889198020006 +5 y 0.8636244699032729 +6 a zee +6 b pan +6 x 0.5271261600918548 +6 y 0.49322128674835697 +7 a eks +7 b zee +7 x 0.6117840605678454 +7 y 0.1878849191181694 +8 a zee +8 b wye +8 x 0.5985540091064224 +8 y 0.976181385699006 +9 a hat +9 b wye +9 x 0.03144187646093577 +9 y 0.7495507603507059 +10 a pan +10 b wye +10 x 0.5026260055412137 +10 y 0.9526183602969864 + diff --git a/go/reg-test/expected/case-dsl-oosvar-assignments.sh.out b/go/reg-test/expected/case-dsl-oosvar-assignments.sh.out new file mode 100644 index 000000000..af64906b9 --- /dev/null +++ b/go/reg-test/expected/case-dsl-oosvar-assignments.sh.out @@ -0,0 +1,885 @@ + + +================================================================ +OOSVAR-FROM-SREC ASSIGNMENT + +mlr put -v @v = $* /dev/null +DSL EXPRESSION: +@v = $* +RAW AST: +* statement block + * assignment "=" + * direct oosvar value "v" + * full record "$*" + + +mlr put -v @v[1] = $* /dev/null +DSL EXPRESSION: +@v[1] = $* +RAW AST: +* statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + * full record "$*" + + +mlr put -v @v[$2] = $* /dev/null +DSL EXPRESSION: +@v[$2] = $* +RAW AST: +* statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "v" + * direct field value "2" + * full record "$*" + + +mlr put -v NR == 3 {@v = $*} /dev/null +DSL EXPRESSION: +NR == 3 {@v = $*} +RAW AST: +* statement block + * cond block + * operator "==" + * context variable "NR" + * int literal "3" + * statement block + * assignment "=" + * direct oosvar value "v" + * full record "$*" + + +mlr put -v NR == 3 {@v[1] = $*} /dev/null +DSL EXPRESSION: +NR == 3 {@v[1] = $*} +RAW AST: +* statement block + * cond block + * operator "==" + * context variable "NR" + * int literal "3" + * statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + * full record "$*" + + +mlr put -v NR == 3 {@v[$2] = $*} /dev/null +DSL EXPRESSION: +NR == 3 {@v[$2] = $*} +RAW AST: +* statement block + * cond block + * operator "==" + * context variable "NR" + * int literal "3" + * statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "v" + * direct field value "2" + * full record "$*" + + +mlr --oxtab put -q @v = $*; end {emitp @v } ./reg-test/input/abixy-het +v:a pan +v:b wye +v:i 10 +v:x 0.5026260055412137 +v:y 0.9526183602969864 + +mlr --oxtab put -q @v[$a] = $*; end {emitp @v } ./reg-test/input/abixy-het +v:pan:a pan +v:pan:b wye +v:pan:i 10 +v:pan:x 0.5026260055412137 +v:pan:y 0.9526183602969864 +v:eks:a eks +v:eks:b zee +v:eks:iii 7 +v:eks:x 0.6117840605678454 +v:eks:y 0.1878849191181694 +v:wye:a wye +v:wye:b pan +v:wye:i 5 +v:wye:xxx 0.5732889198020006 +v:wye:y 0.8636244699032729 +v:zee:a zee +v:zee:b wye +v:zee:i 8 +v:zee:x 0.5985540091064224 +v:zee:yyy 0.976181385699006 + +mlr --oxtab put -q @v[$a] = $*; end {emitp @v, "a" } ./reg-test/input/abixy-het +a pan +v:a pan +v:b wye +v:i 10 +v:x 0.5026260055412137 +v:y 0.9526183602969864 + +a eks +v:a eks +v:b zee +v:iii 7 +v:x 0.6117840605678454 +v:y 0.1878849191181694 + +a wye +v:a wye +v:b pan +v:i 5 +v:xxx 0.5732889198020006 +v:y 0.8636244699032729 + +a zee +v:a zee +v:b wye +v:i 8 +v:x 0.5985540091064224 +v:yyy 0.976181385699006 + +mlr --oxtab put -q @v[$a][$b] = $*; end {emitp @v } ./reg-test/input/abixy-het +v:pan:pan:a pan +v:pan:pan:b pan +v:pan:pan:i 1 +v:pan:pan:x 0.3467901443380824 +v:pan:pan:y 0.7268028627434533 +v:pan:wye:a pan +v:pan:wye:b wye +v:pan:wye:i 10 +v:pan:wye:x 0.5026260055412137 +v:pan:wye:y 0.9526183602969864 +v:eks:pan:a eks +v:eks:pan:b pan +v:eks:pan:i 2 +v:eks:pan:x 0.7586799647899636 +v:eks:pan:y 0.5221511083334797 +v:eks:zee:a eks +v:eks:zee:b zee +v:eks:zee:iii 7 +v:eks:zee:x 0.6117840605678454 +v:eks:zee:y 0.1878849191181694 +v:wye:pan:a wye +v:wye:pan:b pan +v:wye:pan:i 5 +v:wye:pan:xxx 0.5732889198020006 +v:wye:pan:y 0.8636244699032729 +v:zee:pan:a zee +v:zee:pan:b pan +v:zee:pan:i 6 +v:zee:pan:x 0.5271261600918548 +v:zee:pan:y 0.49322128674835697 +v:zee:wye:a zee +v:zee:wye:b wye +v:zee:wye:i 8 +v:zee:wye:x 0.5985540091064224 +v:zee:wye:yyy 0.976181385699006 + +mlr --oxtab put -q @v[$a][$b] = $*; end {emitp @v, "a" } ./reg-test/input/abixy-het +a pan +v:pan:a pan +v:pan:b pan +v:pan:i 1 +v:pan:x 0.3467901443380824 +v:pan:y 0.7268028627434533 +v:wye:a pan +v:wye:b wye +v:wye:i 10 +v:wye:x 0.5026260055412137 +v:wye:y 0.9526183602969864 + +a eks +v:pan:a eks +v:pan:b pan +v:pan:i 2 +v:pan:x 0.7586799647899636 +v:pan:y 0.5221511083334797 +v:zee:a eks +v:zee:b zee +v:zee:iii 7 +v:zee:x 0.6117840605678454 +v:zee:y 0.1878849191181694 + +a wye +v:pan:a wye +v:pan:b pan +v:pan:i 5 +v:pan:xxx 0.5732889198020006 +v:pan:y 0.8636244699032729 + +a zee +v:pan:a zee +v:pan:b pan +v:pan:i 6 +v:pan:x 0.5271261600918548 +v:pan:y 0.49322128674835697 +v:wye:a zee +v:wye:b wye +v:wye:i 8 +v:wye:x 0.5985540091064224 +v:wye:yyy 0.976181385699006 + +mlr --oxtab put -q @v[$a][$b] = $*; end {emitp @v, "a", "b"} ./reg-test/input/abixy-het +a pan +b pan +v:a pan +v:b pan +v:i 1 +v:x 0.3467901443380824 +v:y 0.7268028627434533 + +a pan +b wye +v:a pan +v:b wye +v:i 10 +v:x 0.5026260055412137 +v:y 0.9526183602969864 + +a eks +b pan +v:a eks +v:b pan +v:i 2 +v:x 0.7586799647899636 +v:y 0.5221511083334797 + +a eks +b zee +v:a eks +v:b zee +v:iii 7 +v:x 0.6117840605678454 +v:y 0.1878849191181694 + +a wye +b pan +v:a wye +v:b pan +v:i 5 +v:xxx 0.5732889198020006 +v:y 0.8636244699032729 + +a zee +b pan +v:a zee +v:b pan +v:i 6 +v:x 0.5271261600918548 +v:y 0.49322128674835697 + +a zee +b wye +v:a zee +v:b wye +v:i 8 +v:x 0.5985540091064224 +v:yyy 0.976181385699006 + + +================================================================ +SREC-FROM-OOSVAR ASSIGNMENT + +mlr put -v $* = @v /dev/null +DSL EXPRESSION: +$* = @v +RAW AST: +* statement block + * assignment "=" + * full record "$*" + * direct oosvar value "v" + + +mlr put -v $* = @v[1] /dev/null +DSL EXPRESSION: +$* = @v[1] +RAW AST: +* statement block + * assignment "=" + * full record "$*" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + + +mlr put -v $* = @v[$2] /dev/null +DSL EXPRESSION: +$* = @v[$2] +RAW AST: +* statement block + * assignment "=" + * full record "$*" + * array or map index access "[]" + * direct oosvar value "v" + * direct field value "2" + + +mlr put -v NR == 3 {$* = @v } /dev/null +DSL EXPRESSION: +NR == 3 {$* = @v } +RAW AST: +* statement block + * cond block + * operator "==" + * context variable "NR" + * int literal "3" + * statement block + * assignment "=" + * full record "$*" + * direct oosvar value "v" + + +mlr put -v NR == 3 {$* = @v[1] } /dev/null +DSL EXPRESSION: +NR == 3 {$* = @v[1] } +RAW AST: +* statement block + * cond block + * operator "==" + * context variable "NR" + * int literal "3" + * statement block + * assignment "=" + * full record "$*" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + + +mlr put -v NR == 3 {$* = @v[$2]} /dev/null +DSL EXPRESSION: +NR == 3 {$* = @v[$2]} +RAW AST: +* statement block + * cond block + * operator "==" + * context variable "NR" + * int literal "3" + * statement block + * assignment "=" + * full record "$*" + * array or map index access "[]" + * direct oosvar value "v" + * direct field value "2" + + +mlr put @v[NR] = $a; NR == 7 { @v = $*} ; $* = @v ./reg-test/input/abixy-het +1=pan +1=pan,2=eks +1=pan,2=eks +1=pan,2=eks,4=eks +1=pan,2=eks,4=eks,5=wye +1=pan,2=eks,4=eks,5=wye,6=zee +a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694 +a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694,8=zee +a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694,8=zee +a=eks,b=zee,iii=7,x=0.6117840605678454,y=0.1878849191181694,8=zee,10=pan + + +================================================================ +OOSVAR-FROM-OOSVAR ASSIGNMENT + +mlr put -v @u = @v /dev/null +DSL EXPRESSION: +@u = @v +RAW AST: +* statement block + * assignment "=" + * direct oosvar value "u" + * direct oosvar value "v" + + +mlr put -v @u = @v[1] /dev/null +DSL EXPRESSION: +@u = @v[1] +RAW AST: +* statement block + * assignment "=" + * direct oosvar value "u" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + + +mlr put -v @u[2] = @v /dev/null +DSL EXPRESSION: +@u[2] = @v +RAW AST: +* statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "u" + * int literal "2" + * direct oosvar value "v" + + +mlr put -v @u[2] = @v[1] /dev/null +DSL EXPRESSION: +@u[2] = @v[1] +RAW AST: +* statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "u" + * int literal "2" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + + +mlr put -v begin { @u = @v } /dev/null +DSL EXPRESSION: +begin { @u = @v } +RAW AST: +* statement block + * begin block + * statement block + * assignment "=" + * direct oosvar value "u" + * direct oosvar value "v" + + +mlr put -v begin { @u = @v[1] } /dev/null +DSL EXPRESSION: +begin { @u = @v[1] } +RAW AST: +* statement block + * begin block + * statement block + * assignment "=" + * direct oosvar value "u" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + + +mlr put -v begin { @u[2] = @v } /dev/null +DSL EXPRESSION: +begin { @u[2] = @v } +RAW AST: +* statement block + * begin block + * statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "u" + * int literal "2" + * direct oosvar value "v" + + +mlr put -v begin { @u[2] = @v[1] } /dev/null +DSL EXPRESSION: +begin { @u[2] = @v[1] } +RAW AST: +* statement block + * begin block + * statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "u" + * int literal "2" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + + +mlr put -v NR == 3 { @u = @v } /dev/null +DSL EXPRESSION: +NR == 3 { @u = @v } +RAW AST: +* statement block + * cond block + * operator "==" + * context variable "NR" + * int literal "3" + * statement block + * assignment "=" + * direct oosvar value "u" + * direct oosvar value "v" + + +mlr put -v NR == 3 { @u = @v[1] } /dev/null +DSL EXPRESSION: +NR == 3 { @u = @v[1] } +RAW AST: +* statement block + * cond block + * operator "==" + * context variable "NR" + * int literal "3" + * statement block + * assignment "=" + * direct oosvar value "u" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + + +mlr put -v NR == 3 { @u[2] = @v } /dev/null +DSL EXPRESSION: +NR == 3 { @u[2] = @v } +RAW AST: +* statement block + * cond block + * operator "==" + * context variable "NR" + * int literal "3" + * statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "u" + * int literal "2" + * direct oosvar value "v" + + +mlr put -v NR == 3 { @u[2] = @v[1] } /dev/null +DSL EXPRESSION: +NR == 3 { @u[2] = @v[1] } +RAW AST: +* statement block + * cond block + * operator "==" + * context variable "NR" + * int literal "3" + * statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "u" + * int literal "2" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + + +mlr put -v end { @u = @v } /dev/null +DSL EXPRESSION: +end { @u = @v } +RAW AST: +* statement block + * end block + * statement block + * assignment "=" + * direct oosvar value "u" + * direct oosvar value "v" + + +mlr put -v end { @u = @v[1] } /dev/null +DSL EXPRESSION: +end { @u = @v[1] } +RAW AST: +* statement block + * end block + * statement block + * assignment "=" + * direct oosvar value "u" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + + +mlr put -v end { @u[2] = @v } /dev/null +DSL EXPRESSION: +end { @u[2] = @v } +RAW AST: +* statement block + * end block + * statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "u" + * int literal "2" + * direct oosvar value "v" + + +mlr put -v end { @u[2] = @v[1] } /dev/null +DSL EXPRESSION: +end { @u[2] = @v[1] } +RAW AST: +* statement block + * end block + * statement block + * assignment "=" + * array or map index access "[]" + * direct oosvar value "u" + * int literal "2" + * array or map index access "[]" + * direct oosvar value "v" + * int literal "1" + + +mlr put -q @s += $i; @t=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": 55, + "t": 55 +} +s=55 +t=55 + +mlr put -q @s[1] += $i; @t=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": 55 + }, + "t": { + "1": 55 + } +} +s:1=55 +t:1=55 + +mlr put -q @s[1] += $i; @t=@s[1]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": 55 + }, + "t": 55 +} +s:1=55 +t=55 + +mlr put -q @s[1] += $i; @t[3]=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": 55 + }, + "t": { + "3": { + "1": 55 + } + } +} +s:1=55 +t:3:1=55 + +mlr put -q @s[1] += $i; @t[3]=@s[1]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": 55 + }, + "t": { + "3": 55 + } +} +s:1=55 +t:3=55 + +mlr put -q @s[1][2] += $i; @t=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": { + "2": 55 + } + }, + "t": { + "1": { + "2": 55 + } + } +} +s:1:2=55 +t:1:2=55 + +mlr put -q @s[1][2] += $i; @t=@s[1]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": { + "2": 55 + } + }, + "t": { + "2": 55 + } +} +s:1:2=55 +t:2=55 + +mlr put -q @s[1][2] += $i; @t=@s[1][2]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": { + "2": 55 + } + }, + "t": 55 +} +s:1:2=55 +t=55 + +mlr put -q @s[1][2] += $i; @t[3]=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": { + "2": 55 + } + }, + "t": { + "3": { + "1": { + "2": 55 + } + } + } +} +s:1:2=55 +t:3:1:2=55 + +mlr put -q @s[1][2] += $i; @t[3]=@s[1]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": { + "2": 55 + } + }, + "t": { + "3": { + "2": 55 + } + } +} +s:1:2=55 +t:3:2=55 + +mlr put -q @s[1][2] += $i; @t[3]=@s[1][2]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": { + "2": 55 + } + }, + "t": { + "3": 55 + } +} +s:1:2=55 +t:3=55 + +mlr put -q @s[1][2] += $i; @t[3][4]=@s; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": { + "2": 55 + } + }, + "t": { + "3": { + "4": { + "1": { + "2": 55 + } + } + } + } +} +s:1:2=55 +t:3:4:1:2=55 + +mlr put -q @s[1][2] += $i; @t[3][4]=@s[1]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": { + "2": 55 + } + }, + "t": { + "3": { + "4": { + "2": 55 + } + } + } +} +s:1:2=55 +t:3:4:2=55 + +mlr put -q @s[1][2] += $i; @t[3][4]=@s[1][2]; end{dump; emitp@s; emitp @t} ./reg-test/input/abixy +{ + "s": { + "1": { + "2": 55 + } + }, + "t": { + "3": { + "4": 55 + } + } +} +s:1:2=55 +t:3:4=55 + +mlr --opprint put -q @s[NR][NR] = $i/100; @t[NR*10]=@s; end{emitp@s,"A","B"; emitp @t,"C","D","E"} ./reg-test/input/abixy +A B s +1 1 0.01 +2 2 0.02 +3 3 0.03 +4 4 0.04 +5 5 0.05 +6 6 0.06 +7 7 0.07 +8 8 0.08 +9 9 0.09 +10 10 0.1 + +C D E t +10 1 1 0.01 +20 1 1 0.01 +20 2 2 0.02 +30 1 1 0.01 +30 2 2 0.02 +30 3 3 0.03 +40 1 1 0.01 +40 2 2 0.02 +40 3 3 0.03 +40 4 4 0.04 +50 1 1 0.01 +50 2 2 0.02 +50 3 3 0.03 +50 4 4 0.04 +50 5 5 0.05 +60 1 1 0.01 +60 2 2 0.02 +60 3 3 0.03 +60 4 4 0.04 +60 5 5 0.05 +60 6 6 0.06 +70 1 1 0.01 +70 2 2 0.02 +70 3 3 0.03 +70 4 4 0.04 +70 5 5 0.05 +70 6 6 0.06 +70 7 7 0.07 +80 1 1 0.01 +80 2 2 0.02 +80 3 3 0.03 +80 4 4 0.04 +80 5 5 0.05 +80 6 6 0.06 +80 7 7 0.07 +80 8 8 0.08 +90 1 1 0.01 +90 2 2 0.02 +90 3 3 0.03 +90 4 4 0.04 +90 5 5 0.05 +90 6 6 0.06 +90 7 7 0.07 +90 8 8 0.08 +90 9 9 0.09 +100 1 1 0.01 +100 2 2 0.02 +100 3 3 0.03 +100 4 4 0.04 +100 5 5 0.05 +100 6 6 0.06 +100 7 7 0.07 +100 8 8 0.08 +100 9 9 0.09 +100 10 10 0.1 + diff --git a/go/src/miller/dsl/cst/emit_emitp.go b/go/src/miller/dsl/cst/emit_emitp.go index 26c3fd994..19a2365f1 100644 --- a/go/src/miller/dsl/cst/emit_emitp.go +++ b/go/src/miller/dsl/cst/emit_emitp.go @@ -332,13 +332,17 @@ func (this *EmitXStatementNode) executeIndexedAux( nextLevels := make([]*types.Mlrval, len(emittableMaps)) nextLevelMaps := make([]*types.Mlrmap, len(emittableMaps)) - for i, _ := range emittableMaps { - nextLevel := emittableMaps[i].Get(&indexValueString) - nextLevels[i] = nextLevel - // Can be nil for lashed indexing with heterogeneous data: e.g. - // @x={"a":1}; @y={"b":2}; emit (@x, @y), "a" - if nextLevel != nil && nextLevel.IsMap() { - nextLevelMaps[i] = nextLevel.GetMap() + for i, emittableMap := range emittableMaps { + if emittableMap != nil { + nextLevel := emittableMap.Get(&indexValueString) + nextLevels[i] = nextLevel + // Can be nil for lashed indexing with heterogeneous data: e.g. + // @x={"a":1}; @y={"b":2}; emit (@x, @y), "a" + if nextLevel != nil && nextLevel.IsMap() { + nextLevelMaps[i] = nextLevel.GetMap() + } else { + nextLevelMaps[i] = nil + } } else { nextLevelMaps[i] = nil } diff --git a/go/todo.txt b/go/todo.txt index 9b2f9f6d5..046e84dcf 100644 --- a/go/todo.txt +++ b/go/todo.txt @@ -3,9 +3,12 @@ TOP OF LIST: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ! fix all typemasks; 'int x = 1; x = "abc"' + * merge-fields * in-place processing * prepipe +! strptime/strftime experiments ... +! regex ... * c/go both: o https://brandur.org/logfmt is simply DKVP w/ IFS = space (need dquot though) @@ -15,6 +18,23 @@ TOP OF LIST: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - emitp/emitf: +! all <-> @* + $cases/case-c-dsl-redirects.sh + +* validator enforce unique names in for-loops + +! check more + ./reg-test/cases/case-c-dsl-absent-empty.sh + ./reg-test/cases/case-c-dsl-break-continue.sh + ./reg-test/cases/case-c-dsl-for-oosvar-loops.sh + ./reg-test/cases/case-c-dsl-functional-tests.sh + ./reg-test/cases/case-c-dsl-indirect-oosvar-assignments.sh + ./reg-test/cases/case-c-dsl-lashed-emitp-singles.sh + ./reg-test/cases/case-c-dsl-mapvar-emit.sh + ./reg-test/cases/case-c-dsl-oosvar-assignments.sh + ./reg-test/cases/case-c-dsl-oosvars.sh + ./reg-test/cases/case-c-dsl-type-predicates.sh + * new emitx punctuation-syntax -- decide x 4 o to support (from C impl): x MD_TOKEN_ALL @@ -34,11 +54,9 @@ emitp/emitf: ! fix var/any type-mask o C/Go UT -! sg/mktags more explicit comment. +* sg/mktags more explicit comment. ! verb skeletons -! strptime/strftime experiments ... -* regex ... ? doc shift/unshift as using [2:] and append ! se-q reads