diff --git a/scripts/parser/SettingsParser/SettingsLineParser.py b/scripts/parser/SettingsParser/SettingsLineParser.py new file mode 100644 index 0000000..72909b6 --- /dev/null +++ b/scripts/parser/SettingsParser/SettingsLineParser.py @@ -0,0 +1,27 @@ +from parser.LineParser import LineParser +import re + +class SettingsLineParser(LineParser): + def parseLine(self, line): + assert line is not None + + pathAndValue = self.splitToPathAndValue(line) + propertyPath = pathAndValue[0] + value = [1] + + + def splitToPathAndValue(self, line): + + propPathRegexp = r"^(?P[\w.]+)" + valueRegexp = "'(?P.*)'" + + regexpSource = propPathRegexp + self.keywordToken('=') + valueRegexp + regexp = re.compile(regexpSource, re.UNICODE) + + match = regexp.match(line) + self._guardMatch(match, line, regexpSource) + + propPath = match.group('prop_path') + value = match.group('value') + + return (propPath, value) \ No newline at end of file diff --git a/scripts/parser/SettingsParser/SettingsParser.py b/scripts/parser/SettingsParser/SettingsParser.py new file mode 100644 index 0000000..559794e --- /dev/null +++ b/scripts/parser/SettingsParser/SettingsParser.py @@ -0,0 +1,4 @@ +class SettingsParser: + def __init__(self, content): + assert content is not None + pass diff --git a/scripts/parser/SettingsParser/__init__.py b/scripts/parser/SettingsParser/__init__.py new file mode 100644 index 0000000..cc31abc --- /dev/null +++ b/scripts/parser/SettingsParser/__init__.py @@ -0,0 +1 @@ +__author__ = 'rzaitov'