This repository was archived by the owner on Jan 6, 2026. It is now read-only.
Fix highlight on unnamed class, struct and enum#22
Merged
mattn merged 1 commit intovim-jp:masterfrom May 16, 2014
rhysd:fix/unamed-class-and-enum
Merged
Fix highlight on unnamed class, struct and enum#22mattn merged 1 commit intovim-jp:masterfrom rhysd:fix/unamed-class-and-enum
mattn merged 1 commit intovim-jp:masterfrom
rhysd:fix/unamed-class-and-enum
Conversation
Problem:
In C++, unnamed derived class and struct can be defined using ':'.
enum also can be defined with specific underlying type using ':'.
They are highlighted as labels wrongly.
```
struct base{};
int main()
{
//
// Below 'enum', 'struct' and 'class' are highlighted as label
//
// Specify enum's underlying type
enum : int {} aaa;
// unnamed derived struct
struct : base {} bbb;
// unnamed derived class
class : base {} ccc;
return 0;
}
```
Solution:
Check that labels don't match to them.
|
++ |
Member
|
LGTM |
mattn
added a commit
that referenced
this pull request
May 16, 2014
Fix highlight on unnamed class, struct and enum
Member
|
Thank you |
Contributor
Author
|
🐶 👍 |
8000
Member
|
先日パッチを送ったばかりで、たて続けに送る姿勢を見せるとBramに嫌がられそうなのでしばらく時間を下さい。 |
Contributor
Author
|
すみません,コメント気づいていませんでした. |
Member
|
🐕 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
C++ では,特定のクラスから継承して匿名クラスを定義することができます.また,
enumに underlying type を指定することができます.これらの構文がラベルの構文に似ており,シンタックスハイライトはラベル部分のみのマッチで行われてしまうので誤ってラベルとしてハイライトされてしまっていました.
解決策として,ラベルが
struct,class,enumでないかをチェックするようにしました.