-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expression tree inspection for redundant signs, parentheses and operators #2222
Comments
lol - #2222 for an issue about repeated characters 😄 |
I think this inspection needs to be a bit broader - it's going to have to analyze expression trees, and doing that only to issue an inspection result the odd time a double negative sign is encountered seems a bit of a waste. Let's make it about redundant signs, parentheses and operators - and make it trip when it encounters convoluted expressions such as:
..which would simplify/fix to:
|
Inspection for redundant parentheses will be a problem until #2206 is fixed. |
Could we perhaps make a distinction between expressions that can be optimized, and expressions that are just wrapped in parentheses for no good reason? Optimization seems potentially hard: These seem easier:
|
Would RegEx compliment or complicate this? |
Regex would probably be inadequate. You need to find balanced parentheses around an expression, where removing the parentheses would result in an identical expression. This expression starts and ends with
This expression is still valid, after the removal of the surrounding parentheses (even if there is further optimization possible:
|
we should be able to identify the most basic forms:
|
VBA allows for multiple negative signs. In most cases, they can be simplified.
The text was updated successfully, but these errors were encountered: