Proposal [B] for Re: INN config file parsing infrastructure
Todd Olson
tco2 at cornell.edu
Fri May 5 16:21:42 UTC 2000
Hi Russ
So I recently sent notes questioning the proposed line continuation spec
for handling inn config files. Here is an alternate alternate proposal.
This is offered for completeness. I suspect this is distasteful
and we don't want to go here.
Basically it the proposal is be mostly perl-like requiring ';'
and ignoring <newline>.
1) There are statements and blocks-structures
2) *All* statements require a terminating token ... say ';'
3) block structures look like "token token ... { ... }"
they don't require terminating ';'
4) <newline>s are *not* significant ... they are just other whitespace.
5) in "parameter: value" statements the value *can* have embedded
white space (including <newline>s) without being quoted. In this
case the white space is insignificant except as a token separator.
6) values can be in quotes, in which case white space is taken literally
*except* for "<newline><whitespaces>" which are elided.
7) To put a newline into a quoted value use a '\n'
This would permit readability just as proposal [A] did ... just different.
EXAMPLES:
#1] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=
parameter: host1 at very.long.domain.name1,host2 at very.long.domain.name2,host3 at very.long.domain.name3;
parameter:
host1 at very.long.domain.name1
host2 at very.long.domain.name2
host3 at very.long.domain.name3
;
These mean the same thing.
The first is hard to read.
The second *much* more readable.
#2] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=
wildmat: @to.*, at contro*, at clari.*, at uo.*,@*warez*,@*cd.image*,@*mp3*
,@*bootleg*,@*crack*,@*hack*,@*2600*,@*phreak*,@*password*
,@*job*,@*test*,@*mlm*
,@*multilevel*,@*nospam*,@*anon*, at mail*, at private.*,@*lists.*
,@*bonehead*;
#3] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=
parameter: "x-comment: A long line.... ...... ......... .... .....formated gracefully";
parameter: "x-comment: A long line.... ...... .....
.... .... .....formated gracefully";
Both set the paramater to
"x-comment: A long line.... ...... ......... .... .....formated gracefully"
but the second definately leads to a cleaner config file.
Especially with the grouping structure and the tendency for people
to use indentation with the grouping.
#4] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=
parameter: "x-comment: Three lines\n with leading\n tabs";
parameter: "x-comment: Three lines
\n with leading
\n tabs
";
This shows how to encode leading white space gracefully
#5] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=
parameter: "x-comment: Three lines
with leading
tabs";
parameter: "x-comment: Three lineswith leadingtabs";
This is the most confusion I see with this proposal.
#6] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=
Russ said
>Syntax error. Actually, if you write:
>
> parameter1:
> parameter2:
>
>you'll actually set parameter1 to the value "parameter2:", so inncheck
>should check for this. (Or we could require that the value start on the
>same line as the parameter, but I'm not sure that's necessary.)
To be correct in proposal [B] this would have to be
parameter1: ;
parameter2: ;
#7] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=
Finally the example Russ gives work pretty nice in this scheme also
group blah { parameter: value; parameter2: value2 }
group
blah
{ parameter:
value;
parameter2: value2;
}
Regards,
Todd Olson
Cornell Unversity
More information about the inn-workers
mailing list