[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[StrongED] Better C folding
- To: StrongED@xxxxxxxxxxxxxx
- Subject: [StrongED] Better C folding
- From: Richard Griffin <rik.griffin@xxxxxxxxxxxxxxxxxxx>
- Date: Thu, 2 May 2013 10:04:38 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denbridgemarine.com; s=google; h=mime-version:x-received:x-originating-ip:date:message-id:subject :from:to:content-type; bh=zr9yu1To+Mc2j5HqjNB+zvpIBNoRCSkKUIRdfv9/I+E=; b=DBgWl2voxNoGBrr3WL0lqO3geS6f1i0+2xpfjganR9kO2Kvo7vEb5pwaniy0gqUMuG ls2BDqQdJUYVa7B4u7rZm5VVChqok792dIQrdqcBr88b7tzEOOqeVnVIn+LeoFIMGBGi MX+5Tj1Z2UEOgPX2VrpwvGRZrnsUXhSBY4YZc=
- Envelope-to: StrongED@xxxxxxxxxxxxxx
- List-id: RISC OS StrongED mailing list
- Reply-to: StrongED@xxxxxxxxxxxxxx
I noticed that the default C ModeFile doesn't fold functions
perfectly. For example it doesn't match a function that returns
"unsigned long long int".
So here's a replacement that I believe works better. This should also
improve the "list of functions" (Shift-F2).
I'm not sure what FoldParm1 does but that's the line from the default ModeFile:
FoldParm1 ("/*{{{", "/*}}}", StartSpace, Case)
FoldParm2 (Function, "}", StartOfLine, Case)
In the Search section I've altered the Function pattern:
function_ ("extern" | "volatile" | "static" | "signed" | "unsigned" |
"long") {" "}
Function < {function_} ~"else" ~"return" {AD|"_"}+ {' *'}+ {AD|"_"}+
{" "} "(" * ")" {\s} "{"
Hope this is useful.
--
Richard Griffin
Software Engineer, Denbridge Marine Ltd
--
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxxxxx