summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2022-05-05 20:29:17 +0200
committerGitHub <noreply@github.com>2022-05-05 20:29:17 +0200
commitef3e398b2b76d8e6103cbd96aa715740c7809d10 (patch)
tree40289e9167c40ca7154761c51f911bc0383032ae
parent52bab63e188b3dbd680c5e50054398fe61521a2c (diff)
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>
-rw-r--r--CHANGELOG.md1
m---------assets/syntaxes/02_Extra/Zig0
-rw-r--r--tests/syntax-tests/highlighted/Zig/example.zig78
3 files changed, 40 insertions, 39 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ff790502..286045fa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -21,6 +21,7 @@
- log syntax: improved handling of escape characters in double quoted strings. See #2123 (@keith-hall)
- Associate `/var/spool/mail/*` and `/var/mail/*` with the `Email` syntax. See #2156 (@cyqsimon)
- Added cmd-help syntax to scope --help messages. See #2148 (@victor-gp)
+- Slightly adjust Zig syntax. See #2136 (@Enselic)
## Themes
diff --git a/assets/syntaxes/02_Extra/Zig b/assets/syntaxes/02_Extra/Zig
-Subproject 87ecbcae6fb5718369ce3bb3472ca0b2634e78e
+Subproject 1a4a38445fec495817625bafbeb01e79c44abcb
diff --git a/tests/syntax-tests/highlighted/Zig/example.zig b/tests/syntax-tests/highlighted/Zig/example.zig
index 7153dbfc..11bcd248 100644
--- a/tests/syntax-tests/highlighted/Zig/example.zig
+++ b/tests/syntax-tests/highlighted/Zig/example.zig
@@ -1,18 +1,18 @@
//! this is a top level doc, starts with "//!"
-const std = @import("std");
+const std = @import("std");
pub fn main() anyerror!void {
- const stdout = std.io.getStdOut().writer();
- try stdout.print("Hello, {}!\n", .{"world"});
+ const stdout = std.io.getStdOut().writer();
+ try stdout.print("Hello, {}!\n", .{"world"});
}
-const expect = std.testing.expect;
+const expect = std.testing.expect;
test "comments" {
 // comments start with "//" until newline
 // foo bar baz
- const x = true; // another comment
+ const x = true; // another comment
 expect(x);
}
@@ -25,26 +25,26 @@
 /// number of nanoseconds past the second
 nano: u32,
- const Self = @This();
+ const Self = @This();
 pub fn unixEpoch() Self {
 return Self{
- .seconds = 0,
- .nanos = 0,
+ .seconds = 0,
+ .nanos = 0,
 };
 }
};
-const my_val = switch (std.Target.current.os.tag) {
- .linux => "Linux",
+const my_val = switch (std.Target.current.os.tag) {
+ .linux => "Linux",
 else => "not Linux",
};
const Book = enum {
- paperback,
- hardcover,
- ebook,
- pdf,
+ paperback,
+ hardcover,
+ ebook,
+ pdf,
};
const TokenType = union(enum) {
@@ -54,54 +54,54 @@
};
const array_lit: [4]u8 = .{ 11, 22, 33, 44 };
-const sentinal_lit = [_:0]u8{ 1, 2, 3, 4 };
+const sentinal_lit = [_:0]u8{ 1, 2, 3, 4 };
test "address of syntax" {
 // Get the address of a variable:
 const x: i32 = 1234;
- const x_ptr = &x;
+ const x_ptr = &x;
 // Dereference a pointer:
 expect(x_ptr.* == 1234);
 // When you get the address of a const variable, you get a const pointer to a single item.
- expect(@TypeOf(x_ptr) == *const i32);
+ expect(@TypeOf(x_ptr) == *const i32);
 // If you want to mutate the value, you'd need an address of a mutable variable:
 var y: i32 = 5678;
- const y_ptr = &y;
- expect(@TypeOf(y_ptr) == *i32);
- y_ptr.* += 1;
+ const y_ptr = &y;
+ expect(@TypeOf(y_ptr) == *i32);
+ y_ptr.* += 1;
 expect(y_ptr.* == 5679);
}
// integer literals
-const decimal_int = 98222;
-const hex_int = 0xff;
-const another_hex_int = 0xFF;
-const octal_int = 0o755;
-const binary_int = 0b11110000;
+const decimal_int = 98222;
+const hex_int = 0xff;
+const another_hex_int = 0xFF;
+const octal_int = 0o755;
+const binary_int = 0b11110000;
// underscores may be placed between two digits as a visual separator
-const one_billion = 1_000_000_000;
-const binary_mask = 0b1_1111_1111;
-const permissions = 0o7_5_5;
-const big_address = 0xFF80_0000_0000_0000;
+const one_billion = 1_000_000_000;
+const binary_mask = 0b1_1111_1111;
+const permissions = 0o7_5_5;
+const big_address = 0xFF80_0000_0000_0000;
// float literals
-const floating_point = 123.0E+77;
-const another_float = 123.0;
-const yet_another = 123.0e+77;
+const floating_point = 123.0E+77;
+const another_float = 123.0;
+const yet_another = 123.0e+77;
-const hex_floating_point = 0x103.70p-5;
-const another_hex_float = 0x103.70;
-const yet_another_hex_float = 0x103.70P-5;
+const hex_floating_point = 0x103.70p-5;
+const another_hex_float = 0x103.70;
+const yet_another_hex_float = 0x103.70P-5;
// underscores may be placed between two digits as a visual separator
-const lightspeed = 299_792_458.000_000;
-const nanosecond = 0.000_000_001;
-const more_hex = 0x1234_5678.9ABC_CDEFp-10;
+const lightspeed = 299_792_458.000_000;
+const nanosecond = 0.000_000_001;
+const more_hex = 0x1234_5678.9ABC_CDEFp-10;
fn max(comptime T: type, a: T, b: T) T {
- return if (a > b) a else b;
+ return if (a > b) a else b;
}