| author | |
| committer | |
| log | a45db7e853c2aa04ff7a91dbda975f181aa467bd |
| tree | 2f89718ec3edb9a2fec29753d60ffcd630af8698 |
| parent | 5b156031e92c66c1bea71d5eb6c337b23185d65d |
3 files changed, 22 insertions(+), 3 deletions(-)
build.zig+4-1| ... | ... | @@ -33,6 +33,8 @@ pub fn build(b: &Builder) { |
| 33 | 33 | docs_step.dependOn(&docgen_cmd.step); |
| 34 | 34 | docs_step.dependOn(&docgen_home_cmd.step); |
| 35 | 35 | |
| 36 | const test_step = b.step("test", "Run all the tests"); | |
| 37 | ||
| 36 | 38 | if (findLLVM(b)) |llvm| { |
| 37 | 39 | // find the stage0 build artifacts because we're going to re-use config.h and zig_cpp library |
| 38 | 40 | const build_info = b.exec([][]const u8{b.zig_exe, "BUILD_INFO"}); |
| ... | ... | @@ -72,15 +74,16 @@ pub fn build(b: &Builder) { |
| 72 | 74 | |
| 73 | 75 | b.default_step.dependOn(&exe.step); |
| 74 | 76 | b.default_step.dependOn(docs_step); |
| 77 | test_step.dependOn(&exe.step); | |
| 75 | 78 | |
| 76 | 79 | b.installArtifact(exe); |
| 77 | 80 | installStdLib(b); |
| 81 | ||
| 78 | 82 | } |
| 79 | 83 | |
| 80 | 84 | |
| 81 | 85 | const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter"); |
| 82 | 86 | const with_lldb = b.option(bool, "with-lldb", "Run tests in LLDB to get a backtrace if one fails") ?? false; |
| 83 | const test_step = b.step("test", "Run all the tests"); | |
| 84 | 87 | |
| 85 | 88 | test_step.dependOn(docs_step); |
| 86 | 89 |
src-self-hosted/main.zig+5| ... | ... | @@ -626,3 +626,8 @@ fn findZigLibDir(allocator: &mem.Allocator) -> %[]u8 { |
| 626 | 626 | |
| 627 | 627 | return error.FileNotFound; |
| 628 | 628 | } |
| 629 | ||
| 630 | test "import tests" { | |
| 631 | _ = @import("tokenizer.zig"); | |
| 632 | _ = @import("parser.zig"); | |
| 633 | } |
src-self-hosted/tokenizer.zig+13-2| ... | ... | @@ -204,6 +204,7 @@ pub const Tokenizer = struct { |
| 204 | 204 | LineComment, |
| 205 | 205 | Zero, |
| 206 | 206 | IntegerLiteral, |
| 207 | IntegerLiteralWithRadix, | |
| 207 | 208 | NumberDot, |
| 208 | 209 | FloatFraction, |
| 209 | 210 | FloatExponentUnsigned, |
| ... | ... | @@ -454,7 +455,7 @@ pub const Tokenizer = struct { |
| 454 | 455 | }, |
| 455 | 456 | State.Zero => switch (c) { |
| 456 | 457 | 'b', 'o', 'x' => { |
| 457 | state = State.IntegerLiteral; | |
| 458 | state = State.IntegerLiteralWithRadix; | |
| 458 | 459 | }, |
| 459 | 460 | else => { |
| 460 | 461 | // reinterpret as a normal number |
| ... | ... | @@ -469,6 +470,16 @@ pub const Tokenizer = struct { |
| 469 | 470 | 'p', 'P', 'e', 'E' => { |
| 470 | 471 | state = State.FloatExponentUnsigned; |
| 471 | 472 | }, |
| 473 | '0'...'9' => {}, | |
| 474 | else => break, | |
| 475 | }, | |
| 476 | State.IntegerLiteralWithRadix => switch (c) { | |
| 477 | '.' => { | |
| 478 | state = State.NumberDot; | |
| 479 | }, | |
| 480 | 'p', 'P' => { | |
| 481 | state = State.FloatExponentUnsigned; | |
| 482 | }, | |
| 472 | 483 | '0'...'9', 'a'...'f', 'A'...'F' => {}, |
| 473 | 484 | else => break, |
| 474 | 485 | }, |
| ... | ... | @@ -485,7 +496,7 @@ pub const Tokenizer = struct { |
| 485 | 496 | }, |
| 486 | 497 | }, |
| 487 | 498 | State.FloatFraction => switch (c) { |
| 488 | 'p', 'P', 'e', 'E' => { | |
| 499 | 'p', 'P' => { | |
| 489 | 500 | state = State.FloatExponentUnsigned; |
| 490 | 501 | }, |
| 491 | 502 | '0'...'9', 'a'...'f', 'A'...'F' => {}, |