SDLang-D v0.8.2 - SDL lib for D (like JSON/XML, but nicer)
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Wed Mar 13 02:54:09 PDT 2013
On Wed, 13 Mar 2013 06:35:45 +0100
"Kagamin" <spam at here.lot> wrote:
>
> As I understand, SDL doesn't support allman style of curly braces?
Correct. This is because tags in SDL are newline-terminated.
(It would be possible to allow it as a special-case, but I want to stay
compatible SDL's official spec and reference implementation, which
doesn't do that.)
You can, however, simulate it with the line-continuation operator:
mytag \
{
subtag
subtag
}
But unlike JavaScript (or early versions of Go, IIRC), if you
do use allman-style by mistake, you're guaranteed to get an error
instead of incorrect behavior:
mytag
{
subtag
subtag
}
SDLangException:
file.sdl(2:1): Error: Anonymous tags must have at least one value.
Come to think of it, I could probably customize the error message for
that particular situation to say something more appropriate like
"Opening curly braces cannot be on a separate new line".
More information about the Digitalmars-d-announce
mailing list