public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Alan McKinnon <alan.mckinnon@gmail.com>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] comments on portage.keywords
Date: Wed, 16 Sep 2009 09:34:05 +0200	[thread overview]
Message-ID: <200909160934.05774.alan.mckinnon@gmail.com> (raw)
In-Reply-To: <92ad22480909151914h47ade5e2kf6cda49425b150bd@mail.gmail.com>

On Wednesday 16 September 2009 04:14:59 Crístian Viana wrote:
> but in that case the "#" character is inside a string, so it wuldn't be
> considered a comment. I was thinking like "//" in Java: it can be anywhere
> in the line, but if it's inside a string it's not considered a comment
> marker.
> 
> but thanks again for the information :)

To deal with a hash anywhere, you need a complex language parser and probably 
a full blown tokenizer like compilers have to implement.

This is decidedly non-trivial.

Java is a freeform language, the location of line breaks does not really 
matter. Config files are very different beasts, they are very much line 
oriented - one setting per line. Think like grep, it deals with a line at a 
time.

So the easiest implementation by far is the comment marker must be the first 
non-whitespace character, other wise it isn't a comment. That one step can 
make most of your config file bugs never happen, just like that.

-- 
alan dot mckinnon at gmail dot com



      reply	other threads:[~2009-09-16  7:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-15 19:55 [gentoo-user] comments on portage.keywords Crístian Viana
2009-09-15 20:12 ` Neil Walker
2009-09-15 20:17   ` Crístian Viana
2009-09-15 20:49     ` Neil Bothwick
2009-09-16  2:14       ` Crístian Viana
2009-09-16  7:34         ` Alan McKinnon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200909160934.05774.alan.mckinnon@gmail.com \
    --to=alan.mckinnon@gmail.com \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox