New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix grammar around function declaration #660
Conversation
FuncDeclarator is a dup of Declarator, and FuncDeclaratorSuffix is a dup of DeclaratorSuffix And we need to keep function type aliasing with the old style syntax.
Remove FuncDeclaratorSuffixes to disallow zero, two or more parameter lists And disallow mixing C-style suffix in function declaration, as follows: void foo[](int a);
…ations Move FuncDeclaration and related non terminal symbols into function.dd Conflicts: declaration.dd grammar.dd
@Hackerpilot Could you review this change? |
|
||
$(GNAME DefaultInitializerExpression): | ||
$(ASSIGNEXPRESSION) | ||
$(GLINK2 traits, SpecialKeyword) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SpecialKeyword is already present in the PrimaryExpression rule. I think we can remove this and let the AssignExpression rule handle special keywords.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, seems correct. I'll file the issue in bugizlla, then open a new PR to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change looks good (ignoring the DefaultInitializerExpression issue). |
@Hackerpilot Thanks for your review. |
I'll merge this PR so this is just a cleanup. |
Fix grammar around function declaration
Issue 10235 - Grammar does not contain a rule for function declarations
Issue 12579 - DMD rejects valid function literal
Issue 13523 - Auto function declaration does not match any grammar rule
And I moved function-related grammars,
Parameters
,FunctionAttribute
,MemberFunctionAttribute
, etc into thefunction.html
page.