2020-11-03 23:48:43 +00:00
|
|
|
package yqlib
|
2020-10-20 04:33:20 +00:00
|
|
|
|
2023-01-12 04:11:45 +00:00
|
|
|
import "container/list"
|
|
|
|
|
|
|
|
func referenceOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
|
|
|
|
return context.SingleChildContext(expressionNode.Operation.CandidateNode), nil
|
|
|
|
}
|
|
|
|
|
2021-02-02 07:17:59 +00:00
|
|
|
func valueOperator(d *dataTreeNavigator, context Context, expressionNode *ExpressionNode) (Context, error) {
|
2023-04-09 01:14:51 +00:00
|
|
|
log.Debug("value = %v", expressionNode.Operation.CandidateNode.Value)
|
2023-01-12 04:11:45 +00:00
|
|
|
if context.MatchingNodes.Len() == 0 {
|
2023-04-09 01:14:51 +00:00
|
|
|
clone := expressionNode.Operation.CandidateNode.Copy()
|
2023-01-12 04:11:45 +00:00
|
|
|
return context.SingleChildContext(clone), nil
|
|
|
|
}
|
|
|
|
|
|
|
|
var results = list.New()
|
|
|
|
|
|
|
|
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
|
2023-04-09 01:14:51 +00:00
|
|
|
clone := expressionNode.Operation.CandidateNode.Copy()
|
2023-01-12 04:11:45 +00:00
|
|
|
results.PushBack(clone)
|
|
|
|
}
|
|
|
|
|
|
|
|
return context.ChildContext(results), nil
|
2020-10-20 04:33:20 +00:00
|
|
|
}
|