class_docstr: Class to parse header files.
  
  It can deal with gl2.h and webgl.idl,
  as well as some desktop OpenGL header files. It produces a list of
  ConstantDefinition objects and FunctionDefinition objects, which can
  be accessed via a dict.
class_docstr_tok: ["Class","to","parse","header","files",".","It","can","deal","with","gl2.h","and","webgl.idl",",","as","well","as","some","desktop","OpenGL","header","files",".","It","produces","a","list","of","ConstantDefinition","objects","and","FunctionDefinition","objects",",","which","can","be","accessed","via","a","dict","."]
docstr: Parse the header file!
docstr_tok: ["Parse","the","header","file","!"]
code: def parse(self):
      """Parse the header file!"""
      self._parse_constants_and_functions_from_file()
  
      # Remove invalid defs
      self._functionDefs = [d for d in self._functionDefs if d.isvalid]
      self._constantDefs = [d for d in self._constantDefs if d.isvalid]
  
      # Collect multipe similar functions in groups
      self._functionDefs.sort(key=lambda x: x.glname)
      keyDef = None
      keyDefs = []
      for funcDef in [f for f in self._functionDefs]:
          # Check if we need a new keydef
          if funcDef.extrachars:
              # Create new keydef or use old one?
              if keyDef and keyDef.glname == funcDef.keyname:
                  pass  # Keep same keydef
              else:
                  keyDef = FunctionGroup.from_function_def(funcDef)
                  keyDefs.append(keyDef)
              # Add to group
              keyDef.group.append(funcDef)
      # Process function groups
      for keyDef in keyDefs:
          if len(keyDef.group) > 1:
              self._functionDefs.append(keyDef)
              for d in keyDef.group:
                  self._functionDefs.remove(d)
  
      # Sort constants and functions
      self._functionDefs.sort(key=lambda x: x.glname)
      self._constantDefs.sort(key=lambda x: x.glname)
  
      # Get dicts
      for definition in self._functionDefs:
          self._functions[definition.shortname] = definition
      for definition in self._constantDefs:
          self._constants[definition.shortname] = definition
  
      # Get some stats
      for funcDef in self._functionDefs:
          for arg in funcDef.args:
              self.stat_types.add(arg.ctype)
  
      # Show stats
      # TODO: Remove iteration
      n1 = len([d for d in self._constantDefs])
      n2 = len([d for d in self._functionDefs])
      n3 = len([d for d in self._functionDefs if d.group])
      n4 = sum([len(d.group) for d in self._functionDefs if d.group])
      print(
          'Found %i constants and %i unique functions (%i groups contain %i functions)").'
          % (n1, n2, n3, n4)
      )
  
      print("C-types found in args:", self.stat_types)
  
imports: import os
label_desc: Use image node_id 2 for calling the Parser obj's underlying member method code with example usage: obj.parse() without return types