You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
GDScript: Add raw string literals (r-strings)
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
func test():
|
||||
print(r"\")
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Unterminated string.
|
||||
@@ -0,0 +1,2 @@
|
||||
func test():
|
||||
print(r"\\"")
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Unterminated string.
|
||||
@@ -0,0 +1,3 @@
|
||||
func test():
|
||||
# v
|
||||
print(r"['"]*")
|
||||
@@ -0,0 +1,2 @@
|
||||
GDTEST_PARSER_ERROR
|
||||
Closing "]" doesn't have an opening counterpart.
|
||||
22
modules/gdscript/tests/scripts/parser/features/r_strings.gd
Normal file
22
modules/gdscript/tests/scripts/parser/features/r_strings.gd
Normal file
@@ -0,0 +1,22 @@
|
||||
func test():
|
||||
print(r"test ' \' \" \\ \n \t \u2023 test")
|
||||
print(r"\n\\[\t ]*(\w+)")
|
||||
print(r"")
|
||||
print(r"\"")
|
||||
print(r"\\\"")
|
||||
print(r"\\")
|
||||
print(r"\" \\\" \\\\\"")
|
||||
print(r"\ \\ \\\ \\\\ \\\\\ \\")
|
||||
print(r'"')
|
||||
print(r'"(?:\\.|[^"])*"')
|
||||
print(r"""""")
|
||||
print(r"""test \t "test"="" " \" \\\" \ \\ \\\ test""")
|
||||
print(r'''r"""test \t "test"="" " \" \\\" \ \\ \\\ test"""''')
|
||||
print(r"\t
|
||||
\t")
|
||||
print(r"\t \
|
||||
\t")
|
||||
print(r"""\t
|
||||
\t""")
|
||||
print(r"""\t \
|
||||
\t""")
|
||||
22
modules/gdscript/tests/scripts/parser/features/r_strings.out
Normal file
22
modules/gdscript/tests/scripts/parser/features/r_strings.out
Normal file
@@ -0,0 +1,22 @@
|
||||
GDTEST_OK
|
||||
test ' \' \" \\ \n \t \u2023 test
|
||||
\n\\[\t ]*(\w+)
|
||||
|
||||
\"
|
||||
\\\"
|
||||
\\
|
||||
\" \\\" \\\\\"
|
||||
\ \\ \\\ \\\\ \\\\\ \\
|
||||
"
|
||||
"(?:\\.|[^"])*"
|
||||
|
||||
test \t "test"="" " \" \\\" \ \\ \\\ test
|
||||
r"""test \t "test"="" " \" \\\" \ \\ \\\ test"""
|
||||
\t
|
||||
\t
|
||||
\t \
|
||||
\t
|
||||
\t
|
||||
\t
|
||||
\t \
|
||||
\t
|
||||
Reference in New Issue
Block a user