Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] comments on portage.keywords
Date: Wed, 16 Sep 2009 07:35:46
Message-Id: 200909160934.05774.alan.mckinnon@gmail.com
In Reply to: Re: [gentoo-user] comments on portage.keywords by "Crístian Viana"
1 On Wednesday 16 September 2009 04:14:59 Crístian Viana wrote:
2 > but in that case the "#" character is inside a string, so it wuldn't be
3 > considered a comment. I was thinking like "//" in Java: it can be anywhere
4 > in the line, but if it's inside a string it's not considered a comment
5 > marker.
6 >
7 > but thanks again for the information :)
8
9 To deal with a hash anywhere, you need a complex language parser and probably
10 a full blown tokenizer like compilers have to implement.
11
12 This is decidedly non-trivial.
13
14 Java is a freeform language, the location of line breaks does not really
15 matter. Config files are very different beasts, they are very much line
16 oriented - one setting per line. Think like grep, it deals with a line at a
17 time.
18
19 So the easiest implementation by far is the comment marker must be the first
20 non-whitespace character, other wise it isn't a comment. That one step can
21 make most of your config file bugs never happen, just like that.
22
23 --
24 alan dot mckinnon at gmail dot com