Emacs-D-Mode-Maintainers / Emacs-D-Mode

An Emacs mode for D code.
GNU General Public License v3.0
84 stars 22 forks source link

Inconsistent `enum` highlighting (type name and members) #113

Closed Geod24 closed 3 years ago

Geod24 commented 3 years ago

GNU Emacs 27.2 D mode: 20210119.1853

enum AddressType
{
    string cname;
    uint ipv4;
    ulong[2] ipv6;
}
Screen Shot 2021-09-23 at 15 35 30

Issues:

-enum AddressType
+private enum AddressType
Screen Shot 2021-09-23 at 15 35 45

As can be seen, adding a visibility qualifier fixes the second issue. Related: #104

CyberShadow commented 3 years ago

What is this syntax? Is it like a struct?

CyberShadow commented 3 years ago

DMD master says:

test.d(3): Error: `string` is not a valid attribute for enum members
test.d(3): Error: `cname` is not a valid attribute for enum members
test.d(3): Error: `;` is not a valid attribute for enum members
test.d(4): Error: `uint` is not a valid attribute for enum members
test.d(4): Error: `ipv4` is not a valid attribute for enum members
test.d(4): Error: `;` is not a valid attribute for enum members
test.d(5): Error: `ulong` is not a valid attribute for enum members
test.d(5): Error: `[` is not a valid attribute for enum members
test.d(5): Error: `2` is not a valid attribute for enum members
test.d(5): Error: `]` is not a valid attribute for enum members
test.d(5): Error: `ipv6` is not a valid attribute for enum members
test.d(5): Error: `;` is not a valid attribute for enum members

I don't know what language this is, but it doesn't seem to be D, so I think supporting this syntax is out-of-scope for this package. :)

Geod24 commented 3 years ago

🤦

Yes, I just realized I mistakenly substituted union for enum. Sorry for the noise!