diff --git a/parse_apache_configs/parse_config.py b/parse_apache_configs/parse_config.py index 99452b7..b6adfd9 100644 --- a/parse_apache_configs/parse_config.py +++ b/parse_apache_configs/parse_config.py @@ -5,16 +5,16 @@ # a conditional expression. The reason this is done # is so that a tag with the ">" operator in the # arguments will parse correctly. -OPERAND = Word(alphanums + "." + '"' + '/-' + "*:^_![]?$%@)(#=`" + '\\') +OPERAND = Word(alphanums + "." + '"' + '/-' + "*:^_|![]?$%@)(#=`'}{&+~" + '\\') OPERATOR = oneOf(["<=", ">=", "==", "!=", "<", ">", "~"], useRegex=False) -EXPRESSION_TAG = OPERAND + White() + OPERATOR + White() + OPERAND +EXPRESSION_TAG = Word(alphanums) + White() + OPERAND + White() + OPERATOR + White() + OPERAND # LITERAL_TAG will match tags that do not have # a conditional expression. So any other tag # with arguments that don't contain OPERATORs LITERAL_TAG = OneOrMore(Word( alphanums + '*:' + '/' + '"-' + '.' + " " + "^" + "_" + "!" + "[]?$" - + "'" + '\\' + + "'" + '\\' + "*:^_|![]?$%@)(#=`'}{&+~" )) # Will match the start of any tag TAG_START_GRAMMAR = Group(Literal("<") + (EXPRESSION_TAG | LITERAL_TAG) @@ -27,10 +27,9 @@ # Will match any directive. We are performing # a simple parse by matching the directive on # the left, and everything else on the right. -ANY_DIRECTIVE = Group(Word(alphanums) + Suppress(White()) +ANY_DIRECTIVE = Group(Word(alphanums+'_-@.') + Suppress(White()) + Word(printables + " ") + LineEnd()) - COMMENT = Group( (Literal("#") + LineEnd()) ^ (Literal("#")