Packages icon indicating copy to clipboard operation
Packages copied to clipboard

[C] Syntax highlighting around C namespaces is broken

Open wbogocki opened this issue 6 years ago • 4 comments

When return types are on a separate lines:

  • return types become a different colour
  • argument list in the first function is broken but not in the third
  • there is a red mark on the closing brace Screenshot 2019-12-02 at 07 46 01

Without newline it looks OK: Screenshot 2019-12-02 at 07 38 31

Inside a struct it's busted again but only for pointers: Screenshot 2019-12-02 at 07 53 13

These are some of the examples but this is common and all over the place. u64 is coloured because I added it to custom_types in C.sublime-syntax:26 but otherwise the syntax file is standard. Sublime v3.2.2 build 3211

wbogocki avatar Dec 02 '19 00:12 wbogocki

Could you also post minimal reproducible examples in text form (instead of screenshots) please?

rwols avatar Dec 02 '19 00:12 rwols

Here you go:

struct game_object_pool
GameObjectPoolCreate(u64 Size);

void
GameObjectPoolDestroy(struct game_object_pool* Pool);

struct game_object_id
GameObjectPoolAlloc(struct game_object_pool* Pool);
union
{
    struct game_object GameObject;
    struct game_object_bucket* FreeList;
};

wbogocki avatar Dec 02 '19 00:12 wbogocki

For reference:

union
{
    struct x y; // missing struct scope
    struct z* w; // missing pointer scope
};

// declaration of a function called b that takes nothing and returns an a.
struct a
b();

// declaration of a function called d that takes an e and returns a c.
struct c
d(struct e);

rwols avatar Dec 02 '19 00:12 rwols

Note that there is no syntax error when adding * in the following case:

struct game_object_id *
GameObjectPoolAlloc(struct game_object_pool* Pool);

fsaad avatar Apr 02 '20 13:04 fsaad