工具找到注释掉的VHDL代码 [英] Tool to find commented out VHDL code

查看:173
本文介绍了工具找到注释掉的VHDL代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题询问一般问题。我特别要问VHDL,因为问题的回答提到的工具是用于Java和PL / SQL。它不需要是完美的,一些手动解释会很好。我这样做是为了自动提交任务。

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.

编辑3/9/11:@phillipe指出自动提交任务与手动解释不一致。我试图鼓励其他工程师摆脱代码,看到他们做到了。我想一个悲观的工具会更好的承诺;如果它错过了一些不是世界末日的代码。或者我可以让它报告这样的行的数量和电子邮件,而不是停止提交。

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.

推荐答案

这里是我目前使用的

egrep  "^\s*--.*[;,]$" *.vhd

即,找到可能有空格,然后是文本,并以a结尾的行;要么 ,。我发现逗号在注释是正常的,但这两个字符经常注释出代码,因为他们经常使用在VHDL行的结尾。

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.

使用什么@Freddy Mallet建议在引用关于关键字,我想出了这个。我试图使用不常用于英语的VHDL关键字。这对于相同的代码来说往往工作良好,但是对诸如process for ...的评论有麻烦。您可能希望使用egrep -f并将regexp放在一个文件中。

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.

  egrep "^\s*--.*([;,]$|\s(architecture|array|assert|begin|block|case|component|downto|elsif|entity|generate|generic|inout|library|null|package|port|range|records|select|signal|type|until)\s)" src/*.vhd    

这篇关于工具找到注释掉的VHDL代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆