Better SDLang
Guillaume Piolat
first.name at gmail.com
Mon Jul 22 23:06:52 UTC 2024
On Monday, 22 July 2024 at 17:25:37 UTC, solidstate1991 wrote:
>
> I'm currently in the process of doing some research on what
> kind of gripe people have with the current SDLang
> implementation, both API and and textual representation level.
> Then I'll design a class structure for the parsers (Yes, I'll
> also create a more SAX-like parser too in conjunction of the
> DOM parser).
I had such gripes today.
- basically sdlang-d comes with dependencies, that then create
warnings. Well I never chose to use sdlang in the first place, so
it's annoying to get unrelated warnings on top of that :)
- GitHub README has no parsing example to copy/paste
- the code looks a bit less good on screen than eg. parsing
JSON with std.json
```d
result.name = dubFile["name"].str;
foreach(e; dubFile["versions"].array)
{
if (e.str == "flobber")
result.flobber = true;
}
```
vs
```d
result.name = sdlFile.getTagValue!string("name");
foreach(e; sdlFile.getTag("versions").values)
{
if (e.get!string() == "flobber")
result.flobber = true;
}
```
but I've not tried the 5(!) alternatives already on DUB.
More information about the Digitalmars-d
mailing list