diff --git a/common/python/nomadcore/simple_parser.py b/common/python/nomadcore/simple_parser.py index 45a3f3ab1c2e30730c74264dee6d61351eff3cbb..7762fa42294f714036b6b62f0e30e47a1b17d6ad 100644 --- a/common/python/nomadcore/simple_parser.py +++ b/common/python/nomadcore/simple_parser.py @@ -989,6 +989,7 @@ class SimpleParser(object): self.superContext = superContext self.annotateFile = None self.matchHighlighter = MatchHighlighter(highlightmode) + self.lastMatch = {} if annotate: annofilename=fIn.fIn.name + ".annotate" logger.info("writing annotated input to " + annofilename) @@ -1080,10 +1081,10 @@ class SimpleParser(object): logger.debug("new context: %s\n", self.contextDesc()) currentCtx = self.context[len(self.context) - 1] if startEnd == ParsingContext.End: - currentCtx.compiledMatcher.handleEndMatch(self) + self.lastMatch = currentCtx.compiledMatcher.handleEndMatch(self) self.contextClose(currentCtx) else: - currentCtx.compiledMatcher.handleStartMatch(self) + self.lastMatch = currentCtx.compiledMatcher.handleStartMatch(self) except Exception as e: origin = traceback.format_exc() raise_from(Exception("Failure, context %s, line %d coming from %s"%(self.contextDesc(), self.fIn.lineNr, origin)), e)