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
2012-12-14 18:16:54 +01:00
parent 6963a6ac4a
commit b8b4a02398
5 changed files with 77 additions and 26 deletions

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