Re: [dev] semicolons

From: pancake <pancake_AT_youterm.com>
Date: Fri, 18 Nov 2011 14:24:28 +0100

On 11/18/11 14:03, Patrick Haller wrote:
> On 2011-11-18 11:40, pancake wrote:
>> $ cat dwm.c | sed -e 's,;,ROFL\n,g' |grep ROFL |wc -l
> use cpp to deal with the includes, defines, comments.
>
> __sloc()
> {
> grep -v '^#include.*<' "$1" | cpp - | grep -v '^#' | grep -v '^$'
> }
>
> sloc()
> {
> __sloc "$1" | wc -l
> __sloc "$1" | sed -e 's,;,ROFL\n,g' |grep ROFL |wc -l
> __sloc "$1" | sed -e 's,(,ROFL\n,g' |grep ROFL |wc -l
> }
>
> worrying about stuff like the next seems tree/forest-y
>
> if (error)
> return printf("boot->head => missed?"), -1;
you can use gcc -E or cpp output to parse
> btw, anyone recommend a suckless AST tool for C?
>
>
> Patrick
>
i wrote ALT a while ago. its not C specific, but can be used for basic
c-like syntaxes.
a part from that, parsing C sucks a lot, and the only solution i could
imagine is
by using tcc or sparse, but both solutions sucks in some way or other.

--pancake
Received on Fri Nov 18 2011 - 14:24:28 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 18 2011 - 14:24:04 CET