#NEWLINE# def extract_locals( self , view ) : #NEWLINE# #INDENT# region = view . sel ( ) [ 0 ] #NEWLINE# scopes = set ( view . scope_name ( region . begin ( ) ) . split ( ' ' ) ) #NEWLINE# if ( len ( ( set ( [ 'source.ocaml' , 'source.ocamllex' , 'source.ocamlyacc' ] ) & scopes ) ) == 0 ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# local_defs = [ ] #NEWLINE# view . find_all ( "let(\\s+rec)?\\s+(([?~]?[\\w']+\\s*)+)=" , 0 , '\\2' , local_defs ) #NEWLINE# view . find_all ( "fun\\s+(([?~]?[\\w']+\\s*)+)->" , 0 , '\\1' , locals ) #NEWLINE# locals = set ( ) #NEWLINE# for definition in local_defs : #NEWLINE# #INDENT# for local in definition . split ( ) : #NEWLINE# #INDENT# ( local , ) = re . match ( '^[?~]?(.+)' , local ) . groups ( ) #NEWLINE# locals . add ( local ) #NEWLINE# #UNINDENT# #UNINDENT# self . local_cache [ view . buffer_id ( ) ] = list ( locals )