()
| 666 | } |
| 667 | |
| 668 | func (p *Parser) parsePredicate() Node { |
| 669 | startToken := p.current |
| 670 | withBrackets := false |
| 671 | if p.current.Is(Bracket, "{") { |
| 672 | p.next() |
| 673 | withBrackets = true |
| 674 | } |
| 675 | |
| 676 | p.depth++ |
| 677 | var node Node |
| 678 | if withBrackets { |
| 679 | node = p.parseSequenceExpression() |
| 680 | } else { |
| 681 | node = p.parseExpression(0) |
| 682 | if p.current.Is(Operator, ";") { |
| 683 | p.error("wrap predicate with brackets { and }") |
| 684 | } |
| 685 | } |
| 686 | p.depth-- |
| 687 | |
| 688 | if withBrackets { |
| 689 | p.expect(Bracket, "}") |
| 690 | } |
| 691 | predicateNode := p.createNode(&PredicateNode{ |
| 692 | Node: node, |
| 693 | }, startToken.Location) |
| 694 | if predicateNode == nil { |
| 695 | return nil |
| 696 | } |
| 697 | return predicateNode |
| 698 | } |
| 699 | |
| 700 | func (p *Parser) parseArrayExpression(token Token) Node { |
| 701 | nodes := make([]Node, 0) |
no test coverage detected