vhdl-style-guide icon indicating copy to clipboard operation
vhdl-style-guide copied to clipboard

Rule to remove superfluous brackets

Open imd1 opened this issue 4 years ago • 4 comments

For example, the brackets in the following snippet are superfluous, could there be a rule to remove them?

      if (sync_reset) = '1' then

imd1 avatar Oct 06 '21 10:10 imd1

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.

jeremiah-c-leary avatar Oct 07 '21 00:10 jeremiah-c-leary

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

imd1 avatar Oct 07 '21 14:10 imd1

This ticket is incorrectly assigned as User Feedback?

imd1 avatar Dec 31 '21 09:12 imd1

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

jeremiah-c-leary avatar Feb 06 '22 15:02 jeremiah-c-leary