2020-11-03 23:48:43 +00:00
|
|
|
package yqlib
|
2020-10-17 11:10:47 +00:00
|
|
|
|
2020-10-21 01:54:58 +00:00
|
|
|
import "container/list"
|
2020-10-17 11:10:47 +00:00
|
|
|
|
2021-01-12 23:18:53 +00:00
|
|
|
func unionOperator(d *dataTreeNavigator, matchingNodes *list.List, expressionNode *ExpressionNode) (*list.List, error) {
|
|
|
|
lhs, err := d.GetMatchingNodes(matchingNodes, expressionNode.Lhs)
|
2020-10-17 11:10:47 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2021-01-12 23:18:53 +00:00
|
|
|
rhs, err := d.GetMatchingNodes(matchingNodes, expressionNode.Rhs)
|
2020-10-17 11:10:47 +00:00
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
for el := rhs.Front(); el != nil; el = el.Next() {
|
|
|
|
node := el.Value.(*CandidateNode)
|
2020-10-21 01:54:58 +00:00
|
|
|
lhs.PushBack(node)
|
2020-10-17 11:10:47 +00:00
|
|
|
}
|
|
|
|
return lhs, nil
|
|
|
|
}
|