MCPcopy Create free account
hub / github.com/antchfx/xpath / parseRelativeLocationPath

Method parseRelativeLocationPath

parse.go:387–403  ·  view source on GitHub ↗

RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath

(n node)

Source from the content-addressed store, hash-verified

385
386// RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath
387func (p *parser) parseRelativeLocationPath(n node) node {
388 opnd := n
389Loop:
390 for {
391 opnd = p.parseStep(opnd)
392 switch p.r.typ {
393 case itemSlashSlash:
394 p.next()
395 opnd = newAxisNode("descendant-or-self", allNode, "", "", "", opnd)
396 case itemSlash:
397 p.next()
398 default:
399 break Loop
400 }
401 }
402 return opnd
403}
404
405// Step ::= AxisSpecifier NodeTest Predicate* | AbbreviatedStep
406func (p *parser) parseStep(n node) (opnd node) {

Callers 2

parsePathExprMethod · 0.95
parseLocationPathMethod · 0.95

Calls 3

parseStepMethod · 0.95
nextMethod · 0.95
newAxisNodeFunction · 0.85

Tested by

no test coverage detected