mirror of
https://github.com/mikefarah/yq.git
synced 2024-11-15 07:38:14 +00:00
25 lines
793 B
Go
25 lines
793 B
Go
package yqlib
|
|
|
|
import "container/list"
|
|
|
|
func referenceOperator(_ *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
|
|
return context.SingleChildContext(expressionNode.Operation.CandidateNode), nil
|
|
}
|
|
|
|
func valueOperator(_ *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
|
|
log.Debug("value = %v", expressionNode.Operation.CandidateNode.Value)
|
|
if context.MatchingNodes.Len() == 0 {
|
|
clone := expressionNode.Operation.CandidateNode.Copy()
|
|
return context.SingleChildContext(clone), nil
|
|
}
|
|
|
|
var results = list.New()
|
|
|
|
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
|
|
clone := expressionNode.Operation.CandidateNode.Copy()
|
|
results.PushBack(clone)
|
|
}
|
|
|
|
return context.ChildContext(results), nil
|
|
}
|