Skip to content

[spec] Add UDAs for parameters#2363

Merged
dlang-bot merged 1 commit intodlang:masterfrom
wilzbach:udas
Jul 20, 2018
Merged

[spec] Add UDAs for parameters#2363
dlang-bot merged 1 commit intodlang:masterfrom
wilzbach:udas

Conversation

@wilzbach
Copy link
Contributor

@wilzbach wilzbach commented May 8, 2018

A first start. I wasn't sure how much into detail of UDAs we should go in the functions page as they are already defined in depth in https://dlang.org/spec/attribute.html

DMD PR: dlang/dmd#7576

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @wilzbach!

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

@jacob-carlborg
Copy link
Contributor

A first start. I wasn't sure how much into detail of UDAs we should go in the functions page as they are already defined in depth in https://dlang.org/spec/attribute.html

I think it's almost a bit too much detail since, as you mentioned, it's already specified elsewhere.

Copy link
Contributor

@jacob-carlborg jacob-carlborg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update to match the DMD PR, that is, mention where it works and where it doesn’t.

@wilzbach wilzbach force-pushed the udas branch 3 times, most recently from bd196fc to 7d92db0 Compare June 30, 2018 14:39
@wilzbach
Copy link
Contributor Author

So I merged InOut and UserDefinedAttribute into ParameterAttributes as const @(2) and @(2) const are both legal (only int @(2) is forbidden as UDAs can only be prefix).
For the lazy who are wondering if this works for AliasDeclarations too:

AliasDeclaration:
    alias StorageClassesopt BasicType Declarators ;
    alias StorageClassesopt BasicType FuncDeclarator ;
    alias AliasDeclarationX ;

AliasDeclarationX:
    AliasDeclarationY
    AliasDeclarationX , AliasDeclarationY

AliasDeclarationY:
   Identifier TemplateParametersopt = FunctionLiteral
FunctionLiteral:
    function Typeopt ParameterAttributes opt FunctionLiteralBody
    delegate Typeopt ParameterMemberAttributes opt FunctionLiteralBody
    ParameterMemberAttributes FunctionLiteralBody
    FunctionLiteralBody
    Lambda
Lambda:
    function Typeopt ParameterAttributes => AssignExpression
    delegate Typeopt ParameterMemberAttributes => AssignExpression
    ParameterMemberAttributes => AssignExpression
    Identifier => AssignExpression
ParameterAttributes:
    Parameters FunctionAttributesopt

ParameterMemberAttributes:
    Parameters MemberFunctionAttributesopt
Parameters:
    ( ParameterListopt )

ParameterList:
    Parameter
    Parameter , ParameterList

@wilzbach wilzbach force-pushed the udas branch 2 times, most recently from 5a4f7d3 to fa4e54d Compare July 1, 2018 23:15
@wilzbach
Copy link
Contributor Author

wilzbach commented Jul 1, 2018

I'm not sure why this fails when building the PDF, but as removing two lines anywhere in the GRAMMAR section makes the error go away I presume it has something to do with this:

Your main error here is using \lstinline in the argument of another command, like most verbatim constructs that does not work. You almost got away with it except in the last case, the page break happens inside a listings block so you end up calling listings recursively inside itself and things go wrong.

https://tex.stackexchange.com/questions/229113/another-extra-or-forgotten-endgroup

However, I tried replacing \lstinline with \texttt or \verb, but without success.
Has anyone more experience with this or an idea how to workaround it?

@wilzbach
Copy link
Contributor Author

Rebased. Should be passing DAutoTest now.

@wilzbach wilzbach closed this Jul 18, 2018
@wilzbach wilzbach deleted the udas branch July 18, 2018 11:18
@PetarKirov
Copy link
Member

Why close?

@wilzbach wilzbach restored the udas branch July 19, 2018 13:42
@wilzbach wilzbach reopened this Jul 19, 2018
@wilzbach
Copy link
Contributor Author

I think something went wrong when I purged my GitHub branches. Thanks for noticing!

@dlang-bot dlang-bot merged commit 3f7e3f5 into dlang:master Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants