vhdl-style-guide
vhdl-style-guide copied to clipboard
Rule to remove superfluous brackets
For example, the brackets in the following snippet are superfluous, could there be a rule to remove them?
if (sync_reset) = '1' then
If we could determine which ones are superfluous....
if (a = '1') and (b = '0') then
those are extra, but...
if (a = '1' and b = '0') and (c = '0' or d = '1') then
...those are not.
we would need to figure out the rules.
I think that my example is an obvious case, but your examples are less so, in the sense that the brackets do provide a documentation grouping benefit and some people prefer that explicit style
This ticket is incorrectly assigned as User Feedback?
Hey @imd1,
We should pick this back up.
I was thinking that you could use logical operators to determine which parenthesis are superfluous. In my previous example:
if (a = '1' and b = '0') and (c = '0' or d = '1') then
The parenthesis are not superflous because of the logic operator. This would probably be true of logic operators also.
Is the rule simply a single word enclosed by parenthesis? Like in your example?
We could always start the rule out at that level and then add to it as we need to.
--Jeremy