Whitespace, continuation, and quoted strings in conf files

Russ Allbery rra at stanford.edu
Tue Jun 27 03:48:23 UTC 2000


Marco d'Itri <md at linux.it> writes:
> On Jun 26, Russ Allbery <rra at stanford.edu> wrote:

>> The second line would be a syntax error.  You have to instead say:
>> 
>>    newsgroups: "comp.*,rec.*,\
>>                 alt.*,\
>>                 ba.*"

> What about removing newlines and blanks from the content of some fields?
> Such a feature would make easier writing wildmat strings.

Yeah, agreed, any wildmat string matching groups or the like should have
whitespace smashed.  That's not really a property of the parser so much as
a property of the code interpreting the fields.

> What about comments? Sometime I find useful writing something like:

> xxx: "aaa,\	# comment
>       bbb"

That would be a syntax error (runaway quoted string, since the line didn't
end in a continuation character).  Inside quoted strings, comments aren't
recognized.  Having seen the parsing strangeness that Perl has to deal
with by allowing comments inside regexes, I don't think I want to change
that; the better way of addressing this problem would be to support append
like Bill mentioned in his message.  For the first pass, though, I'll
probably just bail on that and require people to put all their comments
before or after the whole parameter setting.

> And how will this text be parsed?

> xxx: "aaa,\
> # comment
>       bbb"

# comment would be part of the quoted string, and it would be a syntax
error again because the second line doesn't close the quote and doesn't
end in a continuation character.

-- 
Russ Allbery (rra at stanford.edu)             <http://www.eyrie.org/~eagle/>



More information about the inn-workers mailing list