lang: rename signed integer types sN -> iN
Surface rename of the signed integer family: s1..s64 become i1..i64
(u1..u64, usize, isize unchanged). 'string' keeps the s-prefix arm in
name classification; width parsing moves to the i-prefix arm next to
isize.
Internal TypeId tags follow the surface (.s8/.s16/.s32/.s64 ->
.i8/.i16/.i32/.i64), as do mono-key mangle fragments (ptr_i64,
tu_i64_bool) and all display/diagnostic formatting (i{d}).
Migrated in the same sweep: stdlib + examples + issue repros + FFI C
companions (shared symbol names like ffi_id_i64), expected
stdout/stderr/ir snapshots, specs.md, readme.md, CLAUDE.md/AGENTS.md,
implementation_plan.md, docs/, issue writeups. Vendored stb_image and
historical flow state left untouched.
zig build test: 426/426; examples suite: 595/595.
This commit is contained in:
@@ -54,7 +54,7 @@ pub const Lexer = struct {
|
||||
// following identifier to be RAW (never type-classified, never
|
||||
// reserved-checked). The emitted token's span excludes the backtick, so
|
||||
// its text is the bare name, and a backticked keyword spelling
|
||||
// (`` `s2 ``, `` `string ``) is still an `.identifier`, never a keyword.
|
||||
// (`` `i2 ``, `` `string ``) is still an `.identifier`, never a keyword.
|
||||
if (c == '`') {
|
||||
const id_start = start + 1;
|
||||
if (id_start < self.source.len and isIdentStart(self.source[id_start])) {
|
||||
@@ -538,22 +538,22 @@ test "lex keywords" {
|
||||
}
|
||||
|
||||
test "lex type-like identifiers" {
|
||||
// s32, u8, bool, string are identifiers, not keywords
|
||||
var lex = Lexer.init("s32 u8 bool string");
|
||||
// i32, u8, bool, string are identifiers, not keywords
|
||||
var lex = Lexer.init("i32 u8 bool string");
|
||||
for (0..4) |_| {
|
||||
try std.testing.expectEqual(Tag.identifier, lex.next().tag);
|
||||
}
|
||||
}
|
||||
|
||||
test "lex backtick raw identifier" {
|
||||
const source: [:0]const u8 = "`s2 `string `for";
|
||||
const source: [:0]const u8 = "`i2 `string `for";
|
||||
var lex = Lexer.init(source);
|
||||
// Each is an `.identifier` carrying `is_raw`, even a keyword spelling
|
||||
// (`for`), with text that excludes the leading backtick.
|
||||
const t1 = lex.next();
|
||||
try std.testing.expectEqual(Tag.identifier, t1.tag);
|
||||
try std.testing.expect(t1.is_raw);
|
||||
try std.testing.expectEqualStrings("s2", t1.slice(source));
|
||||
try std.testing.expectEqualStrings("i2", t1.slice(source));
|
||||
const t2 = lex.next();
|
||||
try std.testing.expectEqual(Tag.identifier, t2.tag);
|
||||
try std.testing.expect(t2.is_raw);
|
||||
@@ -566,7 +566,7 @@ test "lex backtick raw identifier" {
|
||||
}
|
||||
|
||||
test "lex bare identifier is not raw" {
|
||||
var lex = Lexer.init("s2");
|
||||
var lex = Lexer.init("i2");
|
||||
const tok = lex.next();
|
||||
try std.testing.expectEqual(Tag.identifier, tok.tag);
|
||||
try std.testing.expect(!tok.is_raw);
|
||||
|
||||
Reference in New Issue
Block a user