任何带{}插入选项的预处理工具? [英] Any preprocessing tool with {} insertion option?

查看:49
本文介绍了任何带{}插入选项的预处理工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有预处理器(或实用程序)可以选择插入缺少

括号来澄清控制语法,即/ while / if / else / etc?

for(.....)

for(....)

声明;


to


for(....)

{

for(...)

{

声明;

}

}



解决方案

David Frank写道:

是否有预处理器(或实用程序)可以选择插入缺少的
括号来阐明控制语法,即/ while / if / else / etc?

for(.....)
for(....)
声明;



for(....)
{
for(...)
{
声明;
} }




嗨大卫,


我也在寻找其中一个......我还没有到目前为止运气不错。

我遇到的最接近的人到目前为止采取ctree / ctool
http://www.google.com/search?hl=en&l...&q=ctool+ctree

然后很容易适应它来做到这一点。不幸的是,你得到的是什么

是预处理源(扩展的宏:-(),这不是很好的理想。


之前已经问过这个问题了,但是我不记得曾经看到过''正确'的答案(即是。它被称为< name工具>"")


您可以通过缩进或其他任何方式运行您的源代码,以使

结构明显,但这不是什么你要求(也不是我要找b $ b)。


干杯,


威廉。


-

William McNicol Picsel Technologies Ltd http://www.picsel.com
wi ** ***********@picsel.com 苏格兰格拉斯哥。

[给一个人一条鱼,他会吃一天,

给他一本字典,他就会知道生命的意义。]


David Frank写道:


是否有预处理器(或实用程序)可以选择插入缺少的
括号来澄清控制语法,即for / while / if / else / etc?

for(.....)
for(....)
statement;


for(....)
{
for(...)
{
声明; }
}




您可以尝试编写一个插入大括号的脚本,如果开放式大括号是

遇到循环/测试时的当前或下一行

语句。这可能会让你在90%的路上。


/ david


-

Andre,一个简单的农民,当他沿着东墙悄悄地抬起来时,脑子里只有一件事:''安德烈,蠕动......安德烈,蠕动......安德烈,蠕动。''
- unknown


David Frank写道:

是否有预处理器(或实用程序)可供选择插入缺席
大括号以澄清控制语法,即/ while / if / else / etc?

for(.....)
for(.... )
声明;

(....)
{
(...)
{
声明;
}
}




不需要预处理器选项...我想要一个

删除所有不严格要求的大括号。 ;)

-

Morris Dovey

美国爱荷华州西得梅因

C链接 http://www.iedu.com/c


Is there a preprocessor (or utility) that has option to insert absent
braces to clarify control syntax, ie for/while/if/else/etc ?
for(.....)
for(....)
statement;

to

for(....)
{
for(...)
{
statement;
}
}




解决方案

David Frank wrote:

Is there a preprocessor (or utility) that has option to insert absent
braces to clarify control syntax, ie for/while/if/else/etc ?
for(.....)
for(....)
statement;

to

for(....)
{
for(...)
{
statement;
}
}



Hi David,

I''m looking for one of them too.. I haven''t had any luck so far.
The closest I''ve come across so far is to take ctree/ctool
http://www.google.com/search?hl=en&l...&q=ctool+ctree
which is then trivial to adapt to make it do this. Unfortunately, what
you get out is pre-processed source (macros expanded :-( ) which isn''t
always ideal.

The question has been asked here previously, but I don''t recall ever
seeing the ''right'' answer (i.e. "Yes. It''s called <name of tool>")

You could just run your source through indent or whatever, to make
the structure obvious, but that''s not what you asked for (nor what I''m
looking for).

Cheers,

William.

--
William McNicol Picsel Technologies Ltd http://www.picsel.com
wi*************@picsel.com Glasgow, Scotland.
[Give a man a fish and he will eat for a day,
Give him a dictionary and he will know the meaning of life.]


David Frank wrote:


Is there a preprocessor (or utility) that has option to insert absent
braces to clarify control syntax, ie for/while/if/else/etc ?

for(.....)
for(....)
statement;

to

for(....)
{
for(...)
{
statement;
}
}



You could try writing a script which inserts braces if an open-brace is
not found on the current or next line when you encounter a loop/test
statement. This will probably get you 90% of the way there.

/david

--
Andre, a simple peasant, had only one thing on his mind as he crept
along the East wall: ''Andre, creep... Andre, creep... Andre, creep.''
-- unknown


David Frank wrote:

Is there a preprocessor (or utility) that has option to insert absent
braces to clarify control syntax, ie for/while/if/else/etc ?

for(.....)
for(....)
statement;

to

for(....)
{
for(...)
{
statement;
}
}



No preprocessor option is needed... I''d like a utility that
removes all braces that aren''t strictly required. ;)
--
Morris Dovey
West Des Moines, Iowa USA
C links at http://www.iedu.com/c


这篇关于任何带{}插入选项的预处理工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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