dub: should we make it the de jure package manager for D?
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Wed Sep 11 13:57:13 PDT 2013
On Wed, 11 Sep 2013 11:04:37 -0700
"H. S. Teoh" <hsteoh at quickfur.ath.cx> wrote:
>
> As for long values, I've always disliked the fact that almost all
> formats provide a way to wrap them across multiple lines, but almost
> none of them let you indent the result nicely without also changing
> the value. This is important for complex configuration formats that
> have nested groups of settings. In my format, the syntax is
> specifically catered for this use case, for example:
>
> # This is a comment
> value1 = "This is a very long value \
> \split across multiple \
> \lines."
> value2 = "A short value"
>
> module1 {
> # These values are in a nested scope, so they are
> # distinct from the settings above.
> value1 = "This is another long \
> \value split across \
> \multiple lines."
> value2 = "This is a value \
> \with an embedded \ # a long value
> \comment!"
> }
>
SDL supports that sort of thing (except for the embedded comment,
which I agree would be kinda nice):
http://sdl.ikayzo.org/display/SDL/Language+Guide
See section "String Literals"
Your example would look like this :
# This is a comment
value1 "This is a very long value \
split across multiple \
lines."
value2 "A short value"
module1 {
# These values are in a nested scope, so they are
# distinct from the settings above.
value1 "This is another long \
value split across \
multiple lines."
}
If you want the indentation *kept*, then use backquote strings (and
omit the line continuation backslashes).
The embedded comments could be easily added, but that would take it
into "non-standard behavior" territory. (I actually had to
deliberately disallow it just to match the behavior of the reference
implementation).
More information about the Digitalmars-d
mailing list