diff options
author | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2021-11-11 15:41:59 +0200 |
---|---|---|
committer | bruvzg <7645683+bruvzg@users.noreply.github.com> | 2021-11-11 15:41:59 +0200 |
commit | 74b9892f7abdd455bdff3bf0767fce714ee93fc2 (patch) | |
tree | 1064881ac1db4efaae4c70b245ca413b62a9e1ef /modules | |
parent | 9547d6d5437d675c3e49ca687f81dc762260770d (diff) |
[GDScript] Check string literals for Unicode direction control characters.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gdscript_tokenizer.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/gdscript/gdscript_tokenizer.cpp b/modules/gdscript/gdscript_tokenizer.cpp index cd247d1d26..3725fb58f5 100644 --- a/modules/gdscript/gdscript_tokenizer.cpp +++ b/modules/gdscript/gdscript_tokenizer.cpp @@ -795,6 +795,15 @@ GDScriptTokenizer::Token GDScriptTokenizer::string() { char32_t ch = _peek(); + if (ch == 0x200E || ch == 0x200F || (ch >= 0x202A && ch <= 0x202E) || (ch >= 0x2066 && ch <= 0x2069)) { + Token error = make_error("Invisible text direction control character present in the string, escape it (\"\\u" + String::num_int64(ch, 16) + "\") to avoid confusion."); + error.start_column = column; + error.leftmost_column = error.start_column; + error.end_column = column + 1; + error.rightmost_column = error.end_column; + push_error(error); + } + if (ch == '\\') { // Escape pattern. _advance(); |