From 82c3be687753ac2234809da7c77109649437ba69 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Wed, 9 Jan 2019 11:02:15 -0700 Subject: [PATCH] [C] Allow declaring a struct pointer in a struct Fixes #1830 Signed-off-by: Raul E Rangel --- C++/C.sublime-syntax | 2 +- C++/syntax_test_c.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/C++/C.sublime-syntax b/C++/C.sublime-syntax index 0f5385f48be..ee2a0b641c3 100644 --- a/C++/C.sublime-syntax +++ b/C++/C.sublime-syntax @@ -451,7 +451,7 @@ contexts: data-structures: # Detect variable type definitions using struct/enum/union followed by a tag - - match: '\b({{before_tag}})(?=\s+{{identifier}}\s+{{identifier}}\s*[=;\[])' + - match: '\b({{before_tag}})(?=\s+{{identifier}}\s+\**{{identifier}}\s*[=;\[])' scope: storage.type.c - match: '\bstruct\b' scope: storage.type.c diff --git a/C++/syntax_test_c.c b/C++/syntax_test_c.c index 838d21b7cb3..0049b8ab4e8 100644 --- a/C++/syntax_test_c.c +++ b/C++/syntax_test_c.c @@ -313,6 +313,10 @@ struct foo MACRO { /* ^ - entity.name */ } +struct UI_BoundingBox *position_p; +/* ^ - entity.name */ +/* ^ - entity.name */ + // Partially-typed struct foo /* ^ entity.name */ @@ -324,6 +328,9 @@ struct UI_MenuBoxData struct UI_BoundingBox position; /* ^ - entity.name */ /* ^ - entity.name */ + struct UI_BoundingBox *position_p; +/* ^ - entity.name */ +/* ^ - entity.name */ enum UI_BoxCharType borderType; /* ^ - entity.name */ /* ^ - entity.name */