From 5d099a151a31e6349d665ef9b563ee8634f9eeb1 Mon Sep 17 00:00:00 2001 From: rzaitov Date: Fri, 8 Nov 2013 13:11:38 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=82=D1=80=D0=B5=D1=84=D0=B0=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D0=B8=D0=BB=20InsideSetParser,=20=D1=87?= =?UTF-8?q?=D1=82=D0=BE=D0=B1=D1=8B=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20isV?= =?UTF-8?q?alid=20=D0=BF=D0=BE=D0=B2=D1=82=D0=BE=D1=80=D0=BD=D0=BE=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D1=81=D1=82=D1=80=D0=BE=D0=B8=D0=BB=20=D1=80?= =?UTF-8?q?=D0=B5=D0=B3=D1=83=D0=BB=D1=8F=D1=80=D0=BD=D0=BE=D0=B5=20=D0=B2?= =?UTF-8?q?=D1=8B=D1=80=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../parsers/InsideParser/InsideSetParser.py | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/scripts/TouchinBuild/parsers/InsideParser/InsideSetParser.py b/scripts/TouchinBuild/parsers/InsideParser/InsideSetParser.py index 6156d27..7269940 100644 --- a/scripts/TouchinBuild/parsers/InsideParser/InsideSetParser.py +++ b/scripts/TouchinBuild/parsers/InsideParser/InsideSetParser.py @@ -11,14 +11,9 @@ class InsideSetParser(LineParser): def parseLine(self, line): assert line is not None - filePathRegexp = r"'(?P[./ a-zA-Z]+\.{0})'".format(self.__extension) - keyRegexp = r'(?P[a-zA-Z]+)' - valueRegexp = r"'(?P[^']+)'" - - regexpSource = self.startsWith('inside') + filePathRegexp + self.keywordToken('set') + keyRegexp + self.keywordToken('to') + valueRegexp - regexp = re.compile(regexpSource, re.UNICODE) - - match = regexp.match(line) + matchInfo = self.getMatchInfo(line) + match = matchInfo[0] + regexpSource = matchInfo[1] self._guardMatch(match, line, regexpSource) filePath = match.group('file') @@ -27,9 +22,24 @@ class InsideSetParser(LineParser): return filePath, key, value - def isValidLine(self, line): - regexpSrc = r"inside\s+'[./ a-zA-Z]+\.{0}'\s+set".format(self.__extension) - regexp = re.compile(regexpSrc, re.UNICODE) + def getMatchInfo(self, line): + assert line is not None + + filePathRegexp = r"'(?P[./ a-zA-Z]+\.{0})'".format(self.__extension) + keyRegexp = r'(?P[a-zA-Z]+)' + valueRegexp = r"'(?P[^']+)'$" + + regexpSource = self.startsWith('inside') + filePathRegexp + self.keywordToken('set') + keyRegexp + \ + self.keywordToken('to') + valueRegexp + regexp = re.compile(regexpSource, re.UNICODE) match = regexp.match(line) + + return match, regexpSource + + def isValidLine(self, line): + assert line is not None + + matchInfo = self.getMatchInfo(line) + match = matchInfo[0] return match is not None \ No newline at end of file