Handle a parent match
        :param match:
        :type match:
        :param yield_parent:
        :type yield_parent:
        :return:
        :rtype:
333893
def _match_parent(self, match, yield_parent):
        
        ret = super(Chain, self)._match_parent(match, yield_parent)
        original_children = Matches(match.children)
        original_end = match.end
        while not ret and match.children:
            last_pattern = match.children[-1].pattern
            last_pattern_children = [child for child in match.children if child.pattern == last_pattern]
            last_pattern_groups_iter = itertools.groupby(last_pattern_children, lambda child: child.match_index)
            last_pattern_groups = {}
            for index, matches in last_pattern_groups_iter:
                last_pattern_groups[index] = list(matches)

            for index in reversed(list(last_pattern_groups)):
                last_matches = list(last_pattern_groups[index])
                for last_match in last_matches:
                    match.children.remove(last_match)
                match.end = match.children[-1].end if match.children else match.start
                ret = super(Chain, self)._match_parent(match, yield_parent)
                if ret:
                    return True
        match.children = original_children
        match.end = original_end
        return ret
828112
function processParentheses(tokenizer, scope) {
  if (tokenizer.token.match(types.CLOSE_PARENTHESES)) {
    throw new SyntaxError('Unexpected end of expression');
  }

  if (tokenizer.token.match(types.OPEN_PARENTHESES)) {
    const node = processLogicalOr(tokenizer.skipToken(), scope);

    if (!tokenizer.token.match(types.CLOSE_PARENTHESES)) {
      throw new SyntaxError('Unexpected end of expression');
    }

    tokenizer.skipToken();
    return node;
  }

  throw new SyntaxError('Unexpected end of expression');
}
1004560
function handle(match, position, parent, phrase) {
        var index = list.indexOf(phrase)
        var pattern = byIndex[index]
        var id = pattern.id

        if (!(id in matches)) {
          matches[id] = []
        }

        matches[id].push({
          type: pattern.inconsiderate[phrase],
          parent: parent,
          nodes: match,
          start: position,
          end: position + match.length - 1
        })
      }
904567
def parse_from_parent(
            self,
            parent,  # type: ET.Element
            state  # type: _ProcessorState
    ):
        # type: (...) -> Any
        """"""
        parsed_dict = self._dictionary.parse_from_parent(parent, state)
        return self._converter.from_dict(parsed_dict)
160321
def at_match(self, match, predicate=None, index=None):
        
        return self.at_span(match.span, predicate, index)
361413
function (node, match) {
      do {
        if (!node || node.nodeName.toLowerCase() === match) {
          break
        }
        node = node.parentNode
      } while (node)

      return node
    }
1092380
def __get_match_result(self, ret, ret2):
        
        if self.another_compare == "__MATCH_AND__":
            return ret and ret2
        elif self.another_compare == "__MATCH_OR__":
            return ret or ret2
        return ret
167036
def parse_from_parent(
            self,
            parent,  # type: ET.Element
            state  # type: _ProcessorState
    ):
        # type: (...) -> Any
        """"""
        element = parent.find(self.element_path)

        if element is None and self.required:
            state.raise_error(
                MissingValue, 'Missing required element "{}"'.format(self.element_path)
            )
        elif element is not None:
            return self.parse_at_element(element, state)

        return _hooks_apply_after_parse(self._hooks, state, self._default)
529731
def match(pattern):
    
    regex = re.compile(pattern)

    def validate(value):
        if not regex.match(value):
            return e("{} does not match the pattern {}", value, pattern)
    return validate
431869
def parse(self, response):
        
        if not self.helper.parse_crawler.content_type(response):
            return

        for request in self.helper.parse_crawler \
                .recursive_requests(response, self, self.ignore_regex,
                                    self.ignore_file_extensions):
            yield request

        yield self.helper.parse_crawler.pass_to_pipeline_if_article(
            response, self.allowed_domains[0], self.original_url)
876892
def parent(self):
        
        def parent_element():
            """
            Wrapper to retrieve parent element
            """
            return WebElementWrapper(self.driver_wrapper, self.locator, self.element.parent)
        return self.execute_and_handle_webelement_exceptions(parent_element, 'get parent')
1333276
private void handleParentMethod(ExecutableElement parentMethodElement, ExecutableElement
      childMethodElement) {
    MethodReferenceNode parentMethodNode = (MethodReferenceNode) elementReferenceMap
        .get(stitchMethodIdentifier(parentMethodElement));
    if (parentMethodNode == null) {
      parentMethodNode = new MethodReferenceNode(parentMethodElement);
    }
    parentMethodNode.invokedMethods.add(stitchMethodIdentifier(childMethodElement));
    elementReferenceMap.put(stitchMethodIdentifier(parentMethodElement), parentMethodNode);
    addToOverrideMap(parentMethodElement);
  }
1004372
def get_parent_id(self, resource, document):
        
        parent_type = self._get_parent_type(resource)
        if parent_type and document:
            return document.get(parent_type.get('field'))

        return None
546823
def _match_and_pop(self, regex_pattern):
        
        results = []
        self.lock.acquire()
        for name in self.event_dict.keys():
            if re.match(regex_pattern, name):
                q = self.event_dict[name]
                if q:
                    try:
                        results.append(q.get(False))
                    except:
                        pass
        self.lock.release()
        return results
17596
def visit_yield(self, node, parent):
        """"""
        newnode = nodes.Yield(node.lineno, node.col_offset, parent)
        if node.value is not None:
            newnode.postinit(self.visit(node.value, newnode))
        return newnode
779285
def raises_regex(self, expected_exception, expected_regexp):
        
        return unittest_case.assertRaisesRegexp(expected_exception, expected_regexp, self._orig_subject,
                                                *self._args, **self._kwargs)
1354113
def _handle_codeblock(self, match):
        
        from pygments.lexers import get_lexer_by_name

        # section header
        yield match.start(1), String        , match.group(1)
        yield match.start(2), String        , match.group(2)
        yield match.start(3), Text          , match.group(3)

        # lookup lexer if wanted and existing
        lexer = None
        if self.handlecodeblocks:
            try:
                lexer = get_lexer_by_name( match.group(2).strip() )
            except ClassNotFound:
                pass
        code = match.group(4)

        # no lexer for this language. handle it like it was a code block
        if lexer is None:
            yield match.start(4), String, code
            return

        for item in do_insertions([], lexer.get_tokens_unprocessed(code)):
            yield item

        yield match.start(5), String        , match.group(5)