Skip to content

Add support for C-style alias declarations#150

Merged
wilzbach merged 1 commit intomasterfrom
add-support-for-cstyle-alias
Jun 29, 2017
Merged

Add support for C-style alias declarations#150
wilzbach merged 1 commit intomasterfrom
add-support-for-cstyle-alias

Conversation

@wilzbach
Copy link
Member

In Phobos std.typecons and std.traits use this alias syntax:

 alias StorageClasses_opt BasicType FuncDeclarator ;
FuncDeclarator:
    BasicType2opt Identifier FuncDeclaratorSuffix

As AFAICT there's no alternative syntax to this, replacing the few uses sadly doesn't work.
Hence, it would be very appreciated if Dscanner (and thus libdparse) could parse these declarations at least to the degree of not throwing a hard error ;-)
I gave this a shot and it looks like it's very hard to support.

References:

@wilzbach wilzbach force-pushed the add-support-for-cstyle-alias branch from a19ff23 to f1f75a0 Compare June 22, 2017 15:09
@wilzbach
Copy link
Member Author

@codecov-io
Copy link

codecov-io commented Jun 22, 2017

Codecov Report

Merging #150 into master will increase coverage by 0.06%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #150      +/-   ##
==========================================
+ Coverage   81.47%   81.53%   +0.06%     
==========================================
  Files           7        7              
  Lines        4528     4534       +6     
==========================================
+ Hits         3689     3697       +8     
+ Misses        839      837       -2
Impacted Files Coverage Δ
src/dparse/ast.d 15.14% <ø> (ø) ⬆️
src/dparse/parser.d 87.56% <83.33%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b009b7...06855ee. Read the comment docs.

/** */ IdentifierList identifierList;
/** */ AliasInitializer[] initializers;
/** */ string comment;
/** */ Parameters parameters;
Copy link

Choose a reason for hiding this comment

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

You forget to visit the parameters

Copy link
Member Author

Choose a reason for hiding this comment

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

My first PR to the parser. Thanks!! (added)

/** */ AliasInitializer[] initializers;
/** */ string comment;
/** */ Parameters parameters;
/** */ MemberFunctionAttribute[] memberFunctionAttributes;
Copy link

Choose a reason for hiding this comment

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

You forget to visit the memberFunctionAttributes

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this is fixed.

@ghost
Copy link

ghost commented Jun 22, 2017

As AFAICT there's no alternative syntax to this

Indeed. I've opend an issue about this https://issues.dlang.org/show_bug.cgi?id=16020 but i think that the only resolution possible is a personal initiative or a DIP. In the absence of the required language change supporting this in libdparse sounds like the right choice.

@wilzbach
Copy link
Member Author

  • Misses 4204 4210 +6

That stroke me as quite odd -> #151

@wilzbach wilzbach force-pushed the add-support-for-cstyle-alias branch from 00738d0 to 06855ee Compare June 22, 2017 15:56
@wilzbach
Copy link
Member Author

That stroke me as quite odd -> #151

Thanks a lot for the quick approval!
(Rebased to get a proper coverage report.)

@wilzbach
Copy link
Member Author

Okay @bbasile - how do we proceed here? Does this need approval from @Hackerpilot or can we move ahead?

@ghost
Copy link

ghost commented Jun 28, 2017

Does this need approval from @Hackerpilot

I've explained why i agree but initially not to parse them was a clearly a choice, so yes.

@Hackerpilot
Copy link
Collaborator

I initially left support for this out as I thought

  1. That the syntax would be deprecated / removed
  2. That the new syntax was sufficient

@wilzbach
Copy link
Member Author

I initially left support for this out as I thought
That the syntax would be deprecated / removed
That the new syntax was sufficient

Hehe, I think we all were/are still confused by this oversight...

So this means this PR is good to go? :)
I would love to get rid of the exclusion of std.traits and std.typecons.d in the Phobos build .

@Hackerpilot
Copy link
Collaborator

Not sure if you noticed, but I clicked the "approve" button in Github.

@wilzbach wilzbach merged commit 69ba83e into master Jun 29, 2017
@wilzbach wilzbach deleted the add-support-for-cstyle-alias branch June 29, 2017 00:02
@wilzbach
Copy link
Member Author

Not sure if you noticed, but I clicked the "approve" button in Github.

I did, but I was just wondering whether there was a reason why you didn't hit merge afterwards ;-)
Thanks a lot!

wilzbach added a commit to wilzbach/phobos that referenced this pull request Jun 29, 2017
Most notably this contains:
- upgraded libdparse with support for deprecated C-style alias
declarations
(-> dlang-community/libdparse#150)
- has_public_example check

Full changelog: dlang-community/D-Scanner@455cc3f...40d7561
wilzbach added a commit to wilzbach/phobos that referenced this pull request Jun 29, 2017
Most notably this contains:
- upgraded libdparse with support for deprecated C-style alias
declarations
(-> dlang-community/libdparse#150)
- has_public_example check

Full changelog: dlang-community/D-Scanner@455cc3f...40d7561
wilzbach added a commit to wilzbach/phobos that referenced this pull request Jun 30, 2017
Most notably this contains:
- upgraded libdparse with support for deprecated C-style alias
declarations
(-> dlang-community/libdparse#150)
- has_public_example check

Full changelog: dlang-community/D-Scanner@455cc3f...40d7561
wilzbach added a commit to wilzbach/phobos that referenced this pull request Jun 30, 2017
Most notably this contains:
- upgraded libdparse with support for deprecated C-style alias
declarations
(-> dlang-community/libdparse#150)
- has_public_example check

Full changelog: dlang-community/D-Scanner@455cc3f...40d7561
wilzbach added a commit to wilzbach/phobos that referenced this pull request Jun 30, 2017
Most notably this contains:
- upgraded libdparse with support for deprecated C-style alias
declarations
(-> dlang-community/libdparse#150)
- has_public_example check

Full changelog: dlang-community/D-Scanner@455cc3f...40d7561
wilzbach added a commit to wilzbach/phobos that referenced this pull request Jul 20, 2017
Most notably this contains:
- upgraded libdparse with support for deprecated C-style alias
declarations
(-> dlang-community/libdparse#150)
- has_public_example check

Full changelog: dlang-community/D-Scanner@455cc3f...40d7561
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants