Skip to content

Commit

Permalink
[C] Add support for nullptr keyword
Browse files Browse the repository at this point in the history
It was added in C23 and is effectively an alias for the NULL macro
already in use, so it is just treated as an alias for the existing
null constant.
  • Loading branch information
James Buren committed Oct 27, 2024
1 parent 8414d15 commit a3baef4
Show file tree
Hide file tree
Showing 2 changed files with 7 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 @@ -215,7 +215,7 @@ contexts:
scope: constant.language.boolean.false.c
- match: \b(true|TRUE)\b
scope: constant.language.boolean.true.c
- match: \bNULL\b
- match: \b(nullptr|NULL)\b
scope: constant.language.null.c
- match: \b__func__\b
scope: constant.language.c
Expand Down
6 changes: 6 additions & 0 deletions C++/syntax_test_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,12 @@ bool still_C_code_here = true;
/* <- storage.type */
/* ^ constant.language */

void *null_pointer1 = NULL;
/* ^ constant.language.null */

void *null_pointer2 = nullptr;
/* ^ constant.language.null */

FOOBAR
hello() {
/* <- meta.function entity.name.function */
Expand Down

0 comments on commit a3baef4

Please sign in to comment.