func parseOrExpression(tokens []tokenizer.Token) (sel node, remTokens []tokenizer.Token, err error) {
	if parserDebug {
		log.Debugf("Parsing ||s from %v", tokens)
	}
	andNodes := make([]node, 0)
	sel, remTokens, err = parseAndExpression(tokens)
	if err != nil {
		return
	}
	andNodes = append(andNodes, sel)
	for {
		switch remTokens[0].Kind {
		case tokenizer.TokOr:
			remTokens = remTokens[1:]
			sel, remTokens, err = parseAndExpression(remTokens)
			if err != nil {
				return
			}
			andNodes = append(andNodes, sel)
		default:
			if len(andNodes) == 1 {
				sel = andNodes[0]
			} else {
				sel = &OrNode{andNodes}
			}
			return
		}
	}
}
parseOrExpression parses a one or more "&&" terms, separated by "||" operators.
package parser
import (
	"errors"
	"fmt"
	log "github.com/sirupsen/logrus"
	"github.com/projectcalico/libcalico-go/lib/selector/tokenizer"
)
const parserDebug = false
func Parse(selector string) (sel Selector, err error) {
	log.Debugf("Parsing %#v", selector)
	tokens, err := tokenizer.Tokenize(selector)
	if err != nil {
		return
	}
	if tokens[0].Kind == tokenizer.TokEOF {
		return &selectorRoot{root: &AllNode{}}, nil
	}
	log.Debugf("Tokens %v", tokens)
	node, remTokens, err := parseOrExpression(tokens)
	if err != nil {
		return
	}
	if len(remTokens) != 1 {
		err = errors.New(fmt.Sprint("unexpected content at end of selector ", remTokens))
		return
	}
	sel = &selectorRoot{root: node}
	return
}