From 3e2cfeb789776e7642d0ac330d172d0e08d229db Mon Sep 17 00:00:00 2001
From: Berk Onat <b.onat@warwick.ac.uk>
Date: Tue, 18 Jul 2017 12:42:56 +0100
Subject: [PATCH] Added peekline feature to SimpleMatcher. The macthed line can
 be accessed with self.fInLine in parser

---
 common/python/nomadcore/simple_parser.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/common/python/nomadcore/simple_parser.py b/common/python/nomadcore/simple_parser.py
index 4e4ef2f..92c6520 100644
--- a/common/python/nomadcore/simple_parser.py
+++ b/common/python/nomadcore/simple_parser.py
@@ -29,6 +29,7 @@ class PushbackLineFile(object):
 
     def __init__(self, fIn, lines=tuple()):
         self.fIn = fIn
+        self.fInLine = None
         self.lines = list(lines)
         self.lineNr = 0
         self.name = fIn.name
@@ -40,10 +41,18 @@ class PushbackLineFile(object):
         else:
             res = self.fIn.readline()
             if res:
+                self.fInLine = res
                 self.lineNr += 1
             return res
 
+    def peekline(self):
+        pos = self.fIn.tell()
+        line = self.fIn.readline()
+        self.fIn.seek(pos)
+        return line
+
     def pushbackLine(self, line):
+        self.fInLine = line
         self.lines.append(line)
         self.lineNr -= 1
 
-- 
GitLab