original_docstring: 
          Name may be a language name or a delegate name.
          Mode is a python module or class containing all
          coloring rule attributes for the mode.
          
docstring: Name may be a language name or a delegate name.
  Mode is a python module or class containing all
  coloring rule attributes for the mode.
docstring_tokens: Name may be a language name or a delegate name . Mode is a python module or class containing all coloring rule attributes for the mode .
code: def init_mode_from_module(self, name, mode):
          """
          Name may be a language name or a delegate name.
          Mode is a python module or class containing all
          coloring rule attributes for the mode.
          """
          language, rulesetName = self.nameToRulesetName(name)
          if mode:
              # A hack to give modes/forth.py access to c.
              if hasattr(mode, 'pre_init_mode'):
                  mode.pre_init_mode(self.c)
          else:
              # Create a dummy bunch to limit recursion.
              self.modes[rulesetName] = self.modeBunch = g.Bunch(
                  attributesDict={},
                  defaultColor=None,
                  keywordsDict={},
                  language='unknown-language',
                  mode=mode,
                  properties={},
                  rulesDict={},
                  rulesetName=rulesetName,
                  word_chars=self.word_chars,  # 2011/05/21
              )
              self.rulesetName = rulesetName
              self.language = 'unknown-language'
              return False
          self.language = language
          self.rulesetName = rulesetName
          self.properties = getattr(mode, 'properties', None) or {}
          #
          # #1334: Careful: getattr(mode, ivar, {}) might be None!
          #
          d: Dict[Any, Any] = getattr(mode, 'keywordsDictDict', {}) or {}
          self.keywordsDict = d.get(rulesetName, {})
          self.setKeywords()
          d = getattr(mode, 'attributesDictDict', {}) or {}
          self.attributesDict: Dict[str, Any] = d.get(rulesetName, {})
          self.setModeAttributes()
          d = getattr(mode, 'rulesDictDict', {}) or {}
          self.rulesDict: Dict[str, Any] = d.get(rulesetName, {})
          self.addLeoRules(self.rulesDict)
          self.defaultColor = 'null'
          self.mode = mode
          self.modes[rulesetName] = self.modeBunch = g.Bunch(
              attributesDict=self.attributesDict,
              defaultColor=self.defaultColor,
              keywordsDict=self.keywordsDict,
              language=self.language,
              mode=self.mode,
              properties=self.properties,
              rulesDict=self.rulesDict,
              rulesetName=self.rulesetName,
              word_chars=self.word_chars,  # 2011/05/21
          )
          # Do this after 'officially' initing the mode, to limit recursion.
          self.addImportedRules(mode, self.rulesDict, rulesetName)
          self.updateDelimsTables()
          initialDelegate = self.properties.get('initialModeDelegate')
          if initialDelegate:
              # Replace the original mode by the delegate mode.
              self.init_mode(initialDelegate)
              language2, rulesetName2 = self.nameToRulesetName(initialDelegate)
              self.modes[rulesetName] = self.modes.get(rulesetName2)
              self.language = language2  # 2017/01/31
          else:
              self.language = language  # 2017/01/31
          return True
code_tokens: def init_mode_from_module ( self , name , mode ) : language , rulesetName = self . nameToRulesetName ( name ) if mode : if hasattr ( mode , 'pre_init_mode' ) : mode . pre_init_mode ( self . c ) else : self . modes [ rulesetName ] = self . modeBunch = g . Bunch ( attributesDict = { } , defaultColor = None , keywordsDict = { } , language = 'unknown-language' , mode = mode , properties = { } , rulesDict = { } , rulesetName = rulesetName , word_chars = self . word_chars , ) self . rulesetName = rulesetName self . language = 'unknown-language' return False self . language = language self . rulesetName = rulesetName self . properties = getattr ( mode , 'properties' , None ) or { } d : Dict [ Any , Any ] = getattr ( mode , 'keywordsDictDict' , { } ) or { } self . keywordsDict = d . get ( rulesetName , { } ) self . setKeywords ( ) d = getattr ( mode , 'attributesDictDict' , { } ) or { } self . attributesDict : Dict [ str , Any ] = d . get ( rulesetName , { } ) self . setModeAttributes ( ) d = getattr ( mode , 'rulesDictDict' , { } ) or { } self . rulesDict : Dict [ str , Any ] = d . get ( rulesetName , { } ) self . addLeoRules ( self . rulesDict ) self . defaultColor = 'null' self . mode = mode self . modes [ rulesetName ] = self . modeBunch = g . Bunch ( attributesDict = self . attributesDict , defaultColor = self . defaultColor , keywordsDict = self . keywordsDict , language = self . language , mode = self . mode , properties = self . properties , rulesDict = self . rulesDict , rulesetName = self . rulesetName , word_chars = self . word_chars , ) self . addImportedRules ( mode , self . rulesDict , rulesetName ) self . updateDelimsTables ( ) initialDelegate = self . properties . get ( 'initialModeDelegate' ) if initialDelegate : self . init_mode ( initialDelegate ) language2 , rulesetName2 = self . nameToRulesetName ( initialDelegate ) self . modes [ rulesetName ] = self . modes . get ( rulesetName2 ) self . language = language2 else : self . language = language return True
short_docstring: Name may be a language name or a delegate name.
short_docstring_tokens: Name may be a language name or a delegate name .
comment: """
          Name may be a language name or a delegate name.
          Mode is a python module or class containing all
          coloring rule attributes for the mode.
          """$SEP$# A hack to give modes/forth.py access to c.$SEP$# Create a dummy bunch to limit recursion.$SEP$# 2011/05/21$SEP$#$SEP$# #1334: Careful: getattr(mode, ivar, {}) might be None!$SEP$#$SEP$# 2011/05/21$SEP$# Do this after 'officially' initing the mode, to limit recursion.$SEP$# Replace the original mode by the delegate mode.$SEP$# 2017/01/31$SEP$# 2017/01/31