parameters: (self, set_ext=u'')
docstring: Sets Text Controls Lexer Based on File Extension
          @param set_ext: explicit extension to use in search
          @postcondition: lexer is configured for file
docstring_summary: Sets Text Controls Lexer Based on File Extension
          @param set_ext: explicit extension to use in search
          @postcondition: lexer is configured for file
docstring_tokens: Sets Text Controls Lexer Based on File Extension @param set_ext : explicit extension to use in search @postcondition : lexer is configured for file
function: def FindLexer(self, set_ext=u''):
          """Sets Text Controls Lexer Based on File Extension
          @param set_ext: explicit extension to use in search
          @postcondition: lexer is configured for file
  
          """
          if set_ext != u'':
              ext = set_ext.lower()
          else:
              ext = self.file.GetExtension().lower()
  
          if ext == u'':
              fname = self.GetFileName()
              ext = ebmlib.GetFileName(fname).lower()
  
          self.ClearDocumentStyle()
  
          # Configure Lexer from File Extension
          self.ConfigureLexer(ext)
  
          # If syntax auto detection fails from file extension try to
          # see if there is an interpreter line that can be parsed.
          if self.GetLexer() == wx.stc.STC_LEX_NULL:
              interp = self.GetLine(0)
              if interp != wx.EmptyString:
                  interp = interp.split(u"/")[-1]
                  interp = interp.strip().split()
                  if len(interp) and interp[-1][0] != u"-":
                      interp = interp[-1]
                  elif len(interp):
                      interp = interp[0]
                  else:
                      interp = u''
                  # TODO: should check user config to ensure the explict
                  #       extension is still associated with the expected
                  #       file type.
                  ex_map = { "python" : "py", "wish" : "tcl", "ruby" : "rb",
                             "bash" : "sh", "csh" : "csh", "perl" : "pl",
                             "ksh" : "ksh", "php" : "php", "booi" : "boo",
                             "pike" : "pike"}
                  self.ConfigureLexer(ex_map.get(interp, interp))
          self.Colourise(0, -1)
function_tokens: def FindLexer ( self , set_ext = u'' ) : if set_ext != u'' : ext = set_ext . lower ( ) else : ext = self . file . GetExtension ( ) . lower ( ) if ext == u'' : fname = self . GetFileName ( ) ext = ebmlib . GetFileName ( fname ) . lower ( ) self . ClearDocumentStyle ( ) # Configure Lexer from File Extension self . ConfigureLexer ( ext ) # If syntax auto detection fails from file extension try to # see if there is an interpreter line that can be parsed. if self . GetLexer ( ) == wx . stc . STC_LEX_NULL : interp = self . GetLine ( 0 ) if interp != wx . EmptyString : interp = interp . split ( u"/" ) [ - 1 ] interp = interp . strip ( ) . split ( ) if len ( interp ) and interp [ - 1 ] [ 0 ] != u"-" : interp = interp [ - 1 ] elif len ( interp ) : interp = interp [ 0 ] else : interp = u'' # TODO: should check user config to ensure the explict #       extension is still associated with the expected #       file type. ex_map = { "python" : "py" , "wish" : "tcl" , "ruby" : "rb" , "bash" : "sh" , "csh" : "csh" , "perl" : "pl" , "ksh" : "ksh" , "php" : "php" , "booi" : "boo" , "pike" : "pike" } self . ConfigureLexer ( ex_map . get ( interp , interp ) ) self . Colourise ( 0 , - 1 )