Variable loop - Fixes #1566 (#1577)

* Variable loop wip

* Variable loop wip

* Variable loop wip

* Variable loop wip

* Fixed variable operator to work like jq
This commit is contained in:
Mike Farah
2023-02-28 16:40:38 +11:00
committed by GitHub
parent cb27444e54
commit 62d167c141
12 changed files with 112 additions and 31 deletions
+3 -3
View File
@@ -2,9 +2,9 @@ package yqlib
func pipeOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
//lhs may update the variable context, we should pass that into the RHS
// BUT we still return the original context back (see jq)
// https://stedolan.github.io/jq/manual/#Variable/SymbolicBindingOperator:...as$identifier|...
if expressionNode.LHS.Operation.OperationType == assignVariableOpType {
return variableLoop(d, context, expressionNode)
}
lhs, err := d.GetMatchingNodes(context, expressionNode.LHS)
if err != nil {