mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Added multi line strings raw strings. This also somewhat improves error reporting on strings.
This commit is contained in:
committed by
Christoffer Lerno
parent
64f20da080
commit
f198e6c53a
57
test/test_suite/strings/multiline_strings.c3t
Normal file
57
test/test_suite/strings/multiline_strings.c3t
Normal file
@@ -0,0 +1,57 @@
|
||||
|
||||
char *message0 = """
|
||||
hello
|
||||
world \x45
|
||||
where is "quoted"
|
||||
total
|
||||
""";
|
||||
|
||||
char *message1 = """
|
||||
\| hello
|
||||
\| world \x45
|
||||
\| where is "quoted"
|
||||
\| total
|
||||
""";
|
||||
|
||||
char *messages = """
|
||||
\s hello
|
||||
\s world \x45
|
||||
\s where is "quoted"
|
||||
\s total
|
||||
""";
|
||||
|
||||
char *message2 = `
|
||||
``oh`` superman
|
||||
where are you now?
|
||||
`;
|
||||
|
||||
char *message3 = "Hfo\u0044ke";
|
||||
char *message4 = "\x64\x6f\x63\x75\x6d\x65\x6e\x74";
|
||||
|
||||
char *message00 = """
|
||||
hello
|
||||
""";
|
||||
|
||||
char *message01 = """
|
||||
hello""";
|
||||
|
||||
char *message02 = """ """;
|
||||
|
||||
char *message03 = """
|
||||
hello
|
||||
""";
|
||||
|
||||
// #expect: multiline_strings.ll
|
||||
|
||||
|
||||
@.str = private constant [45 x i8] c" hello\0A world E\0A where is \22quoted\22\0Atotal\00", align 1
|
||||
@.str.10 = private constant [52 x i8] c" hello\0A world E\0A where is \22quoted\22\0A total\00", align 1
|
||||
@.str.11 = private constant [56 x i8] c" hello\0A world E\0A where is \22quoted\22\0A total\00", align 1
|
||||
@.str.12 = private constant [41 x i8] c"\0A `oh` superman\0A where are you now?\0A\00", align 1
|
||||
@.str.13 = private constant [7 x i8] c"HfoDke\00", align 1
|
||||
@.str.14 = private constant [9 x i8] c"document\00", align 1
|
||||
|
||||
@.str.15 = private constant [6 x i8] c"hello\00", align 1
|
||||
@.str.16 = private constant [6 x i8] c"hello\00", align 1
|
||||
@.str.17 = private constant [2 x i8] c" \00", align 1
|
||||
@.str.18 = private constant [6 x i8] c"hello\00", align 1
|
||||
@@ -1,14 +1,14 @@
|
||||
func void main()
|
||||
{
|
||||
char *s = "Hello\0 world!";
|
||||
char *s = "Hello\0 world!" " now";
|
||||
}
|
||||
|
||||
// #expect: string_escape.ll
|
||||
|
||||
@.str = private constant [14 x i8] c"Hello\00 world!\00", align 1
|
||||
@.str = private constant [18 x i8] c"Hello\00 world! now\00", align 1
|
||||
|
||||
define void @main()
|
||||
entry:
|
||||
%s = alloca i8*, align 8
|
||||
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i32 0, i32 0), i8** %s, align 8
|
||||
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i32 0, i32 0), i8** %s, align 8
|
||||
ret void
|
||||
|
||||
Reference in New Issue
Block a user