def find_end(node_type, source, start_from=0, child_tokens={}):
    detector = EndDetector(source, child_tokens=child_tokens)
    detector.discard_before(start_from)
    getattr(detector, "consume_" + node_type)()
    detector.lock()

    return detector.get_end_index(detector.last_consumed)
Example #2
0
def find_end(node_type, source, start_from=0, child_tokens={}):
    detector = EndDetector(source, child_tokens=child_tokens)
    detector.discard_before(start_from)
    getattr(detector, 'consume_' + node_type)()
    detector.lock()

    return detector.get_end_index(detector.last_consumed)
Example #3
0
    def detector(self):
        '''EndDetector representing the expression. See end_detection.py for
        details.'''

        lines = self._source_lines

        detector = EndDetector(lines)
        detector.discard_before(self._astroid_object.col_offset)

        self.consume_expression(detector)
        detector.lock()

        return detector
Example #4
0
    def detector(self):
        '''EndDetector representing the expression. See end_detection.py for
        details.'''

        lines = self._source_lines

        detector = EndDetector(lines)
        detector.discard_before(self._astroid_object.col_offset)

        self.consume_expression(detector)
        detector.lock()

        return detector