fixed some bugs within fast_parser and added an option 'settings.fast_parser' to turn on fast parsing.

This commit is contained in:
David Halter committed 2012-12-14 18:16:54 +01:00
1 parent 6963a6ac4a
commit b8b4a02398
5 files changed
+77 -26

No files matched your search

+7 -2
View File
@@ -10,6 +10,7 @@ import time
import cache
import parsing
import fast_parser
import builtin
import debug
import settings
@@ -71,8 +72,12 @@ class ModuleWithCursor(Module):
# Call the parser already here, because it will be used anyways.
# Also, the position is here important (which will not be used by
# default), therefore fill the cache here.
self._parser = parsing.PyFuzzyParser(self.source, self.path,
self.position)
if settings.fast_parser:
self._parser = fast_parser.FastParser(self.source, self.path,
self.position)
else:
self._parser = parsing.PyFuzzyParser(self.source, self.path,
self.position)
if self.path is not None:
builtin.CachedModule.cache[self.path] = time.time(), \
self._parser