def selector_production(self, tokens):
validators = []<EOL>if self.peek(tokens, '<STR_LIT:type>'):<EOL><INDENT>type_ = self.match(tokens, '<STR_LIT:type>')<EOL>validators.append(self.type_production(type_))<EOL><DEDENT>if self.peek(tokens, '<STR_LIT>'):<EOL><INDENT>key = self.match(tokens, '<STR_LIT>')<EOL>validators.append(self.key_production(key))<EOL><DEDENT>if self.peek(tokens, '<STR_LIT>'):<EOL><INDENT>pclass = self.match(tokens, '<STR_LIT>')<EOL>validators.append(self.pclass_production(pclass))<EOL><DEDENT>if self.peek(tokens, '<STR_LIT>'):<EOL><INDENT>nth_func = self.match(tokens, '<STR_LIT>')<EOL>validators.append(self.nth_child_production(nth_func, tokens))<EOL><DEDENT>if self.peek(tokens, '<STR_LIT>'):<EOL><INDENT>pclass_func = self.match(tokens, '<STR_LIT>')<EOL>validators.append(self.pclass_func_production(pclass_func, tokens))<EOL><DEDENT>if not len(validators):<EOL><INDENT>raise SelectorSyntaxError('<STR_LIT>')<EOL><DEDENT>results = self._match_nodes(validators, self.obj)<EOL>if self.peek(tokens, '<STR_LIT>'):<EOL><INDENT>operator = self.match(tokens, '<STR_LIT>')<EOL>rvals = self.selector_production(tokens)<EOL>if operator == '<STR_LIT:U+002C>':<EOL><INDENT>results.extend(rvals)<EOL><DEDENT>elif operator == '<STR_LIT:>>':<EOL><INDENT>results = self.parents(results, rvals)<EOL><DEDENT>elif operator == '<STR_LIT>':<EOL><INDENT>results = self.siblings(results, rvals)<EOL><DEDENT>elif operator == '<STR_LIT:U+0020>':<EOL><INDENT>results = self.ancestors(results, rvals)<EOL><DEDENT>else:<EOL><INDENT>raise SelectorSyntaxError("<STR_LIT>"<EOL>% operator)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if len(tokens):<EOL><INDENT>rvals = self.selector_production(tokens)<EOL>results = self.ancestors(results, rvals)<EOL><DEDENT><DEDENT>return results<EOL>
Production for a full selector.