MCPcopy Create free account
hub / github.com/brimdata/super / parseChoiceExpr

Method parseChoiceExpr

compiler/parser/parser.go:25509–25531  ·  view source on GitHub ↗
(ch *choiceExpr)

Source from the content-addressed store, hash-verified

25507}
25508
25509func (p *parser) parseChoiceExpr(ch *choiceExpr) (any, bool) {
25510 if p.debug {
25511 defer p.out(p.in("parseChoiceExpr"))
25512 }
25513
25514 for altI, alt := range ch.alternatives {
25515 // dummy assignment to prevent compile error if optimized
25516 _ = altI
25517
25518 state := p.cloneState()
25519
25520 p.pushV()
25521 val, ok := p.parseExprWrap(alt)
25522 p.popV()
25523 if ok {
25524 p.incChoiceAltCnt(ch, altI)
25525 return val, ok
25526 }
25527 p.restoreState(state)
25528 }
25529 p.incChoiceAltCnt(ch, choiceNoMatch)
25530 return nil, false
25531}
25532
25533func (p *parser) parseLabeledExpr(lab *labeledExpr) (any, bool) {
25534 if p.debug {

Callers 1

parseExprMethod · 0.95

Calls 8

outMethod · 0.95
inMethod · 0.95
cloneStateMethod · 0.95
pushVMethod · 0.95
parseExprWrapMethod · 0.95
popVMethod · 0.95
incChoiceAltCntMethod · 0.95
restoreStateMethod · 0.95

Tested by

no test coverage detected