c语言注释工具,C语言注释删除小工具下载

C语言注释删除小工具是一款删除c语言注释并实现编译的工具,如果你喜欢这款软件,就快来IT猫扑下载吧!

C语言注释删除小工具介绍

很多编译器不支持中文注释,特别是日系的单片机编译器,这是一个C语言注释删除小工具,轻松编译。

a89389efe3ddf8c0d61ba994ae87c6ed.png

C语言中注释种类

1) /* hello world */

2) // hello world

3) #if 0

hello world

#endif

目前C语言中的主流注释方式为第一种,故暂时只实现了第一种,其实原理都是一样的。核心原理即为状态机,读入一个字符,根据当前状态和读入的字符转入下一个状态,每一个状态都有相应的动作处理读入的字符,如忽略或写入输出文件或退出上一个字符等等。

共有以下几个状态

#define STATUS_OUTTE 0 /* 在注释和引号外面 */

#define STATUS_DOTTE 1 /* 在引号内部 */

#define STATUS_STIN1 2 /* 读入 /,等待 * */

#define STATUS_STIN2 3 /* 读入 /* , 准备进入注释 */

#define STATUS_STINN 4 /* 在注释内部 */

#define STATUS_STOU1 5 /* 读入 * , 等待 / */

#define STATUS_STOU2 6 /* 读入 */, 准备离开注释 */

#define STATUS_STACT 7 /* 伪状态,表示状态机动作 */

状态机有以下几种动作

#define STFLAG_NOACT 0 /* 没动作,忽略字符 */

#define STFLAG_FPUTC 1 /* 将字符写入输出文件 */

#define STFLAG_UNPUT 2 /* 将上一个字符退出 */

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
C代码注释删除工具,用Lex生成。可删除C源程序的/* xxxx */的块或单行注释,及C++风格的单行注释,对于常量字符串出现的注释不清除。文件包含Lex代码及编译的Linux下的可执行文件。编译及使用见Readme。 C注释的类型如下 // /* // * "C-style block comment be removed // * C-style block comment be removed" // * C-style block comment be removed // */ // // /* C-style single line comment be removed */ // // // c++ comment be removed // // ///* c++ comment be removed */ // c++ comment be removed // // // c++ comment enclosed with double-quote untouched // "////*\"c++ comment enclosed with double-quote untouched\" ##*/\n" // // // c-style single line comment enclosed with double-quote untouched // "/*c-style multiple line comment enclosed with double-quote untouched*/\n" // // // c-style multiple line comment enclosed with double-quote untouched // "/** c-style multiple line comment enclosed with double-quote untouched \n\ // \n next line\ // */\n" 示例文件: int main() { /* * "C-style block comment be removed * C-style block comment be removed" * C-style block comment be removed */ /* C-style single line comment be removed */ int foo; /* C-style single line comment be removed */ /* C-style single line comment be removed */ int bar; int foobar; /* "C-style block comment be removed C-style block comment be removed C-style block comment be removed */ // c++ comment be removed ///* c++ comment be removed */ // c++ comment be removed // "////" ???? // "/*test file */" ????? /* ssss /* dddd */ printf("////*\"c++ comment enclosed with double-quote untouched\" ##*/\n"); // c++ comment enclosed with double-quote untouched printf("/*c-style multiple line comment enclosed with double-quote untouched*/\n"); // c-style single line comment enclosed with double-quote untouched // printf("/** test cmnt \n //\n ss //*/"); printf("/** c-style multiple line comment enclosed with double-quote untouched \n\ \n next line\ */\n"); // c-style multiple line comment enclosed with double-quote untouched } 注释删除后成为: int main() { int foo; int bar; int foobar; printf("////*\"c++ comment enclosed with double-quote untouched\" ##*/\n"); printf("/*c-style multiple line comment enclosed with double-quote untouched*/\n"); printf("/** c-style multiple line comment enclosed with double-quote untouched \n\ \n next line\ */\n"); }

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值