[swift-evolution] [Idea] [Pitch] Distinguishing code comments from text comments
Dmitri Gribenko
gribozavr at gmail.com
Fri Feb 26 11:52:36 CST 2016
On Fri, Feb 26, 2016 at 9:35 AM, Douglas McKenna via swift-evolution
<swift-evolution at swift.org> wrote:
> Suppose an analysis program that takes source code as mere text input
That is the root of the issue. You shouldn't be parsing source code
with ad-hoc tools. You need to use a real compiler. Just because it
happened to work with, say C, does not mean that you got it right. I
doubt that a program that you described was correctly handling, say,
line continuations in comments.
The bottom line is, you need to use a real compiler frontend to parse
source code.
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the swift-evolution
mailing list