Main module for the Python parser. Parsing python is achieved by using the code in the Python distribution that is an example for parsing python by using the built-in parser. This parser returns a parse tree which we can traverse and translate into Synopsis' AST. The exparse module contains the enhanced example code (it has many more features than the simple example did), and this module translates the resulting intermediate AST objects into Synopsis.Core.AST objects.
Functions Summary: | |
addDeclaration(decl) Adds the given declaration to the current top scope and to the SourceFile for this file. [Source] | |
push(scope) Pushes the given scope onto the top of the stack [Source] | |
pop() Pops the scope stack by one level [Source] | |
scopeName(name) Scopes the given name. [Source] | |
process_ModuleInfo(mi) Processes a ModuleInfo object. [Source] | |
add_params(func, fi) Adds the parameters of 'fi' to the AST.Function 'func'. [Source] | |
process_FunctionInfo(fi) Process a FunctionInfo object. [Source] | |
process_MethodInfo(fi) Process a MethodInfo object. [Source] | |
process_ClassInfo(ci) Process a ClassInfo object. [Source] | |
usage() Prints a usage message [Source] | |
__parseArgs(args, config_obj) Parses the command line arguments and the config object [Source] | |
get_synopsis(file) Returns the docstring from the top of an open file [Source] | |
parse(file, extra_files, parser_args, config_obj) Entry point for the Python parser [Source] |
Function Details: |
Scopes the given name. If the given name is a list then it is returned verbatim, else it is concatenated with the (scoped) name of the current scope
Processes a ModuleInfo object. The comments are extracted, and any functions and comments recursively processed.
Process a FunctionInfo object. An AST.Function object is created and inserted into the current scope.
Process a MethodInfo object. An AST.Operation object is created and inserted into the current scope.
Process a ClassInfo object. An AST.Class object is created and inserted into the current scope. The inheritance of the class is also parsed, and nested classes and methods recursively processed.