Skip to content
Snippets Groups Projects
Commit 90c869d6 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Added some missing methods (for non-overlapping sections) to the local backend.

parent dc85e5b6
Branches
No related tags found
No related merge requests found
...@@ -71,11 +71,30 @@ class LocalBackend(object): ...@@ -71,11 +71,30 @@ class LocalBackend(object):
"""opens a new section and returns its new unique gIndex""" """opens a new section and returns its new unique gIndex"""
manager = self.sectionManagers[metaName] manager = self.sectionManagers[metaName]
newIndex = manager.openSection(self) newIndex = manager.openSection(self)
self.__openSections.add((metaName, newIndex))
return newIndex return newIndex
def openNonOverlappingSection(self, metaName):
"""opens a new non overlapping section"""
if any(x[0] == metaName for x in self.__openSections):
raise Exception("Section %s is not supposed to overlap" % metaName)
return self.openSection(metaName)
def closeSection(self, metaName, gIndex): def closeSection(self, metaName, gIndex):
manager = self.sectionManagers[metaName] manager = self.sectionManagers[metaName]
manager.closeSection(self, gIndex) manager.closeSection(self, gIndex)
if (metaName, gIndex) in self.__openSections:
self.__openSections.remove((metaName, gIndex))
def closeNonOverlappingSection(self, metaName):
"""closes a non overlapping section"""
openGIndexes = [x for x in self.__openSections if x[0] == metaName]
if len(openGIndexes) != 1:
if not openGIndexes:
raise Exception("Call to closeNonOverlapping(%s) with no open section" % metaName)
else:
raise Exception("Section %s was not supposed to overlap, found %s open when closing" % (metaName, openGIndexes))
self.closeSection(metaName, openGIndexes[0][1])
def addValue(self, metaName, value, gIndex=-1): def addValue(self, metaName, value, gIndex=-1):
...@@ -193,10 +212,10 @@ class LocalBackend(object): ...@@ -193,10 +212,10 @@ class LocalBackend(object):
def metaInfoEnv(self): def metaInfoEnv(self):
return self.__metaInfoEnv return self.__metaInfoEnv
def startedParsingSession(self, mainFileUri, parserInfo, parsingStatus=None, parsingErrors=None): def startedParsingSession(self, mainFileUri, parserInfo, parserStatus=None, parserErrors=None):
pass pass
def finishedParsingSession(self, parsingStatus, parsingErrors, mainFileUri=None, parserInfo=None, def finishedParsingSession(self, parserStatus, parserErrors, mainFileUri=None, parserInfo=None,
parsingStats=None): parsingStats=None):
"""Called when the parsing finishes. """Called when the parsing finishes.
""" """
...@@ -207,6 +226,12 @@ class LocalBackend(object): ...@@ -207,6 +226,12 @@ class LocalBackend(object):
input data, together with capture info """ input data, together with capture info """
pass pass
def pwarn(self, msg):
"""Used to catch parser warnings. Currently disabled in the local
backend.
"""
pass
#=============================================================================== #===============================================================================
class Results(object): class Results(object):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment