Update extern(C++) grammar to support string namespaces#2716
Update extern(C++) grammar to support string namespaces#2716Geod24 merged 2 commits intodlang:masterfrom
Conversation
|
Thanks for your pull request and interest in making D better, @rmanthorpe! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla referencesYour PR doesn't reference any Bugzilla issue. If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog. |
spec/attribute.dd
Outdated
| $(GNAME LinkageAttribute): | ||
| $(D extern) $(D $(LPAREN)) $(GLINK LinkageType) $(D $(RPAREN)) | ||
| $(D extern) $(D $(LPAREN)) $(D C++), $(GLINK2 declaration, IdentifierList) $(D $(RPAREN)) | ||
| $(D extern) $(D $(LPAREN)) $(D C++), $(GLINK2 declaration, ArgumentList) $(D $(RPAREN)) |
There was a problem hiding this comment.
I think we may need to introduce a new rule here. The parser looks for a comma-separated list of conditional expressions, while ArgumentList is a comma-separated list of AssignExpression.
There was a problem hiding this comment.
I'm not convinced. As it is it seems to happily parse an AssignExpression. For example extern(C++, (a = "b")) int c(); parses fine, just like the identifier with an assign index works fine: extern(C++, (d[e = f])) int g();
There was a problem hiding this comment.
Yes, extern(C++, (a = "b")) int c(); parses, but extern(C++, a = "b") int c(); does not, which is my point. Putting the assign expression inside the parenthesis makes it match the rule for PrimaryExpression, which causes it to match the rule for ConditionalExpression.
There was a problem hiding this comment.
Ah you're quite right - this is not my forte. In that case, is the identifier list grammar wrong too? extern(C++, d[e = f]) int g(); does not parse.
|
@Hackerpilot does that look better now? |
|
I was going to suggest re-ordering things to make the rule left-recursive, but looking over the grammar I can see that the existing style is that rules are right-recursive. My only suggestion is to remove the redundant |
|
Yes everything is right-recursive so I stuck with the same style. I've removed that redundant expression now. |
|
Bump @Hackerpilot |
|
I don't have the ability to merge this. |
|
I can merge, but we need to figure out why the build fails first. I will force push, in order to restart it (assuming it was simply a transient failure). |
07f575c to
5f95b4d
Compare
5f95b4d to
38462e4
Compare
|
I rebased it just to see if that would help but now it's failing circleci too 🤦♂ I really have no idea why this would be. Any thoughts? |
38462e4 to
a20db92
Compare
Implemented according to the grammar defined in the pending spec PR dlang/dlang.org#2716
Implemented according to the grammar defined in the pending spec PR dlang/dlang.org#2716
Implemented according to the grammar defined in the pending spec PR dlang/dlang.org#2716
Implemented according to the grammar defined in the pending spec PR dlang/dlang.org#2716
|
Rebased, squashed the commit, and (hopefully) fixed.
I'm no DDOC expert but I haven't seen any other place in that page where |
ee9939b to
4e43384
Compare
Implemented according to the grammar defined in the pending spec PR dlang/dlang.org#2716
Implemented according to the grammar defined in the pending spec PR dlang/dlang.org#2716
Implemented according to the grammar defined in the pending spec PR dlang/dlang.org#2716
Implemented according to the grammar defined in the pending spec PR dlang/dlang.org#2716
Implemented according to the grammar defined in the pending spec PR dlang/dlang.org#2716
Thanks I'm totally stumped by this! |
Well, me too. I found two errors, but it's still red. I'm not 100% sure the Now, even with that fixed, it is still red, and I have no clue why. I'm on Mac so I can't build ATM, going to give it another try later. |
8abce37 to
b853298
Compare
|
Yeah, I have absolutely no clue what is wrong. There is so much pre-processing going on that linking the error message with the input is near impossible. I tried a few things, including removing all links, and reducing this until it passes. It did pass when the @CyberShadow : Would it be possible to have artifacts of failing build be published ? I have no clue what was fed to the LaTeX compiler. |
|
Thanks for looking into this.
It does do that if the test phase fails, but this is a build problem, and I think the latex input is a temporary file (not part of the output) so it wouldn't be accessible anyway. The software running the build is based on Digger, so you should be able to reproduce build problems locally by running |
|
Rebased on master, let's see if it is finally green |
Co-authored-by: Florian <moonlightsentinel@disroot.org>
|
Finally! Thanks a lot @rmanthorpe and @MoonlightSentinel . So glad we got rid of that PDF export... |
The grammar is missing the string-style
extern(C++, "a", "b")declaration. TheArgumentListisn't quite right here as it allows a trailing comma but the current implementation in dmd does not. However, this seems more like a bug in dmd since it's inconsistent with the rest of the grammar.