Skip to content

Commit

Permalink
generate_test_code.py: simplify regex expression
Browse files Browse the repository at this point in the history
"\w" already matches "[a-zA-Z0-9_]" so CONDITION_VALUE_REGEX
can be simplified as proposed in this commit.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
  • Loading branch information
valeriosetti committed Oct 11, 2024
1 parent bf87497 commit c9d6bf4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/generate_test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@
# - math operators, i.e "+", "-", "*", "/"
# - bitwise operators, i.e. "^", "|", "&", "~", "<<", ">>"
# - parentheses, i.e. "()"
CONDITION_VALUE_REGEX = r'[\d|\w|\(][\s_\(\)0-9a-zA-Z\+\-\*\/\^\|\&\~\<\>]*'
CONDITION_VALUE_REGEX = r'[\w|\(][\s\w\(\)\+\-\*\/\^\|\&\~\<\>]*'
CONDITION_REGEX = r'({})(?:\s*({})\s*({}))?$'.format(C_IDENTIFIER_REGEX,
CONDITION_OPERATOR_REGEX,
CONDITION_VALUE_REGEX)
Expand Down

0 comments on commit c9d6bf4

Please sign in to comment.