8 files changed, 34 insertions(+), 39 deletions(-)
build.zig+1-1| ... | ... | @@ -273,7 +273,7 @@ pub fn build(b: *Build) !void { |
| 273 | 273 | std.math.maxInt(usize), |
| 274 | 274 | ); |
| 275 | 275 | const first_header = std.mem.indexOf(u8, text, "## ") orelse @panic("Invalid changelog"); |
| 276 | var tokenizer = std.mem.tokenizeAny(u8, text[first_header + 2 ..], " \t\n"); | |
| 276 | var tokenizer = std.mem.tokenizeAny(u8, text[first_header + 2 ..], " \t\r\n"); | |
| 277 | 277 | const version_text = tokenizer.next() orelse @panic("Invalid changelog"); |
| 278 | 278 | var version = std.SemanticVersion.parse(version_text) catch |
| 279 | 279 | std.debug.panic("Invalid version: {s}", .{version_text}); |
build.zig.zon+1-1| ... | ... | @@ -2,7 +2,7 @@ |
| 2 | 2 | .name = "", |
| 3 | 3 | .version = "0.0.0", |
| 4 | 4 | |
| 5 | .minimum_zig_version = "0.14.0-dev.1472+3929cac15", | |
| 5 | .minimum_zig_version = "0.14.0-dev.1511+54b668f8a", | |
| 6 | 6 | |
| 7 | 7 | .dependencies = .{ |
| 8 | 8 | // Used to determine unicode properties to tokenize identifiers |
ci created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | #!/bin/sh | |
| 2 | # Continuous Integration Script | |
| 3 | # By default, this will run a release build and checks | |
| 4 | # locally. When run by CI, it will upload artifacts and | |
| 5 | # deploy the language reference web page. | |
| 6 | set -e | |
| 7 | ||
| 8 | commit=$(git rev-parse HEAD) | |
| 9 | commit_short=$(echo "$commit" | cut -c -9) | |
| 10 | ||
| 11 | typos | |
| 12 | dprint check | |
| 13 | ./build test package --summary all | |
| 14 | ||
| 15 | if [ -n "$UPLOAD_RELEASE_ARTIFACTS" ]; then | |
| 16 | pushd zig-out/package | |
| 17 | zip compiler-$commit.zip * | |
| 18 | buildkite-agent artifact upload compiler-$commit.zip | |
| 19 | popd | |
| 20 | ||
| 21 | rm -fr zig-out/site | |
| 22 | mkdir zig-out/site | |
| 23 | cp zig-out/package/README.html zig-out/site/index.html | |
| 24 | npx wrangler pages deploy zig-out/site --commit-hash "$commit" --no-bundle --project-name language-manual | |
| 25 | fi |
doc/architecture.md+3-3| ... | ... | @@ -27,9 +27,9 @@ Aside from tests written using Zig's test runner, there are a large set of tests |
| 27 | 27 | within `test` which are ran using a custom test runner binary. It categorizes |
| 28 | 28 | compiler tests into these categories: |
| 29 | 29 | |
| 30 | - **Analysis Tests** (`test/analysis/*`) verify the semantic analysis | |
| 31 | engine, and must not emit any runtime `Air`. Some analysis tests may | |
| 32 | expect certain compile errors. | |
| 30 | - **Analysis Tests** (`test/analysis/*`) verify the semantic analysis engine, | |
| 31 | and must not emit any runtime `Air`. Some analysis tests may expect certain | |
| 32 | compile errors. | |
| 33 | 33 | - **Behavior Tests** (`test/behavior/*`) generate code to be executed at |
| 34 | 34 | runtime, testing both the semantic analysis pass as well as the code |
| 35 | 35 | generation backend. |
hello deleted-6| ... | ... | @@ -1,6 +0,0 @@ |
| 1 | fn runtime() -> int { | |
| 2 | 542 | |
| 3 | } | |
| 4 | ||
| 5 | var abc: int = 0; | |
| 6 | abc = runtime(); |
out.js deleted-21| ... | ... | @@ -1,21 +0,0 @@ |
| 1 | // Language Compiler v0.1.6. Alpha quality software. | |
| 2 | let addFloat = (v0, v1) => v0 + v1; | |
| 3 | let f = v0 => v0; | |
| 4 | let subFloat = (v0, v1) => v0 - v1; | |
| 5 | let mulFloat = (v0, v1) => v0 * v1; | |
| 6 | let divFloat = (v0, v1) => v0 / v1; | |
| 7 | let addInt = (v0, v1) => v0 + v1; | |
| 8 | let i = v0 => v0; | |
| 9 | let subInt = (v0, v1) => v0 - v1; | |
| 10 | assertEqual(addFloat(1, 2), f(3)); | |
| 11 | assertEqual(addFloat(1.5, 2.2), f(3.7)); | |
| 12 | assertEqual(subFloat(1, 2), f(-1)); | |
| 13 | assertEqual(subFloat(1.5, 2.2), f(-0.7000000000000002)); | |
| 14 | assertEqual(mulFloat(1, 2), f(2)); | |
| 15 | assertEqual(mulFloat(1.5, 2.2), f(3.3000000000000003)); | |
| 16 | assertEqual(divFloat(1, 2), f(0.5)); | |
| 17 | assertEqual(divFloat(1.5, 2.2), f(0.6818181818181818)); | |
| 18 | assertEqual(addInt(1, 2), i(3)); | |
| 19 | assertEqual(addInt(-421, 592), i(171)); | |
| 20 | assertEqual(subInt(1, 2), i(-1)); | |
| 21 | assertEqual(subInt(528, -43), i(571)); |
src/core/Tokenizer.zig+2-2| ... | ... | @@ -1318,10 +1318,10 @@ test "field access" { |
| 1318 | 1318 | var tokenizer = Tokenizer{ .code = source }; |
| 1319 | 1319 | for (expected_tokens) |tok| { |
| 1320 | 1320 | tokenizer.skipWhitespace(); |
| 1321 | try testing.expectEqual(tok, (try tokenizer.next()).?); | |
| 1321 | try testing.expectEqual(tok, tokenizer.next()); | |
| 1322 | 1322 | } |
| 1323 | 1323 | tokenizer.skipWhitespace(); |
| 1324 | try testing.expectEqual(null, (try tokenizer.next())); | |
| 1324 | try testing.expectEqual(null, tokenizer.next()); | |
| 1325 | 1325 | } |
| 1326 | 1326 | |
| 1327 | 1327 | test "string escapes" { |
src/manual/generate-man.zig+2-5| ... | ... | @@ -575,10 +575,7 @@ fn writeTokenizedCode(gpa: Allocator, code: []const u8, writer: anytype) !void { |
| 575 | 575 | var last: usize = 0; |
| 576 | 576 | while (true) { |
| 577 | 577 | t.skipWhitespace(); |
| 578 | const tok = t.next() catch { | |
| 579 | t.pos += 1; | |
| 580 | continue; | |
| 581 | } orelse break; | |
| 578 | const tok = t.next() orelse break; | |
| 582 | 579 | try writeHtmlEscapedSlice(t.code[last..tok.offset], writer, false); |
| 583 | 580 | try writer.print("<span class='tok-{s}{s}'>{s}</span>", .{ |
| 584 | 581 | @tagName(tok.tag), |
| ... | ... | @@ -649,7 +646,7 @@ fn replaceInTemplate(alloc: Allocator, template: []const u8, replacements: anyty |
| 649 | 646 | const Map = std.StringArrayHashMapUnmanaged([]const u8); |
| 650 | 647 | |
| 651 | 648 | var map: Map = .{}; |
| 652 | inline for (@typeInfo(Replacements).Struct.fields) |field| { | |
| 649 | inline for (@typeInfo(Replacements).@"struct".fields) |field| { | |
| 653 | 650 | try map.put(alloc, field.name, @field(replacements, field.name)); |
| 654 | 651 | } |
| 655 | 652 |