#NEWLINE# def range( self , line , pos , length = ( - 1 ) , near = None , error_type = ERROR , word_re = None ) : #NEWLINE# #INDENT# '\n        Mark a range of text.\n\n        line and pos should be zero-based. The pos and length argument can be used to control marking:\n\n            - If pos < 0, the entire line is marked and length is ignored.\n\n            - If near is not None, it is stripped of quotes and length = len(near)\n\n            - If length < 0, the nearest word starting at pos is marked, and if\n              no word is matched, the character at pos is marked.\n\n            - If length == 0, no text is marked, but a gutter mark will appear on that line.\n\n        error_type determines what type of error mark will be drawn (ERROR or WARNING).\n\n        When length < 0, this method attempts to mark the closest word at pos on the given line.\n        If you want to customize the word matching regex, pass it in word_re.\n\n        If the error_type is WARNING and an identical ERROR region exists, it is not added.\n        If the error_type is ERROR and an identical WARNING region exists, the warning region\n        is removed and the error region is added.\n\n        ' #NEWLINE# ( start , end ) = self . full_line ( line ) #NEWLINE# if ( pos < 0 ) : #NEWLINE# #INDENT# pos = 0 #NEWLINE# length = ( ( end - start ) - 1 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( near is not None ) : #NEWLINE# #INDENT# near = self . strip_quotes ( near ) #NEWLINE# length = len ( near ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( length < 0 ) : #NEWLINE# #INDENT# code = self . code [ start : end ] [ pos : ] #NEWLINE# match = ( word_re or WORD_RE ) . search ( code ) #NEWLINE# if match : #NEWLINE# #INDENT# length = len ( match . group ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# length = 1 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# pos += start #NEWLINE# region = sublime . Region ( pos , ( line + length ) ) #NEWLINE# other_type = ( ERROR if ( error_type == WARNING ) else WARNING ) #NEWLINE# i_offset = 0 #NEWLINE# for ( i , mark ) in enumerate ( self . marks [ other_type ] . copy ( ) ) : #NEWLINE# #INDENT# if ( ( mark . a == region . a ) and ( mark . b == region . b ) ) : #NEWLINE# #INDENT# if ( error_type == WARNING ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . marks [ other_type ] . pop ( ( i - i_offset ) ) #NEWLINE# i_offset += 1 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . marks [ error_type ] . append ( region )