This question asks the general question. I’m asking about VHDL in particular, since the tools that question’s answer mentions are for Java and PL/SQL. It doesn’t need to be perfect, some manual interpretation would be fine. I’m doing this for an automated commit task.
EDIT 3/9/11: @phillipe pointed out automated commit task is inconsistent with manual interpretation. I’m trying to encourage other engineers to get rid of code and see that they did it. I guess a pessimistic tool would be better for commits; if it misses some code that isn’t the end of the world. Or I could make it report the number of such lines and email me rather than stop the commit.
Here’s what I am using so far
i.e., find lines that may have whitespace, then text, and end in a ; or ,. I found commas in comments were normal but those two characters were frequently comments out code since they frequently used at the end of VHDL lines.
Using what @Freddy Mallet suggested in the referenced about keywords, I came up with this. I tried to use VHDL keywords that aren’t commonly used in English. This tended to work well for the same code, but had troubles on comments such as “process for …”. You might wish to use egrep -f and put the regexp in a file.