parser/parser.go
func Parse(xp string) (*Node, error) {
	var err error
	c := lexer.Lex(xp)
	n := &Node{}
	p := &parseStack{cur: n}

	for next := range c {
		if next.Typ != lexer.XItemError {
			parseMap[next.Typ](p, next)
		} else if err == nil {
			err = fmt.Errorf(next.Val)
		}
	}

	return n, err
}
func Parse(xp string) (*Node, error) {
	var err error
	c := lexer.Lex(xp)
	n := &Node{}
	p := &parseStack{cur: n}

	for next := range c {
		if next.Typ != lexer.XItemError {
			parseMap[next.Typ](p, next)
		} else if err == nil {
			err = fmt.Errorf(next.Val)
		}
	}

	return n, err
}
//Parse creates an AST tree for XPath expressions.