[SAoC2022] Replace libdparse with dmd-as-a-library in D-Scanner
Lucian Danescu
lucidanescu28 at yahoo.com
Fri Dec 23 21:25:42 UTC 2022
Hello!
Since my last update I implemented the following checks using
`dmd-as-a-library`:
-
[redundant_storage_class](https://github.com/Dlang-UPB/D-scanner/pull/60)
-
[redundant_parens](https://github.com/Dlang-UPB/D-scanner/pull/61)
- [useless_asert](https://github.com/Dlang-UPB/D-scanner/pull/63)
-
[style_guidelines](https://github.com/Dlang-UPB/D-scanner/pull/64)
I also experimented with a "custom lexer" implementation, that's
the actual `dmd` lexer
but with the posibility to store all the tokens the lexer would
produce. I think this could
be interesting for other projects as well and you can check out
my implementation
[here](https://github.com/Dlang-UPB/D-scanner/pull/62)
I also create this [pr](https://github.com/dlang/dmd/pull/14720)
in `dmd` fixing a `Location` issue for `StorageClassDeclaration`.
Now as a small drawback I ran into the following situation: The
`dmd` parser is actually a template that can use different AST
families,
namely `ASTCodegen` or `ASTBase`. Well there are situations where
a class from `ASTCodegen` has it's constructor modified. That
would imply
that the coresponding class from `ASTBase` should implement the
same constructor, but since `ASTBase` isn't really used anywhere
in `dmd`
this aspect is pretty easy to miss. This was a bit tricky to me
because I was not able to run the `dub` tests (because for `dub`
we are
currently using the `master` `dmd` version, not a numbered one)
and I was also confused by the fact that the `makefile` would
work normally
(because in that case we use a specific `dmd` version).
I got that sorted out but still I need to add the modifications
from `ASTCodegen` in `ASTBase` as soon as possible, and that will
be my focus
going forward, as this is a blocker because at the moment all
integration tests using `dub` would fail.
Thank you and happy holidays everybody!
More information about the Digitalmars-d
mailing list