code: func (p *parser) parseSelector() (result Selector, err error) {
  	p.skipWhitespace()
  	result, err = p.parseSimpleSelectorSequence()
  	if err != nil {
  		return
  	}
  
  	for {
  		var combinator byte
  		if p.skipWhitespace() {
  			combinator = ' '
  		}
  		if p.i >= len(p.s) {
  			return
  		}
  
  		switch p.s[p.i] {
  		case '+', '>', '~':
  			combinator = p.s[p.i]
  			p.i++
  			p.skipWhitespace()
  		case ',', ')':
  			// These characters can't begin a selector, but they can legally occur after one.
  			return
  		}
  
  		if combinator == 0 {
  			return
  		}
  
  		c, err := p.parseSimpleSelectorSequence()
  		if err != nil {
  			return nil, err
  		}
  
  		switch combinator {
  		case ' ':
  			result = descendantSelector(result, c)
  		case '>':
  			result = childSelector(result, c)
  		case '+':
  			result = siblingSelector(result, c, true)
  		case '~':
  			result = siblingSelector(result, c, false)
  		}
  	}
  
  	panic("unreachable")
  }
docs: // parseSelector parses a selector that may include combinators.