From 2c1108db1c6d734325417946294efebc748d656e Mon Sep 17 00:00:00 2001 From: David Halter Date: Wed, 29 Feb 2012 23:11:53 +0100 Subject: [PATCH] header description of the parser --- pyfuzzyparser.py | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/pyfuzzyparser.py b/pyfuzzyparser.py index bab211f9..9dde9d45 100644 --- a/pyfuzzyparser.py +++ b/pyfuzzyparser.py @@ -1,22 +1,40 @@ -"""" -TODO Description: This is a parser +""" +Maintainer: David Halter +Version: 0.1 + +py_fuzzyparser parses python code, with the goal of a good representation of +the code within a tree structure. Variables, Classes and Functions are defined +within this tree structure, containing their exact locations in the code. +It is also a primary goal to work with code which contains syntax errors. + +This behaviour may be used to refactor, modify, search and complete code. + +To understand this code it is extremely important to understand the behaviour +of the python module 'tokenize'. + +This original codebase of this parser, which has been refactored and heavily +changed, was programmed by Aaron Griffin . + +*The structure of the following script:* +A Scope has + - imports (Import) + - subscopes (Scope, Class, Function, Flow) + - statements (Statement) + +All those classes are being generated by PyFuzzyParser, which takes python text +as input. + +Ignored statements: + - print (no use for it, just slows down) + - exec (dangerous - not controllable) TODO be tolerant with indents TODO dictionaries not working with statement parser TODO except has local vars TODO take special care for future imports TODO add global statements - -scope - imports - subscopes - statements - -Ignored statements: - - print (no use for it) - - exec (dangerous - not controllable) - """ + import sys import tokenize import cStringIO