diff --git a/TODO.txt b/TODO.txt deleted file mode 100644 index e69de29..0000000 diff --git a/calculate/templates/format/compiz_format.py b/calculate/templates/format/compiz_format.py index 7d36c48..abe982a 100644 --- a/calculate/templates/format/compiz_format.py +++ b/calculate/templates/format/compiz_format.py @@ -3,9 +3,9 @@ from .base_format import Format from ..template_engine import ParametersContainer from collections import OrderedDict -from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\ - OneOrMore, alphanums, ParseException, restOfLine,\ - pyparsing_unicode, Group, Optional, Regex +from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\ + alphanums, ParseException, restOfLine, Group, Optional,\ + Regex class CompizFormat(Format): diff --git a/calculate/templates/format/dovecot_format.py b/calculate/templates/format/dovecot_format.py index 571a434..c109fa6 100644 --- a/calculate/templates/format/dovecot_format.py +++ b/calculate/templates/format/dovecot_format.py @@ -6,8 +6,8 @@ from .base_format import Format from ..template_engine import ParametersContainer from collections import OrderedDict -from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\ - OneOrMore, alphanums, ParseException, pyparsing_unicode,\ +from pyparsing import originalTextFor, Literal, Word, printables,\ + OneOrMore, alphanums, ParseException, Regex,\ Group, Optional, alphas, lineEnd, lineStart, Keyword @@ -73,11 +73,7 @@ class DovecotFormat(Format): cls._comment_line_parser = originalTextFor( Literal(cls.comment_symbol) - + ZeroOrMore(Word( - printables - + pyparsing_unicode.alphanums) - ) - )('comment') + + Regex(r'.*'))('comment') # Для парсинга строк с началом секций. section = Word(alphas, alphanums+'-_', excludeChars='{}') @@ -96,7 +92,7 @@ class DovecotFormat(Format): # Для парсинга строк, содержащих параметры. parameter_name = Word(alphas, alphanums+'_-', excludeChars='{}=') - parameter_value = OneOrMore(Word(printables)) + parameter_value = Regex(r'\S+(\s+\S+)*') cls._parameter_line_parser = (Group(Optional(action_symbols, default='')('action') @@ -117,11 +113,11 @@ class DovecotFormat(Format): include = Keyword('!include') | Keyword('!include_try') include_line_plain = (Optional(~action_symbols, default='')('action') - + include('keyword') + Word(printables)('value')) + + include('keyword') + Regex(r'\S+')('value')) include_line_to_delete = (action_symbols('action') + include('keyword') - + Word(printables)('value')) + + Regex(r'\S+')('value')) cls._include_line_parser = (include_line_plain | include_line_to_delete) diff --git a/calculate/templates/format/kernel_format.py b/calculate/templates/format/kernel_format.py index df28e0d..300be95 100644 --- a/calculate/templates/format/kernel_format.py +++ b/calculate/templates/format/kernel_format.py @@ -3,9 +3,9 @@ from .base_format import Format from ..template_engine import ParametersContainer from collections import OrderedDict -from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\ - ZeroOrMore, OneOrMore, ParseException, restOfLine,\ - pyparsing_unicode, Group, Optional +from pyparsing import Word, Literal, alphanums, originalTextFor,\ + OneOrMore, ParseException, restOfLine, Group, Optional,\ + Regex class KernelFormat(Format): @@ -59,9 +59,8 @@ class KernelFormat(Format): '''Метод для инициализации парсеров.''' parameter_name = Word(alphanums+'_')('parameter_name') - parameter_value = originalTextFor( - OneOrMore(Word(printables)) - )('parameter_value') + parameter_value = originalTextFor(Regex(r'\S+(\s+\S+)*') + )('parameter_value') action_symbols = (Literal('!') | Literal('-')) @@ -79,9 +78,7 @@ class KernelFormat(Format): cls._comment_line = originalTextFor( Literal(cls.comment_symbol).suppress() - + ZeroOrMore(Word(printables - + pyparsing_unicode.alphanums)) - )('Comment') + + Regex(r'.*'))('Comment') cls._initialized = True def _parse_parameter_line(self, line): diff --git a/calculate/templates/format/ldap_format.py b/calculate/templates/format/ldap_format.py index 9ae6bd2..eb53252 100644 --- a/calculate/templates/format/ldap_format.py +++ b/calculate/templates/format/ldap_format.py @@ -3,10 +3,9 @@ from .base_format import Format from ..template_engine import ParametersContainer from collections import OrderedDict -from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\ - OneOrMore, alphanums, ParseException, restOfLine,\ - pyparsing_unicode, nums, delimitedList, Optional,\ - Keyword, SkipTo, Group +from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\ + alphanums, ParseException, restOfLine, nums,\ + delimitedList, Optional, Keyword, SkipTo, Group, Regex class LDAPFormat(Format): @@ -76,9 +75,7 @@ class LDAPFormat(Format): '''Метод для инициализации парсеров.''' cls._comment_line = originalTextFor( Literal(cls.comment_symbol) - + ZeroOrMore(Word(printables - + pyparsing_unicode.alphanums)) - )('comment') + + Regex(r'.*'))('comment') action_symbols = (Literal('!') | Literal('-')) assignment = Literal('=') diff --git a/calculate/templates/format/openrc_format.py b/calculate/templates/format/openrc_format.py index 54964ec..8a7fee3 100644 --- a/calculate/templates/format/openrc_format.py +++ b/calculate/templates/format/openrc_format.py @@ -3,9 +3,8 @@ from .base_format import Format from ..template_engine import ParametersContainer from collections import OrderedDict -from pyparsing import Word, Literal, printables, originalTextFor, ZeroOrMore,\ - OneOrMore, ParseException, restOfLine,\ - pyparsing_unicode, Group, Optional +from pyparsing import Word, Literal, printables, originalTextFor, OneOrMore,\ + ParseException, restOfLine, Group, Optional, Regex class OpenRCFormat(Format): @@ -75,9 +74,7 @@ class OpenRCFormat(Format): cls._comment_line = originalTextFor( Literal(cls.comment_symbol) - + ZeroOrMore(Word(printables - + pyparsing_unicode.alphanums)) - )('comment') + + Regex(r'.*'))('comment') cls._initialized = True def _parse_parameter_line(self, line): diff --git a/calculate/templates/format/postfix_format.py b/calculate/templates/format/postfix_format.py index 5161c6d..dffa683 100644 --- a/calculate/templates/format/postfix_format.py +++ b/calculate/templates/format/postfix_format.py @@ -3,9 +3,8 @@ from .base_format import Format from ..template_engine import ParametersContainer from collections import OrderedDict -from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\ - ZeroOrMore, OneOrMore, ParseException,\ - pyparsing_unicode, Group, Optional +from pyparsing import Word, Literal, alphanums, originalTextFor, OneOrMore,\ + ParseException, Group, Optional, printables, Regex class PostfixFormat(Format): @@ -76,8 +75,7 @@ class PostfixFormat(Format): cls._comment_line = originalTextFor( Literal(cls.comment_symbol) - + ZeroOrMore(Word(printables - + pyparsing_unicode.alphanums)) + + Regex(r'.*') )('comment') def _parse_parameter_line(self, line): diff --git a/calculate/templates/format/procmail_format.py b/calculate/templates/format/procmail_format.py index c11c021..4c0bf50 100644 --- a/calculate/templates/format/procmail_format.py +++ b/calculate/templates/format/procmail_format.py @@ -4,8 +4,8 @@ from .base_format import Format from ..template_engine import ParametersContainer from collections import OrderedDict from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\ - ZeroOrMore, OneOrMore, ParseException, restOfLine,\ - pyparsing_unicode, Group, Optional + OneOrMore, ParseException, restOfLine, Group, Optional,\ + Regex class ProcmailFormat(Format): @@ -75,13 +75,8 @@ class ProcmailFormat(Format): )('parameter_name') + restOfLine.suppress()) - cls._comment_line = originalTextFor( - Literal(cls.comment_symbol) - + ZeroOrMore( - Word(printables - + pyparsing_unicode.alphanums) - ) - )('comment') + cls._comment_line = originalTextFor(Literal(cls.comment_symbol) + + Regex(r'.*'))('comment') cls._initialized = True def _parse_parameter_line(self, line): diff --git a/calculate/templates/format/proftpd_format.py b/calculate/templates/format/proftpd_format.py index c301edb..4275e3d 100644 --- a/calculate/templates/format/proftpd_format.py +++ b/calculate/templates/format/proftpd_format.py @@ -4,9 +4,9 @@ from .base_format import Format, FormatError from ..template_engine import ParametersContainer from jinja2 import Environment, PackageLoader from collections import OrderedDict -from pyparsing import originalTextFor, Literal, ZeroOrMore, Word, printables,\ - OneOrMore, alphanums, ParseException, pyparsing_unicode,\ - Group, Optional, alphas, Keyword +from pyparsing import originalTextFor, Literal, Word, printables, Regex,\ + OneOrMore, alphanums, ParseException, Group, Optional,\ + alphas, Keyword, ZeroOrMore class ProFTPDFormat(Format): @@ -221,9 +221,7 @@ class ProFTPDFormat(Format): cls._comment_line = originalTextFor( Literal(cls.comment_symbol) - + ZeroOrMore(Word(printables - + pyparsing_unicode.alphanums)) - )('comment') + + Regex(r'.*'))('comment') cls._initialized = True def _parse_section_start_line(self, line):