Skip to content

Commit

Permalink
[C] Add support for nullptr keyword (#4068)
Browse files Browse the repository at this point in the history
This commit adds C23 `nullptr` constant, an alias for the `NULL` macro.
  • Loading branch information
braewoods authored Oct 28, 2024
1 parent 1d79828 commit ddfeab9
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 ddfeab9

Please sign in to comment.