<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 226: $IFDEF not handled well in case labels</title><link>https://sourceforge.net/p/jedicodeformat/bugs/226/</link><description>Recent changes to 226: $IFDEF not handled well in case labels</description><atom:link href="https://sourceforge.net/p/jedicodeformat/bugs/226/feed.rss" rel="self"/><language>en</language><lastBuildDate>Mon, 13 May 2013 04:18:50 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/jedicodeformat/bugs/226/feed.rss" rel="self" type="application/rss+xml"/><item><title>$IFDEF not handled well in case labels</title><link>https://sourceforge.net/p/jedicodeformat/bugs/226/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Given a piece of code like this:&lt;/p&gt;
&lt;p&gt;var anEnumVariable: TMyEnum;&lt;br /&gt;
begin&lt;br /&gt;
...&lt;br /&gt;
case anEnumVariable of&lt;br /&gt;
{$IFDEF SOMETHING}&lt;br /&gt;
enumFirst:&lt;br /&gt;
{$ELSE}&lt;br /&gt;
enumSecond :&lt;br /&gt;
{$ENDIF}&lt;br /&gt;
begin&lt;br /&gt;
end;&lt;/p&gt;
&lt;p&gt;Current JCF turns it into this:&lt;/p&gt;
&lt;p&gt;case anEnumVariable of&lt;br /&gt;
{$IFDEF SOMETHING}&lt;br /&gt;
enumFirst:&lt;br /&gt;
{$ELSE}&lt;br /&gt;
begin&lt;br /&gt;
end;&lt;br /&gt;
{$ENDIF}&lt;/p&gt;
&lt;p&gt;Which doesn't compile. And I have hundreds of these to patch up. I realise it's not ideal coding, but that's what the legacy code I'm faced with has. &lt;/p&gt;
&lt;p&gt;Among other problems, not least the D2010 formatted adding a lot of linebreaks in almost random places, which I'd like JCF to remove for me.&lt;/p&gt;
&lt;p&gt;I'm going to have a go at building the JCF so I can add a "only remove single line begin-end pairs from case statements" option (and BTW the "remove single statement begin-end pairs might benefit from an "except multiline single statements" so it does not strip them from "if then begin for begin" type statements). The other programmers like their single line ones, but in a case statement it becomes ugly:&lt;/p&gt;
&lt;p&gt;case Foo of&lt;br /&gt;
this: Something();&lt;br /&gt;
that: OtherThing();&lt;br /&gt;
end;&lt;/p&gt;
&lt;p&gt;is much nicer than&lt;/p&gt;
&lt;p&gt;case Foo of&lt;br /&gt;
this: &lt;br /&gt;
begin&lt;br /&gt;
Something();&lt;br /&gt;
end;&lt;br /&gt;
that: &lt;br /&gt;
begin&lt;br /&gt;
OtherThing();&lt;br /&gt;
end;&lt;br /&gt;
end;&lt;/p&gt;
&lt;p&gt;but we have a lot of the latter. Especially, we have a lot of 10+ label versions, and 40+ lines per instance is a lot.&lt;/p&gt;&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Chris Moseley</dc:creator><pubDate>Mon, 13 May 2013 04:18:50 -0000</pubDate><guid>https://sourceforge.net525f5c7795a1578a5f7af4b742f838603bf4c8a8</guid></item></channel></rss>