Support triple backtick strings

This commit is contained in:
gingerBill
2026-08-12 16:08:58 +01:00
parent 5197806f88
commit ae2c7ead48
3 changed files with 83 additions and 46 deletions

View File

@@ -854,7 +854,9 @@ gb_internal ExactValue exact_value_from_token(AstFile *f, Token const &token) {
}
break;
case Token_String:
if (s.len >= 3 && s.text[0] == '"' && s.text[1] == '"' && s.text[2] == '"') {
if (s.len >= 6 &&
((s.text[0] == '"' && s.text[1] == '"' && s.text[2] == '"') ||
(s.text[0] == '`' && s.text[1] == '`' && s.text[2] == '`'))) {
if (!unquote_string_triple(ast_allocator(f), &s, string_contains_char(s, '\r'))) {
syntax_error(token, "Invalid multi-line string literal");
}