'Takes a node and translates it to an expression to be used with
violations.
Arguments:
node: An AST node.'

def node_to_expression(self, node):

    line_start_index = self.lines.line_number_to_start_index(node.lineno)
    start_index = (line_start_index + node.col_offset)
    if isinstance(node, ast.Str):
        if (node.col_offset == (-1)):
            triple_quote_regex = re.compile('[\'"]{3}')
            end_triple_quote_match = triple_quote_regex.search(self.file_contents, line_start_index)
            open_quote_index = self.file_contents.rfind(end_triple_quote_match.group(), 0, end_triple_quote_match.start())
            if (open_quote_index > 0):
                start_index = open_quote_index
            else:
                start_index = end_triple_quote_match.start()
        string = ParseString(self.file_contents, start_index, len(self.file_contents))
        return Expression(string.start_index, string.end_index)
    else:
        return Expression(start_index)
