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