Parenthesizing expressions

Does IDEA have a way to taken an unparenthesized or incompletely
parenthesized expression and make it fully parenthesized? For example,
taking this:
int a =0, b=0, c=0, d=0, e=0,f=0;
a = b = c+ - d + --e / -f;
and producing this for the assignment?
a = (b = (((c+) - d) + ((--e) / (-f))));
I don't see any such function, but wanted to ask as there have been
times that functionality was tucked away somewhere that I didn't notice.

Thanks,
Jon

5 comments
Comment actions Permalink

Perhaps a more important question is: why would you write code like that? :)


"Jon Steelman" <steelman@mindspring.com> wrote in message
news:auj47o$rh4$1@is.intellij.net...

Does IDEA have a way to taken an unparenthesized or incompletely
parenthesized expression and make it fully parenthesized? For example,
taking this:
int a =0, b=0, c=0, d=0, e=0,f=0;
a = b = c+ - d + --e / -f;
and producing this for the assignment?
a = (b = (((c+) - d) + ((--e) / (-f))));
I don't see any such function, but wanted to ask as there have been
times that functionality was tucked away somewhere that I didn't notice.

>

Thanks,
Jon

>


0
Comment actions Permalink

Perhaps a more important question is: why would you write code like that? :)

Blessed are those who maintain the elder's code, because the kingdom of heaven is theirs.
I think this could be done with the PSI api...

--
Composed with Newz Crawler 1.3 http://www.newzcrawler.com/

0
Comment actions Permalink

dimiter wrote:
>>Perhaps a more important question is: why would you write code like that? :)


Blessed are those who maintain the elder's code, because the kingdom of heaven is theirs.


You answer Ian question well.

I think this could be done with the PSI api...


That's encouraging.

Jon

0
Comment actions Permalink

Ian wrote:

Perhaps a more important question is: why would you write code like that? :)


Somebody I know wrote code with a 600 line anonymous inner class (that
also included a trailing method invocation at the end of the
declaration). Once you see enough stuff like that, you say to yourself,
"Why ask why?" followed by "Just give me the proper instruments so I can
give that code an enema." Over-the-counter or by prescription, IDEA is
the best enema around. ;)

Jon

0
Comment actions Permalink

Jon Steelman wrote:

Over-the-counter or by prescription, IDEA is the best enema around. ;)


Now there's a quote for the IntelliJ front page!

Ciao,
Gordon

--
Gordon Tyler
Software Developer, R&D
Sitraka (now part of Quest Software)
"Performance is Mission Critical"

0

Please sign in to leave a comment.