allow embedded comments

This commit is contained in:
David Rose 2004-11-16 18:40:03 +00:00
parent 5e60444a12
commit 6698db48d9
2 changed files with 14 additions and 5 deletions

View File

@ -401,9 +401,16 @@ read_prc_line(const string &line) {
}
size_t value_begin = p;
// The value extends from here to the end of the line, so trim
// whitespace backwards off from the end of the line.
p = line.length();
// Is there an embedded comment on this line?
p = line.find(" #", value_begin);
if (p == string::npos) {
// No, the value extends all the way to the end of the line.
p = line.length();
}
// The value extends from here to the end of the line (or to the
// start of the embedded comment), so trim whitespace backwards off
// from there.
while (p > value_begin && isspace((unsigned char)line[p - 1])) {
p--;
}

View File

@ -44,8 +44,10 @@ This specifies that the variable "load-display" should have the value
"pandagl".
Comments may also appear in the file; they are introduced by a leading
hash mark (#). A comment must be on a line by itself; you may not
place a comment on the same line with a variable definition.
hash mark (#). A comment may be on a line by itself, or it may be on
the same line following a variable definition; if it is on the same
line as a variable definition, the hash mark must be preceded by at
least one space to separate it from the definition.
The legal values that you may specify for any particular variable