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

Method parseLocationPath

parse.go:368–384  ·  view source on GitHub ↗

LocationPath ::= RelativeLocationPath | AbsoluteLocationPath

(n node)

Source from the content-addressed store, hash-verified

366
367// LocationPath ::= RelativeLocationPath | AbsoluteLocationPath
368func (p *parser) parseLocationPath(n node) (opnd node) {
369 switch p.r.typ {
370 case itemSlash:
371 p.next()
372 opnd = newRootNode("/")
373 if isStep(p.r.typ) {
374 opnd = p.parseRelativeLocationPath(opnd) // ?? child:: or self ??
375 }
376 case itemSlashSlash:
377 p.next()
378 opnd = newRootNode("//")
379 opnd = p.parseRelativeLocationPath(newAxisNode("descendant-or-self", allNode, "", "", "", opnd))
380 default:
381 opnd = p.parseRelativeLocationPath(n)
382 }
383 return opnd
384}
385
386// RelativeLocationPath ::= Step | RelativeLocationPath '/' Step | AbbreviatedRelativeLocationPath
387func (p *parser) parseRelativeLocationPath(n node) node {

Callers 1

parsePathExprMethod · 0.95

Calls 5

nextMethod · 0.95
newRootNodeFunction · 0.85
isStepFunction · 0.85
newAxisNodeFunction · 0.85

Tested by

no test coverage detected