Merge pull request #74995 from dalexeev/gds-r-strings

GDScript: Add raw string literals (r-strings)
This commit is contained in:
Rémi Verschelde 2023-09-20 13:09:13 +02:00
commit 21b132616b
No known key found for this signature in database
GPG key ID: C3336907360768E1
13 changed files with 250 additions and 132 deletions

View file

@ -0,0 +1,2 @@
func test():
print(r"\")

View file

@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Unterminated string.

View file

@ -0,0 +1,2 @@
func test():
print(r"\\"")

View file

@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Unterminated string.

View file

@ -0,0 +1,3 @@
func test():
# v
print(r"['"]*")

View file

@ -0,0 +1,2 @@
GDTEST_PARSER_ERROR
Closing "]" doesn't have an opening counterpart.

View 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""")

View 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