diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-11-14 03:26:33 -0500 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-11-21 20:43:41 -0500 |
| commit | 1aa978f32e88b4c83fde95f62938c97c7c22164c (patch) | |
| tree | 75f26a3f9cd18bd980b6fc1c5cab8a4f7f10e2d8 /src/parser.cpp | |
| parent | e3404e3c78307092e849dc0609f77932b263e3fc (diff) | |
| download | zig-1aa978f32e88b4c83fde95f62938c97c7c22164c.tar.gz zig-1aa978f32e88b4c83fde95f62938c97c7c22164c.zip | |
implement null terminated pointers
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index e87c83a276..3da0d8a643 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -2618,6 +2618,11 @@ static AstNode *ast_parse_prefix_type_op(ParseContext *pc) { if (array != nullptr) { assert(array->type == NodeTypeArrayType); while (true) { + if (eat_token_if(pc, TokenIdKeywordNull) != nullptr) { + array->data.array_type.is_null_terminated = true; + continue; + } + Token *allowzero_token = eat_token_if(pc, TokenIdKeywordAllowZero); if (allowzero_token != nullptr) { array->data.array_type.allow_zero_token = allowzero_token; @@ -2653,6 +2658,11 @@ static AstNode *ast_parse_prefix_type_op(ParseContext *pc) { if (child == nullptr) child = ptr; while (true) { + if (eat_token_if(pc, TokenIdKeywordNull) != nullptr) { + child->data.pointer_type.is_null_terminated = true; + continue; + } + Token *allowzero_token = eat_token_if(pc, TokenIdKeywordAllowZero); if (allowzero_token != nullptr) { child->data.pointer_type.allow_zero_token = allowzero_token; |
