summaryrefslogtreecommitdiff
path: root/posts/need-parser.mdwn
blob: f8fddfcdbbc696e0af3e415012724fa05c787cd3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[[!meta title="Dear lazyweb…"]]
[[!meta author="Daniel Silverstone"]]
[[!meta date="2008-01-22 12:37:19 +0000"]]
[[!tag tech]]

I am in need of a C parser which I can use to detect violations of a
coding standard. Particularly it must be able to be sensitive to
comments (the internals of which are important also) and whitespace,
over and above the usual need to be sensible about the rest of the
language.

In order to be ideal, it should not need the C to be preprocessed first.
I am not after a syntax checker, after all - the compiler does that for
me. I want to be able to detect things like `struct{` where `struct {`
is what we mandate in our coding style. However I also want to detect
more complex things such as static functions which lack documentation
comments, or functions which are not declared as
`returntype<strong>newline</strong>functionname(arglist)<strong>newline</strong>{`.

I hope someone has a cunning idea&hellip;

D.