diff --git a/conf/format-options.py b/conf/format-options.py index b36e28671..e0fa18055 100755 --- a/conf/format-options.py +++ b/conf/format-options.py @@ -55,14 +55,6 @@ man pages) the following format can be used: full.section.name.include files/to/include Description of this include statement - -Dots in section/option names may be escaped with a backslash. For instance, -with the following section description - -charon.filelog./var/log/daemon\.log {} - Section to define logging into /var/log/daemon.log - -/var/log/daemon.log will be the name of the last section. """ import sys @@ -74,10 +66,10 @@ from functools import cmp_to_key, total_ordering @total_ordering class ConfigOption: """Representing a configuration option or described section in strongswan.conf""" - def __init__(self, path, default = None, section = False, commented = False, include = False): - self.path = path - self.name = path[-1] - self.fullname = '.'.join(path) + def __init__(self, fullname, default = None, section = False, commented = False, include = False): + self.path = fullname.split('.') + self.name = self.path[-1] + self.fullname = fullname self.default = default self.section = section self.commented = commented @@ -141,8 +133,7 @@ class Parser: if m: if self.__current: self.__add_option(self.__current) - path = self.__split_name(m.group('name')) - self.__current = ConfigOption(path, m.group('default'), + self.__current = ConfigOption(m.group('name'), m.group('default'), commented = not m.group('assign')) return # section definition @@ -150,8 +141,7 @@ class Parser: if m: if self.__current: self.__add_option(self.__current) - path = self.__split_name(m.group('name')) - self.__current = ConfigOption(path, section = True, + self.__current = ConfigOption(m.group('name'), section = True, commented = m.group('comment')) return # include definition @@ -159,8 +149,7 @@ class Parser: if m: if self.__current: self.__add_option(self.__current) - path = self.__split_name(m.group('name')) - self.__current = ConfigOption(path, m.group('pattern'), include = True) + self.__current = ConfigOption(m.group('name'), m.group('pattern'), include = True) return # paragraph separator m = re.match(r'^\s*$', line) @@ -171,10 +160,6 @@ class Parser: if m and self.__current: self.__current.add(m.group('text')) - def __split_name(self, name): - """Split the given full name in a list of section/option names""" - return [x.replace('\.', '.') for x in re.split(r'(?