parameters: (buff)
return_statement: return rtags
docstring: Create a DocStruct object that represents a NSIS Script
      @param buff: a file like buffer object (StringIO)
      @todo: generate tags for lua tables?
docstring_summary: Create a DocStruct object that represents a NSIS Script
      @param buff: a file like buffer object (StringIO)
      @todo: generate tags for lua tables?
docstring_tokens: Create a DocStruct object that represents a NSIS Script @param buff : a file like buffer object ( StringIO ) @todo : generate tags for lua tables?
function: def GenerateTags(buff):
      """Create a DocStruct object that represents a NSIS Script
      @param buff: a file like buffer object (StringIO)
      @todo: generate tags for lua tables?
  
      """
      rtags = taglib.DocStruct()
  
      # Set Descriptions of Document Element Types
      rtags.SetElementDescription('variable', "Defines")
      rtags.SetElementDescription('section', "Section Definitions")
      rtags.SetElementDescription('macro', "Macro Definitions")
      rtags.SetElementDescription('function', "Function Definitions")
      rtags.SetElementPriority('variable', 4)
      rtags.SetElementPriority('section', 3)
      rtags.SetElementPriority('function', 2)
      rtags.SetElementPriority('macro', 1)
  
      # Parse the lines for code objects
      for lnum, line in enumerate(buff):
          line = line.strip()
          llen = len(line)
  
          # Skip comment and empty lines
          if line.startswith(u"#") or line.startswith(u";") or not line:
              continue
  
          # Look for functions and sections
          if parselib.IsToken(line, 0, u'Function'):
              parts = line.split()
              if len(parts) > 1:
                  rtags.AddFunction(taglib.Function(parts[1], lnum))
          elif parselib.IsToken(line, 0, u'Section'):
              parts = line.split()
              if len(parts) > 1 and parts[1][0] not in ['"', "'", "`"]:
                  rtags.AddElement('section', taglib.Section(parts[1], lnum))
              else:
                  for idx, part in enumerate(parts[1:]):
                      if parts[idx][-1] in ['"', "'", "`"]:
                          rtags.AddElement('section', taglib.Section(part, lnum))
                          break
          elif parselib.IsToken(line, 0, u'!macro'):
              parts = line.split()
              if len(parts) > 1:
                  rtags.AddElement('macro', taglib.Macro(parts[1], lnum))
          elif parselib.IsToken(line, 0, u'!define'):
              parts = line.split()
              if len(parts) > 1 and parts[1][0].isalpha():
                  rtags.AddVariable(taglib.Variable(parts[1], lnum))
          else:
              continue
  
      return rtags
function_tokens: def GenerateTags ( buff ) : rtags = taglib . DocStruct ( ) # Set Descriptions of Document Element Types rtags . SetElementDescription ( 'variable' , "Defines" ) rtags . SetElementDescription ( 'section' , "Section Definitions" ) rtags . SetElementDescription ( 'macro' , "Macro Definitions" ) rtags . SetElementDescription ( 'function' , "Function Definitions" ) rtags . SetElementPriority ( 'variable' , 4 ) rtags . SetElementPriority ( 'section' , 3 ) rtags . SetElementPriority ( 'function' , 2 ) rtags . SetElementPriority ( 'macro' , 1 ) # Parse the lines for code objects for lnum , line in enumerate ( buff ) : line = line . strip ( ) llen = len ( line ) # Skip comment and empty lines if line . startswith ( u"#" ) or line . startswith ( u";" ) or not line : continue # Look for functions and sections if parselib . IsToken ( line , 0 , u'Function' ) : parts = line . split ( ) if len ( parts ) > 1 : rtags . AddFunction ( taglib . Function ( parts [ 1 ] , lnum ) ) elif parselib . IsToken ( line , 0 , u'Section' ) : parts = line . split ( ) if len ( parts ) > 1 and parts [ 1 ] [ 0 ] not in [ '"' , "'" , "`" ] : rtags . AddElement ( 'section' , taglib . Section ( parts [ 1 ] , lnum ) ) else : for idx , part in enumerate ( parts [ 1 : ] ) : if parts [ idx ] [ - 1 ] in [ '"' , "'" , "`" ] : rtags . AddElement ( 'section' , taglib . Section ( part , lnum ) ) break elif parselib . IsToken ( line , 0 , u'!macro' ) : parts = line . split ( ) if len ( parts ) > 1 : rtags . AddElement ( 'macro' , taglib . Macro ( parts [ 1 ] , lnum ) ) elif parselib . IsToken ( line , 0 , u'!define' ) : parts = line . split ( ) if len ( parts ) > 1 and parts [ 1 ] [ 0 ] . isalpha ( ) : rtags . AddVariable ( taglib . Variable ( parts [ 1 ] , lnum ) ) else : continue return rtags