| ... | ... | @@ -5433,12 +5433,21 @@ fn parseCPrimaryExpr(c: *Context, it: *CTokenList.Iterator, source: []const u8, |
| 5433 | 5433 | switch (tok.id) { |
| 5434 | 5434 | .CharLiteral => { |
| 5435 | 5435 | const first_tok = it.list.at(0); |
| 5436 | | const token = try appendToken(c, .CharLiteral, try zigifyEscapeSequences(c, source[tok.start..tok.end], source[first_tok.start..first_tok.end], source_loc)); |
| 5437 | | const node = try c.a().create(ast.Node.CharLiteral); |
| 5438 | | node.* = .{ |
| 5439 | | .token = token, |
| 5440 | | }; |
| 5441 | | return &node.base; |
| 5436 | if (source[tok.start] != '\'' or source[tok.start + 1] == '\\' or tok.end - tok.start == 3) { |
| 5437 | const token = try appendToken(c, .CharLiteral, try zigifyEscapeSequences(c, source[tok.start..tok.end], source[first_tok.start..first_tok.end], source_loc)); |
| 5438 | const node = try c.a().create(ast.Node.CharLiteral); |
| 5439 | node.* = .{ |
| 5440 | .token = token, |
| 5441 | }; |
| 5442 | return &node.base; |
| 5443 | } else { |
| 5444 | const token = try appendTokenFmt(c, .IntegerLiteral, "0x{x}", .{source[tok.start+1..tok.end-1]}); |
| 5445 | const node = try c.a().create(ast.Node.IntegerLiteral); |
| 5446 | node.* = .{ |
| 5447 | .token = token, |
| 5448 | }; |
| 5449 | return &node.base; |
| 5450 | } |
| 5442 | 5451 | }, |
| 5443 | 5452 | .StringLiteral => { |
| 5444 | 5453 | const first_tok = it.list.at(0); |