MCPcopy Index your code
hub / github.com/expr-lang/expr / parsePredicate

Method parsePredicate

parser/parser.go:668–698  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

666}
667
668func (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
700func (p *Parser) parseArrayExpression(token Token) Node {
701 nodes := make([]Node, 0)

Callers 1

parseCallMethod · 0.95

Calls 7

nextMethod · 0.95
parseExpressionMethod · 0.95
errorMethod · 0.95
expectMethod · 0.95
createNodeMethod · 0.95
IsMethod · 0.80

Tested by

no test coverage detected