diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-10-27 22:44:53 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-10-27 22:44:53 -0300 |
commit | 9608d4255eb6c76b1c4496f4494c829133e096f4 (patch) | |
tree | a5a95a8e1b8a9225f38ccef34517fc3f14e50e32 /modules | |
parent | b42ced68e8cfe316d7bcd016f7f889485c596573 (diff) | |
parent | f1744c8c3106b43a48bb9ac314f1f51334b54fd9 (diff) |
Merge pull request #823 from grabiller/#821
Fix issue #821: GDScript now accepts single quoted as well as double quoted strings.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/gdscript/gd_tokenizer.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 7a1d6814ba..9ccedd34ea 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -237,7 +237,9 @@ void GDTokenizerText::_advance() { while (true) { - bool is_node_path=false; + bool is_node_path = false; + bool is_string = false; + bool is_string_alt = false; switch(GETCHAR(0)) { case 0: @@ -527,13 +529,17 @@ void GDTokenizerText::_advance() { } } break; case '@': - if (CharType(GETCHAR(1))!='"') { + if( CharType(GETCHAR(1))!='"' && CharType(GETCHAR(1))!='\'' ) { _make_error("Unexpected '@'"); return; } INCPOS(1); is_node_path=true; + + case '\'': + is_string_alt = true; case '"': { + is_string = is_string_alt ? false : true; int i=1; String str; @@ -542,8 +548,10 @@ void GDTokenizerText::_advance() { _make_error("Unterminated String"); return; - } else if (CharType(GETCHAR(i)=='"')) { + } else if( CharType(GETCHAR(i)=='"') && is_string ) { break; + } else if( CharType(GETCHAR(i)=='\'') && is_string_alt ) { + break; } else if (CharType(GETCHAR(i)=='\\')) { //escaped characters... i++; |