diff options
Diffstat (limited to 'modules/gdscript/gd_tokenizer.cpp')
-rw-r--r-- | modules/gdscript/gd_tokenizer.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/modules/gdscript/gd_tokenizer.cpp b/modules/gdscript/gd_tokenizer.cpp index 7a1d6814ba..0fa83b9eb4 100644 --- a/modules/gdscript/gd_tokenizer.cpp +++ b/modules/gdscript/gd_tokenizer.cpp @@ -91,6 +91,7 @@ const char* GDTokenizer::token_names[TK_MAX]={ "tool", "static", "export", +"setget", "const", "var", "preload", @@ -237,7 +238,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 +530,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 +549,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++; @@ -823,6 +832,7 @@ void GDTokenizerText::_advance() { {TK_PR_TOOL,"tool"}, {TK_PR_STATIC,"static"}, {TK_PR_EXPORT,"export"}, + {TK_PR_SETGET,"setget"}, {TK_PR_VAR,"var"}, {TK_PR_PRELOAD,"preload"}, {TK_PR_ASSERT,"assert"}, @@ -1007,7 +1017,7 @@ void GDTokenizerText::advance(int p_amount) { ////////////////////////////////////////////////////////////////////////////////////////////////////// -#define BYTECODE_VERSION 2 +#define BYTECODE_VERSION 3 Error GDTokenizerBuffer::set_code_buffer(const Vector<uint8_t> & p_buffer) { |