Open cgmb opened 11 years ago
It seems that C gives you a surprising amount of flexibility in placing comments.
e.g.
/* comment */ # /* comment */ include /* comment */ <stdio.h> // comment
It can be even worse...
/*
comment */ # /* comment */ include /* comment */ <stdio.h> /* comment
*/
In the smart parser, I've been stripping comments from the beginning and ends of the lines, because they're usually irrelevant once the code is changed. Unfortunately, it's a little unclear what to do when they span multiple lines. I suspect I should leave them alone. Multi-line comments are probably less likely to be specific to the line I'm removing than single-line comments are.
I've never actually seen this sort of code, but I could imagine it:
/* Copyright <Year> <Author>
<License>
*/ #pragma once
I should probably mention that the 'smart parser' was dropped in 3af39a7107029265d2ab2887f47823af41f3c15d. Not sure if or when I'll work on it again. It would certainly handle a few more weird cases, like the horror above, but I would basically only find out if it was worth the (significant) effort after the fact.
When searching through files, anything within comment blocks should be ignored as irrelevant.