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; size_t value_begin = p;
// The value extends from here to the end of the line, so trim // Is there an embedded comment on this line?
// whitespace backwards off from the end of the 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(); 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])) { while (p > value_begin && isspace((unsigned char)line[p - 1])) {
p--; p--;
} }

View File

@ -44,8 +44,10 @@ This specifies that the variable "load-display" should have the value
"pandagl". "pandagl".
Comments may also appear in the file; they are introduced by a leading 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 hash mark (#). A comment may be on a line by itself, or it may be on
place a comment on the same line with a variable definition. 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 The legal values that you may specify for any particular variable