Search code examples
pythonrubyoutline

Library to create code outline


Is there a python or ruby library to create a code outline for the given code? The library should support multiple languages.

I am looking for something like outline view in Eclipse. I don't need the UI, and i can write my own. But I am looking for a library which parses the given language and creates an outline datastructure.


Solution

  • As far as I know there is no such library. You could create it yourself though.

    A pragmatic way would be to follow the indentation levels in Python. For other languages, you could either follow the indentation level, or use regular expression matching and a stack to keep track your outline.