Merge pull request #74995 from dalexeev/gds-r-strings
GDScript: Add raw string literals (r-strings)
This commit is contained in:
commit
21b132616b
13 changed files with 250 additions and 132 deletions
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue