old_contents: #!/usr/bin/python
  # vim: set fileencoding=utf-8
  import clang.cindex
  import asciitree
  import sys
  
  def node_children(node):
      return (c for c in node.get_children() if c.location.file.name == sys.argv[1])
  
  def print_node(node):
      text = node.spelling or node.displayname
      kind = str(node.kind)[str(node.kind).index('.')+1:]
      return '{} {}'.format(kind, text)
  
  if len(sys.argv) != 2:
      print("Usage: dump_ast.py [header file name]")
      sys.exit()
  
  clang.cindex.Config.set_library_file('/usr/local/lib/libclang.so')
  index = clang.cindex.Index.create()
  translation_unit = index.parse(sys.argv[1], ['-x', 'c++', '-std=c++11', '-D__CODE_GENERATOR__'])
  
  print(asciitree.draw_tree(translation_unit.cursor, node_children, print_node))
  
  
new_contents: #!/usr/bin/python
  # vim: set fileencoding=utf-8
  import clang.cindex
  import asciitree # must be version 0.2
  import sys
  
  def node_children(node):
      return (c for c in node.get_children() if c.location.file.name == sys.argv[1])
  
  def print_node(node):
      text = node.spelling or node.displayname
      kind = str(node.kind)[str(node.kind).index('.')+1:]
      return '{} {}'.format(kind, text)
  
  if len(sys.argv) != 2:
      print("Usage: dump_ast.py [header file name]")
      sys.exit()
  
  clang.cindex.Config.set_library_file('/usr/local/lib/libclang.so')
  index = clang.cindex.Index.create()
  translation_unit = index.parse(sys.argv[1], ['-x', 'c++', '-std=c++11', '-D__CODE_GENERATOR__'])
  
  print(asciitree.draw_tree(translation_unit.cursor, node_children, print_node))
  
  
subject: Update dump_ast.py