Readable code (Was: Re: [H-GEN] Which is better?)
Trent WADDINGTON
s337240 at student.uq.edu.au
Fri Apr 30 04:05:36 EDT 2004
On Fri, 30 Apr 2004, Greg Black wrote:
> On 2004-04-30, Trent Waddington wrote:
>
> > http://rtfm.insomnia.org/~qg/indent-2.2.9-with-sb.patch
>
> OK, I tried it out. It indents the semi-colon the wrong amount,
> but it does leave it on the line on its own. Using -i4, this is
> how the line in question comes out:
>
> for (p = buf; isspace(*p); ++p)
> ;
>
> But the result I wanted was:
>
> for (p = buf; isspace(*p); ++p)
> ;
>
> I haven't read the code -- was this an artifact of your change
> or another indent thing?
It was a result of me not doing:
parser_state_tos->ind_stmt = 0;
after my call to dump_line. I've updated the patch at the url above to
reflect this change. Or apply this:
--- indent_old.c Fri Apr 30 04:02:54 2004
+++ indent.c Fri Apr 30 03:57:45 2004
@@ -969,6 +969,7 @@
if (*last_token_ends_sp && settings.newline_sp_semicolon)
{
dump_line (true, &paren_target);
+ parser_state_tos->ind_stmt = 0;
}
*e_code++ = ';';
Should give you a single indent now.
Trent
More information about the General
mailing list