| 1558 | } |
| 1559 | |
| 1560 | func evalStack(opStack, valueStack *filterTreeStack) error { |
| 1561 | topOp, err := opStack.pop() |
| 1562 | if err != nil { |
| 1563 | return errors.Errorf("Invalid filter statement") |
| 1564 | } |
| 1565 | if topOp.Op == "not" { |
| 1566 | // Since "not" is a unary operator, just pop one value. |
| 1567 | topVal, err := valueStack.pop() |
| 1568 | if err != nil { |
| 1569 | return errors.Errorf("Invalid filter statement") |
| 1570 | } |
| 1571 | topOp.Child = []*FilterTree{topVal} |
| 1572 | } else { |
| 1573 | // "and" and "or" are binary operators, so pop two values. |
| 1574 | if valueStack.size() < 2 { |
| 1575 | return errors.Errorf("Invalid filter statement") |
| 1576 | } |
| 1577 | topVal1 := valueStack.popAssert() |
| 1578 | topVal2 := valueStack.popAssert() |
| 1579 | topOp.Child = []*FilterTree{topVal2, topVal1} |
| 1580 | } |
| 1581 | // Push the new value (tree) into the valueStack. |
| 1582 | valueStack.push(topOp) |
| 1583 | return nil |
| 1584 | } |
| 1585 | |
| 1586 | func parseGeoArgs(it *lex.ItemIterator, g *Function) error { |
| 1587 | buf := new(bytes.Buffer) |