mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
fix c tokenizer bug
This commit is contained in:
parent
1fb70497d2
commit
fa377dbd15
@ -651,6 +651,7 @@ pub const Tokenizer = struct {
|
||||
state = .StringLiteral;
|
||||
},
|
||||
else => {
|
||||
self.index -= 1;
|
||||
state = .Identifier;
|
||||
},
|
||||
},
|
||||
@ -660,6 +661,7 @@ pub const Tokenizer = struct {
|
||||
state = .StringLiteral;
|
||||
},
|
||||
else => {
|
||||
self.index -= 1;
|
||||
state = .Identifier;
|
||||
},
|
||||
},
|
||||
@ -673,6 +675,7 @@ pub const Tokenizer = struct {
|
||||
state = .StringLiteral;
|
||||
},
|
||||
else => {
|
||||
self.index -= 1;
|
||||
state = .Identifier;
|
||||
},
|
||||
},
|
||||
@ -686,6 +689,7 @@ pub const Tokenizer = struct {
|
||||
state = .StringLiteral;
|
||||
},
|
||||
else => {
|
||||
self.index -= 1;
|
||||
state = .Identifier;
|
||||
},
|
||||
},
|
||||
|
||||
@ -1362,12 +1362,17 @@ pub fn addCases(cases: *tests.TranslateCContext) void {
|
||||
cases.add("basic macro function",
|
||||
\\extern int c;
|
||||
\\#define BASIC(c) (c*2)
|
||||
\\#define FOO(L,b) (L + b)
|
||||
, &[_][]const u8{
|
||||
\\pub extern var c: c_int;
|
||||
,
|
||||
\\pub inline fn BASIC(c_1: var) @TypeOf(c_1 * 2) {
|
||||
\\ return c_1 * 2;
|
||||
\\}
|
||||
,
|
||||
\\pub inline fn FOO(L: var, b: var) @TypeOf(L + b) {
|
||||
\\ return L + b;
|
||||
\\}
|
||||
});
|
||||
|
||||
cases.add("macro defines string literal with hex",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user