8000 Fix highlight on unnamed class, struct and enum by rhysd · Pull Request #22 · vim-jp/vim-cpp · GitHub
[go: up one dir, main page]

Skip to content

Fix highlight on unnamed class, struct and enum #22

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

Merged
merged 1 commit into from
May 16, 2014
Merged

Fix highlight on unnamed class, struct and enum #22

merged 1 commit into from
May 16, 2014

Conversation

rhysd
Copy link
Contributor
@rhysd rhysd commented May 16, 2014

C++ では,特定のクラスから継承して匿名クラスを定義することができます.また,enum に underlying type を指定することができます.
これらの構文がラベルの構文に似ており,シンタックスハイライトはラベル部分のみのマッチで行われてしまうので誤ってラベルとしてハイライトされてしまっていました.

struct base{};

int main()
{
    //
    // Below 'enum', 'struct' and 'class' are highlighted as label
    //

    // Specify int as enum's underlying
    enum : int {} aaa;

    // unnamed derived struct
    struct : base {} bbb;

    // unnamed derived class
    class : base {} ccc;

    return 0;
}

解決策として,ラベルが struct, class, enum でないかをチェックするようにしました.

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.
@osyo-manga
Copy link

++

@mattn
Copy link
Member
mattn commented May 16, 2014

LGTM

mattn added a commit that referenced this pull request May 16, 2014
Fix highlight on unnamed class, struct and enum
@mattn mattn merged commit ed3fc2c into vim-jp:master May 16, 2014
@mattn
Copy link
Member
mattn commented May 16, 2014

Thank you

@rhysd
Copy link
Contributor Author
rhysd commented May 16, 2014

🐶 👍

@mattn
Copy link
Member
mattn commented May 18, 2014

先日パッチを送ったばかりで、たて続けに送る姿勢を見せるとBramに嫌がられそうなのでしばらく時間を下さい。
すみません。

@rhysd
Copy link
Contributor Author
rhysd commented Jun 4, 2014

すみません,コメント気づいていませんでした.
パッチを送るタイミングについては @mattn さんにお任せします…!

@mattn
Copy link
Member
mattn commented Jun 4, 2014

🐕 👍

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
0