| author | |
| committer | |
| log | fa377dbd1510fc733607afe47dc04dfe55d5ff88 |
| tree | c69eb6c3be0a1747768e7137bd26ad9e24a7e69e |
| parent | 1fb70497d24da9c0cb6f0e025948fa40eaaa36af |
2 files changed, 9 insertions(+), 0 deletions(-)
lib/std/c/tokenizer.zig+4| ... | @@ -651,6 +651,7 @@ pub const Tokenizer = struct { | ... | @@ -651,6 +651,7 @@ pub const Tokenizer = struct { |
| 651 | state = .StringLiteral; | 651 | state = .StringLiteral; |
| 652 | }, | 652 | }, |
| 653 | else => { | 653 | else => { |
| 654 | self.index -= 1; | ||
| 654 | state = .Identifier; | 655 | state = .Identifier; |
| 655 | }, | 656 | }, |
| 656 | }, | 657 | }, |
| ... | @@ -660,6 +661,7 @@ pub const Tokenizer = struct { | ... | @@ -660,6 +661,7 @@ pub const Tokenizer = struct { |
| 660 | state = .StringLiteral; | 661 | state = .StringLiteral; |
| 661 | }, | 662 | }, |
| 662 | else => { | 663 | else => { |
| 664 | self.index -= 1; | ||
| 663 | state = .Identifier; | 665 | state = .Identifier; |
| 664 | }, | 666 | }, |
| 665 | }, | 667 | }, |
| ... | @@ -673,6 +675,7 @@ pub const Tokenizer = struct { | ... | @@ -673,6 +675,7 @@ pub const Tokenizer = struct { |
| 673 | state = .StringLiteral; | 675 | state = .StringLiteral; |
| 674 | }, | 676 | }, |
| 675 | else => { | 677 | else => { |
| 678 | self.index -= 1; | ||
| 676 | state = .Identifier; | 679 | state = .Identifier; |
| 677 | }, | 680 | }, |
| 678 | }, | 681 | }, |
| ... | @@ -686,6 +689,7 @@ pub const Tokenizer = struct { | ... | @@ -686,6 +689,7 @@ pub const Tokenizer = struct { |
| 686 | state = .StringLiteral; | 689 | state = .StringLiteral; |
| 687 | }, | 690 | }, |
| 688 | else => { | 691 | else => { |
| 692 | self.index -= 1; | ||
| 689 | state = .Identifier; | 693 | state = .Identifier; |
| 690 | }, | 694 | }, |
| 691 | }, | 695 | }, |
test/translate_c.zig+5| ... | @@ -1362,12 +1362,17 @@ pub fn addCases(cases: *tests.TranslateCContext) void { | ... | @@ -1362,12 +1362,17 @@ pub fn addCases(cases: *tests.TranslateCContext) void { |
| 1362 | cases.add("basic macro function", | 1362 | cases.add("basic macro function", |
| 1363 | \\extern int c; | 1363 | \\extern int c; |
| 1364 | \\#define BASIC(c) (c*2) | 1364 | \\#define BASIC(c) (c*2) |
| 1365 | \\#define FOO(L,b) (L + b) | ||
| 1365 | , &[_][]const u8{ | 1366 | , &[_][]const u8{ |
| 1366 | \\pub extern var c: c_int; | 1367 | \\pub extern var c: c_int; |
| 1367 | , | 1368 | , |
| 1368 | \\pub inline fn BASIC(c_1: var) @TypeOf(c_1 * 2) { | 1369 | \\pub inline fn BASIC(c_1: var) @TypeOf(c_1 * 2) { |
| 1369 | \\ return c_1 * 2; | 1370 | \\ return c_1 * 2; |
| 1370 | \\} | 1371 | \\} |
| 1372 | , | ||
| 1373 | \\pub inline fn FOO(L: var, b: var) @TypeOf(L + b) { | ||
| 1374 | \\ return L + b; | ||
| 1375 | \\} | ||
| 1371 | }); | 1376 | }); |
| 1372 | 1377 | ||
| 1373 | cases.add("macro defines string literal with hex", | 1378 | cases.add("macro defines string literal with hex", |