pyfuzzyparser -> parser

This commit is contained in:
David Halter
2012-03-06 18:14:53 +01:00
parent cc8ebb5280
commit 3be36968ce
3 changed files with 13 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
import pyfuzzyparser import parsing
def complete(source, row, colum, file_callback=None): def complete(source, row, colum, file_callback=None):
""" """
@@ -13,4 +13,5 @@ def complete(source, row, colum, file_callback=None):
:return: list :return: list
:rtype: list :rtype: list
""" """
p = parsing.PyFuzzyParser(source, row)
return [] return []

View File

@@ -5,7 +5,7 @@ import cStringIO
import sys import sys
import types import types
import pyfuzzyparser import parsing
def complete(file_name, line, colon): def complete(file_name, line, colon):
@@ -48,10 +48,9 @@ def _sanitize(str):
class Completer(object): class Completer(object):
def __init__(self): def __init__(self):
self.compldict = {} self.compldict = {}
self.parser = pyfuzzyparser.PyFuzzyParser()
def evalsource(self, text, line=0): def evalsource(self, text, line=0):
sc = self.parser.parse(text) sc = self.parsing.parse(text)
src = sc.get_code() src = sc.get_code()
#dbg("source: %s" % src) #dbg("source: %s" % src)
#try: exec(src) in self.compldict #try: exec(src) in self.compldict
@@ -219,13 +218,13 @@ showdbg()
def show_debug(*args): def show_debug(*args):
print args print args
pyfuzzyparser.debug_function = show_debug parsing.debug_function = show_debug
text = open('test.py').read() text = open('test.py').read()
parser = pyfuzzyparser.PyFuzzyParser(text) p = parsing.PyFuzzyParser(text)
print parser.top.get_code() print p.top.get_code()
#print cmpl.parser.top.subscopes[1].subscopes[0].get_code() #print cmpl.parser.top.subscopes[1].subscopes[0].get_code()
def handle_names(names): def handle_names(names):
@@ -237,29 +236,29 @@ def handle_names(names):
print 'star!', n.from_ns print 'star!', n.from_ns
print 'global names:' print 'global names:'
names = parser.top.get_set_vars() names = p.top.get_set_vars()
handle_names(names) handle_names(names)
print print
print 'func names:' print 'func names:'
names = parser.top.subscopes[7].get_set_vars() names = p.top.subscopes[7].get_set_vars()
handle_names(names) handle_names(names)
print print
print 'class names:' print 'class names:'
names = parser.top.subscopes[2].get_set_vars() names = p.top.subscopes[2].get_set_vars()
handle_names(names) handle_names(names)
for s in parser.top.subscopes[2].subscopes: for s in p.top.subscopes[2].subscopes:
print 'method names:' print 'method names:'
names = s.get_set_vars() names = s.get_set_vars()
handle_names(names) handle_names(names)
print print
print 'start/end' print 'start/end'
for s in parser.top.subscopes: for s in p.top.subscopes:
print repr(s) print repr(s)
s = parser.top s = p.top
import code import code
sh = code.InteractiveConsole(locals=locals()) sh = code.InteractiveConsole(locals=locals())
#sh.interact("InteractiveConsole") #sh.interact("InteractiveConsole")