Skip to content

Commit

Permalink
[C] Allow declaring a struct pointer in a struct
Browse files Browse the repository at this point in the history
Fixes sublimehq#1830

Signed-off-by: Raul E Rangel <[email protected]>
  • Loading branch information
Raul E Rangel committed Jan 9, 2019
1 parent 2c2772b commit 82c3be6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion C++/C.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions C++/syntax_test_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ struct foo MACRO {
/* ^ - entity.name */
}

struct UI_BoundingBox *position_p;
/* ^ - entity.name */
/* ^ - entity.name */

// Partially-typed
struct foo
/* ^ entity.name */
Expand All @@ -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 */
Expand Down

0 comments on commit 82c3be6

Please sign in to comment.