Skip to content

Commit

Permalink
fix filter grammar issue
Browse files Browse the repository at this point in the history
  • Loading branch information
xmendez committed Apr 17, 2019
1 parent 58ed857 commit 04ac520
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/wfuzz/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, ffilter=None, filter_string=None):
int_values = Word("0123456789").setParseAction(lambda s, l, t: [int(t[0])])
error_value = Literal("XXX").setParseAction(self.__compute_xxx_value)
bbb_value = Literal("BBB").setParseAction(self.__compute_bbb_value)
field_value = Word(alphas + "." + "_" + "-")
field_value = Word(alphas.lower() + "." + "_" + "-")

basic_primitives = int_values | quoted_str_value

Expand All @@ -42,7 +42,7 @@ def __init__(self, ffilter=None, filter_string=None):
fuzz_value_op = ((fuzz_symbol + Suppress("[") + Optional(field_value)).setParseAction(self.__compute_fuzz_value) + operator_call + Suppress("]")).setParseAction(self.__compute_perl_value)
fuzz_value_op2 = ((fuzz_symbol + operator_call).setParseAction(self.__compute_perl_value))

res_value_op = (Word("0123456789" + alphas + "." + "_" + "-").setParseAction(self.__compute_res_value) + Optional(operator_call, None)).setParseAction(self.__compute_perl_value)
res_value_op = (Word("0123456789" + alphas.lower() + "." + "_" + "-").setParseAction(self.__compute_res_value) + Optional(operator_call, None)).setParseAction(self.__compute_perl_value)
basic_primitives_op = (basic_primitives + Optional(operator_call, None)).setParseAction(self.__compute_perl_value)

fuzz_statement = basic_primitives_op ^ fuzz_value ^ fuzz_value_op ^ fuzz_value_op2 ^ res_value_op
Expand All @@ -52,7 +52,7 @@ def __init__(self, ffilter=None, filter_string=None):

symbol_expr = Group(fuzz_statement + oneOf("= == != < > >= <= =~ !~ ~ := =+ =-") + (bbb_value ^ error_value ^ basic_primitives ^ fuzz_statement)).setParseAction(self.__compute_expr)

definition = fuzz_statement ^ symbol_expr
definition = symbol_expr ^ fuzz_statement
definition_not = not_operator + definition
definition_expr = definition_not + ZeroOrMore(operator + definition_not)

Expand Down

0 comments on commit 04ac520

Please sign in to comment.