on master help sign in
Bump assets/syntaxes/02_Extra/Zig from `87ecbca` to `1a4a384` (#2136)

* Bump assets/syntaxes/02_Extra/Zig from `87ecbca` to `1a4a384` Bumps [assets/syntaxes/02_Extra/Zig](https://github.com/ziglang/sublime-zig-language) from `87ecbca` to `1a4a384`. - [Release notes](https://github.com/ziglang/sublime-zig-language/releases) - [Commits](https://github.com/ziglang/sublime-zig-language/compare/87ecbcae6fb5718369ce3bb3472ca0b2634e78e6...1a4a38445fec495817625bafbeb01e79c44abcba) --- updated-dependencies: - dependency-name: assets/syntaxes/02_Extra/Zig dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Update tests/syntax-tests/highlighted/Zig/example.zig and CHANGELOG.md Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Martin Nordholts <enselic@gmail.com>

commitef3e398b2b76d8e6103cbd96aa715740c7809d10 authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> dateThu 5 May 2022, 20:29 (5 years ago) parent52bab63
3 files changed+41−40
CHANGELOG.md+1 assets/syntaxes/02_Extra/Zig+1−1 tests/syntax-tests/highlighted/Zig/example.zig+39−39
CHANGELOG.md+1
@@ -21,6 +21,7 @@
2121- log syntax: improved handling of escape characters in double quoted strings. See #2123 (@keith-hall)
2222- Associate `/var/spool/mail/*` and `/var/mail/*` with the `Email` syntax. See #2156 (@cyqsimon)
2323- Added cmd-help syntax to scope --help messages. See #2148 (@victor-gp)
24+- Slightly adjust Zig syntax. See #2136 (@Enselic)
2425
2526## Themes
2627
assets/syntaxes/02_Extra/Zig+1−1

Submodule changed.

tests/syntax-tests/highlighted/Zig/example.zig+39−39
@@ -1,18 +1,18 @@
11//! this is a top level doc, starts with "//!"
22
3−const std = @import("std");
3+const std = @import("std");
44
55pub fn main() anyerror!void {
6− const stdout = std.io.getStdOut().writer();
7− try stdout.print("Hello, {}!\n", .{"world"});
6+ const stdout = std.io.getStdOut().writer();
7+ try stdout.print("Hello, {}!\n", .{"world"});
88}
99
10−const expect = std.testing.expect;
10+const expect = std.testing.expect;
1111
1212test "comments" {
1313 // comments start with "//" until newline
1414 // foo bar baz
15− const x = true; // another comment
15+ const x = true; // another comment
1616 expect(x);
1717}
1818
@@ -25,26 +25,26 @@
2525 /// number of nanoseconds past the second
2626 nano: u32,
2727
28− const Self = @This();
28+ const Self = @This();
2929
3030 pub fn unixEpoch() Self {
3131 return Self{
32− .seconds = 0,
33− .nanos = 0,
32+ .seconds = 0,
33+ .nanos = 0,
3434 };
3535 }
3636};
3737
38−const my_val = switch (std.Target.current.os.tag) {
39− .linux => "Linux",
38+const my_val = switch (std.Target.current.os.tag) {
39+ .linux => "Linux",
4040 else => "not Linux",
4141};
4242
4343const Book = enum {
44− paperback,
45− hardcover,
46− ebook,
47− pdf,
44+ paperback,
45+ hardcover,
46+ ebook,
47+ pdf,
4848};
4949
5050const TokenType = union(enum) {
@@ -54,54 +54,54 @@
5454};
5555
5656const array_lit: [4]u8 = .{ 11, 22, 33, 44 };
57−const sentinal_lit = [_:0]u8{ 1, 2, 3, 4 };
57+const sentinal_lit = [_:0]u8{ 1, 2, 3, 4 };
5858
5959test "address of syntax" {
6060 // Get the address of a variable:
6161 const x: i32 = 1234;
62− const x_ptr = &x;
62+ const x_ptr = &x;
6363
6464 // Dereference a pointer:
6565 expect(x_ptr.* == 1234);
6666
6767 // When you get the address of a const variable, you get a const pointer to a single item.
68− expect(@TypeOf(x_ptr) == *const i32);
68+ expect(@TypeOf(x_ptr) == *const i32);
6969
7070 // If you want to mutate the value, you'd need an address of a mutable variable:
7171 var y: i32 = 5678;
72− const y_ptr = &y;
73− expect(@TypeOf(y_ptr) == *i32);
74− y_ptr.* += 1;
72+ const y_ptr = &y;
73+ expect(@TypeOf(y_ptr) == *i32);
74+ y_ptr.* += 1;
7575 expect(y_ptr.* == 5679);
7676}
7777
7878// integer literals
79−const decimal_int = 98222;
80−const hex_int = 0xff;
81−const another_hex_int = 0xFF;
82−const octal_int = 0o755;
83−const binary_int = 0b11110000;
79+const decimal_int = 98222;
80+const hex_int = 0xff;
81+const another_hex_int = 0xFF;
82+const octal_int = 0o755;
83+const binary_int = 0b11110000;
8484
8585// underscores may be placed between two digits as a visual separator
86−const one_billion = 1_000_000_000;
87−const binary_mask = 0b1_1111_1111;
88−const permissions = 0o7_5_5;
89−const big_address = 0xFF80_0000_0000_0000;
86+const one_billion = 1_000_000_000;
87+const binary_mask = 0b1_1111_1111;
88+const permissions = 0o7_5_5;
89+const big_address = 0xFF80_0000_0000_0000;
9090
9191// float literals
92−const floating_point = 123.0E+77;
93−const another_float = 123.0;
94−const yet_another = 123.0e+77;
92+const floating_point = 123.0E+77;
93+const another_float = 123.0;
94+const yet_another = 123.0e+77;
9595
96−const hex_floating_point = 0x103.70p-5;
97−const another_hex_float = 0x103.70;
98−const yet_another_hex_float = 0x103.70P-5;
96+const hex_floating_point = 0x103.70p-5;
97+const another_hex_float = 0x103.70;
98+const yet_another_hex_float = 0x103.70P-5;
9999
100100// underscores may be placed between two digits as a visual separator
101−const lightspeed = 299_792_458.000_000;
102−const nanosecond = 0.000_000_001;
103−const more_hex = 0x1234_5678.9ABC_CDEFp-10;
101+const lightspeed = 299_792_458.000_000;
102+const nanosecond = 0.000_000_001;
103+const more_hex = 0x1234_5678.9ABC_CDEFp-10;
104104
105105fn max(comptime T: type, a: T, b: T) T {
106− return if (a > b) a else b;
106+ return if (a > b) a else b;
107107}