From 22d3abd8179e85d5646881e879a370c21d1ab53a Mon Sep 17 00:00:00 2001 From: rzaitov Date: Fri, 8 Nov 2013 12:54:21 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BF=D0=B0=D1=80=D1=81=D0=B5=D1=80=20=D0=B4=D0=BB=D1=8F=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B=20=D0=BF=D0=B0=D1=82?= =?UTF-8?q?=D1=87=D0=B8=D0=BD=D0=B3=D0=B0=20csproj=20=D1=84=D0=B0=D0=B9?= =?UTF-8?q?=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InsideParser/InsideCsprojSetParser.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 scripts/TouchinBuild/parsers/InsideParser/InsideCsprojSetParser.py diff --git a/scripts/TouchinBuild/parsers/InsideParser/InsideCsprojSetParser.py b/scripts/TouchinBuild/parsers/InsideParser/InsideCsprojSetParser.py new file mode 100644 index 0000000..9357698 --- /dev/null +++ b/scripts/TouchinBuild/parsers/InsideParser/InsideCsprojSetParser.py @@ -0,0 +1,48 @@ +import re + +from parsers.LineParser import LineParser + + +class InsideCsprojSetParser(LineParser): + def __init__(self, fileExt): + LineParser.__init__(self) + + self.__extension = fileExt + + def parseLine(self, line): + assert line is not None + + matchInfo = self.getMatchInfo(line) + match = matchInfo[0] + regexpSource = matchInfo[1] + self._guardMatch(match, line, regexpSource) + + filePath = match.group('file') + key = match.group('key') + value = match.group('value') + slnConfig = match.group('config') + + return filePath, key, value, slnConfig + + 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[^']+)'" + slnConfigRegexp = r"'(?P[a-zA-Z|]+)'$" + + regexpSource = self.startsWith('inside') + filePathRegexp + self.keywordToken('set') + keyRegexp + \ + self.keywordToken('to') + valueRegexp + self.than('for') + slnConfigRegexp + 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